diff --git a/app/views/play/menu/GameMenuModal.coffee b/app/views/play/menu/GameMenuModal.coffee index b0489865c..2f897b52d 100644 --- a/app/views/play/menu/GameMenuModal.coffee +++ b/app/views/play/menu/GameMenuModal.coffee @@ -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] diff --git a/app/views/play/menu/GuideView.coffee b/app/views/play/menu/GuideView.coffee index fcd794117..ce56fdfce 100644 --- a/app/views/play/menu/GuideView.coffee +++ b/app/views/play/menu/GuideView.coffee @@ -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