Made the guide, when it shows up the first time, only show the first doc.

This commit is contained in:
Scott Erickson 2014-05-19 22:25:40 -07:00
parent f24ee98295
commit 042fd7ac0d
2 changed files with 6 additions and 1 deletions
app/views/play

View file

@ -13,6 +13,7 @@ module.exports = class DocsModal extends View
'enter': 'hide'
constructor: (options) ->
@firstOnly = options.firstOnly
@docs = options?.docs
general = @docs.generalArticles or []
specific = @docs.specificArticles or []
@ -25,6 +26,7 @@ module.exports = class DocsModal extends View
@docs = specific.concat(general)
@docs = $.extend(true, [], @docs)
@docs = [@docs[0]] if @firstOnly and @docs[0]
doc.html = marked(utils.i18n doc, 'body') for doc in @docs
doc.name = (utils.i18n doc, 'name') for doc in @docs
doc.slug = _.string.slugify(doc.name) for doc in @docs

View file

@ -133,7 +133,10 @@ module.exports = class PlayLevelView extends View
showGuide: ->
@seenDocs = true
DocsModal = require './level/modal/docs_modal'
options = {docs: @levelLoader.level.get('documentation'), supermodel: @supermodel}
options =
docs: @levelLoader.level.get('documentation')
supermodel: @supermodel
firstOnly: true
@openModalView(new DocsModal(options), true)
Backbone.Mediator.subscribeOnce 'modal-closed', @onLevelStarted, @
return true