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') ? {} docs = @options.level.get('documentation') ? {}
submenus = ['guide', 'options', 'save-load'] submenus = ['guide', 'options', 'save-load']
submenus = _.without submenus, 'options' if window.serverConfig.picoCTF 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) submenus = _.without submenus, 'save-load' unless me.isAdmin() or /https?:\/\/localhost/.test(window.location.href)
@includedSubmenus = submenus @includedSubmenus = submenus
context.showTab = @options.showTab ? submenus[0] context.showTab = @options.showTab ? submenus[0]

View file

@ -28,6 +28,7 @@ module.exports = class LevelGuideView extends CocoView
@videoLocked = not (@helpVideo?.free or @isCourseLevel) and @requiresSubscription @videoLocked = not (@helpVideo?.free or @isCourseLevel) and @requiresSubscription
@firstOnly = options.firstOnly @firstOnly = options.firstOnly
if window.serverConfig.picoCTF
@docs = options?.docs ? options.level.get('documentation') ? {} @docs = options?.docs ? options.level.get('documentation') ? {}
general = @docs.generalArticles or [] general = @docs.generalArticles or []
specific = @docs.specificArticles or [] specific = @docs.specificArticles or []
@ -41,10 +42,12 @@ module.exports = class LevelGuideView extends CocoView
@docs = specific.concat(general) @docs = specific.concat(general)
@docs = $.extend(true, [], @docs) @docs = $.extend(true, [], @docs)
@docs = [@docs[0]] if @firstOnly and @docs[0] @docs = [@docs[0]] if @firstOnly and @docs[0]
@addPicoCTFProblem() if window.serverConfig.picoCTF @addPicoCTFProblem()
doc.html = marked(utils.filterMarkdownCodeLanguages(utils.i18n(doc, 'body'), options.session.get('codeLanguage'))) for doc in @docs 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.slug = _.string.slugify(doc.name) for doc in @docs
doc.name = (utils.i18n doc, 'name') for doc in @docs doc.name = (utils.i18n doc, 'name') for doc in @docs
else
@docs = []
destroy: -> destroy: ->
if @vimeoListenerAttached if @vimeoListenerAttached