Remove intro/overview from guide game menu

Unless picoCTF
Will show guide option if non-course and help videos.
This commit is contained in:
Matt Lott 2016-07-21 11:11:11 -07:00
parent b1277dc95f
commit 01679982d5
2 changed files with 21 additions and 16 deletions

View file

@ -32,7 +32,9 @@ module.exports = class GameMenuModal extends ModalView
docs = @options.level.get('documentation') ? {}
submenus = ['guide', 'options', 'save-load']
submenus = _.without submenus, 'options' if window.serverConfig.picoCTF
submenus = _.without submenus, 'guide' unless docs.specificArticles?.length or docs.generalArticles?.length or window.serverConfig.picoCTF
unless window.serverConfig.picoCTF
if @level.isType('course', 'course-ladder') or not @options.level.get('helpVideos')?.length > 0
submenus = _.without submenus, 'guide'
submenus = _.without submenus, 'save-load' unless me.isAdmin() or /https?:\/\/localhost/.test(window.location.href)
@includedSubmenus = submenus
context.showTab = @options.showTab ? submenus[0]

View file

@ -28,23 +28,26 @@ module.exports = class LevelGuideView extends CocoView
@videoLocked = not (@helpVideo?.free or @isCourseLevel) and @requiresSubscription
@firstOnly = options.firstOnly
@docs = options?.docs ? options.level.get('documentation') ? {}
general = @docs.generalArticles or []
specific = @docs.specificArticles or []
if window.serverConfig.picoCTF
@docs = options?.docs ? options.level.get('documentation') ? {}
general = @docs.generalArticles or []
specific = @docs.specificArticles or []
articles = options.supermodel.getModels(Article)
articleMap = {}
articleMap[article.get('original')] = article for article in articles
general = (articleMap[ref.original] for ref in general)
general = (article.attributes for article in general when article)
articles = options.supermodel.getModels(Article)
articleMap = {}
articleMap[article.get('original')] = article for article in articles
general = (articleMap[ref.original] for ref in general)
general = (article.attributes for article in general when article)
@docs = specific.concat(general)
@docs = $.extend(true, [], @docs)
@docs = [@docs[0]] if @firstOnly and @docs[0]
@addPicoCTFProblem() if window.serverConfig.picoCTF
doc.html = marked(utils.filterMarkdownCodeLanguages(utils.i18n(doc, 'body'), options.session.get('codeLanguage'))) for doc in @docs
doc.slug = _.string.slugify(doc.name) for doc in @docs
doc.name = (utils.i18n doc, 'name') for doc in @docs
@docs = specific.concat(general)
@docs = $.extend(true, [], @docs)
@docs = [@docs[0]] if @firstOnly and @docs[0]
@addPicoCTFProblem()
doc.html = marked(utils.filterMarkdownCodeLanguages(utils.i18n(doc, 'body'), options.session.get('codeLanguage'))) for doc in @docs
doc.slug = _.string.slugify(doc.name) for doc in @docs
doc.name = (utils.i18n doc, 'name') for doc in @docs
else
@docs = []
destroy: ->
if @vimeoListenerAttached