Put video into its own guide tab, fix intro tabs
This commit is contained in:
parent
69379fb54f
commit
8fd47535d1
3 changed files with 31 additions and 8 deletions
app
|
@ -54,6 +54,10 @@
|
||||||
color: white
|
color: white
|
||||||
|
|
||||||
#guide-view
|
#guide-view
|
||||||
|
|
||||||
|
&.has-tabs
|
||||||
|
margin-top: -40px
|
||||||
|
|
||||||
pre.ace_editor
|
pre.ace_editor
|
||||||
padding: 2px 4px
|
padding: 2px 4px
|
||||||
border-radius: 4px
|
border-radius: 4px
|
||||||
|
@ -63,3 +67,7 @@
|
||||||
|
|
||||||
.ace_cursor, .ace_bracket
|
.ace_cursor, .ace_bracket
|
||||||
display: none
|
display: none
|
||||||
|
|
||||||
|
.tab-content
|
||||||
|
img
|
||||||
|
max-width: 100%
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
if docs.length === 1
|
if docs.length === 1
|
||||||
if showVideo
|
if showVideo
|
||||||
h3(id='help-video-heading', data-i18n="game_menu.guide_video_tutorial")
|
h3#help-video-heading(data-i18n="game_menu.guide_video_tutorial")
|
||||||
if videoLocked
|
if videoLocked
|
||||||
p(data-i18n="subscribe.unlock_help_videos") Subscribe to unlock all video tutorials.
|
p(data-i18n="subscribe.unlock_help_videos") Subscribe to unlock all video tutorials.
|
||||||
button.start-subscription-button.btn.btn-lg.btn-success(data-i18n="subscribe.subscribe_title") Subscribe
|
button.start-subscription-button.btn.btn-lg.btn-success(data-i18n="subscribe.subscribe_title") Subscribe
|
||||||
|
@ -12,9 +12,19 @@ if docs.length === 1
|
||||||
|
|
||||||
else
|
else
|
||||||
ul.nav.nav-tabs
|
ul.nav.nav-tabs
|
||||||
|
if showVideo
|
||||||
|
li
|
||||||
|
a(data-target="#docs_tab_help_video", data-toggle="tab", data-i18n="game_menu.guide_video_tutorial")
|
||||||
for doc in docs
|
for doc in docs
|
||||||
li
|
li
|
||||||
a(data-target="#docs_tab_#{doc.slug}", data-toggle="tab") #{doc.name}
|
a(data-target="#docs_tab_#{doc.slug}", data-toggle="tab") #{doc.name}
|
||||||
div.tab-content
|
div.tab-content
|
||||||
|
if showVideo
|
||||||
|
div.tab-pane(id="docs_tab_help_video")
|
||||||
|
if videoLocked
|
||||||
|
p(data-i18n="subscribe.unlock_help_videos") Subscribe to unlock all video tutorials.
|
||||||
|
button.start-subscription-button.btn.btn-lg.btn-success(data-i18n="subscribe.subscribe_title") Subscribe
|
||||||
|
else
|
||||||
|
div(id="help-video-player")
|
||||||
for doc in docs
|
for doc in docs
|
||||||
div.tab-pane(id="docs_tab_#{doc.slug}")!= doc.html
|
div.tab-pane(id="docs_tab_#{doc.slug}")!= doc.html
|
||||||
|
|
|
@ -23,7 +23,7 @@ module.exports = class LevelGuideView extends CocoView
|
||||||
# A/B Testing video tutorial styles
|
# A/B Testing video tutorial styles
|
||||||
@helpVideosIndex = me.getVideoTutorialStylesIndex(@helpVideos.length)
|
@helpVideosIndex = me.getVideoTutorialStylesIndex(@helpVideos.length)
|
||||||
@helpVideo = @helpVideos[@helpVideosIndex] if @helpVideos.length > 0
|
@helpVideo = @helpVideos[@helpVideosIndex] if @helpVideos.length > 0
|
||||||
@videoLocked = not (@helpVideo?.free or options.level.get('type', true) is 'course') and @requiresSubscription
|
@videoLocked = not (@helpVideo?.free or options.level.get('type', true) in ['course', 'course-ladder']) and @requiresSubscription
|
||||||
|
|
||||||
@firstOnly = options.firstOnly
|
@firstOnly = options.firstOnly
|
||||||
@docs = options?.docs ? options.level.get('documentation') ? {}
|
@docs = options?.docs ? options.level.get('documentation') ? {}
|
||||||
|
@ -40,8 +40,8 @@ module.exports = class LevelGuideView extends CocoView
|
||||||
@docs = $.extend(true, [], @docs)
|
@docs = $.extend(true, [], @docs)
|
||||||
@docs = [@docs[0]] if @firstOnly and @docs[0]
|
@docs = [@docs[0]] if @firstOnly and @docs[0]
|
||||||
doc.html = marked(utils.filterMarkdownCodeLanguages(utils.i18n(doc, 'body'))) for doc in @docs
|
doc.html = marked(utils.filterMarkdownCodeLanguages(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
|
doc.slug = _.string.slugify(doc.name) for doc in @docs
|
||||||
|
doc.name = (utils.i18n doc, 'name') for doc in @docs
|
||||||
super options
|
super options
|
||||||
|
|
||||||
destroy: ->
|
destroy: ->
|
||||||
|
@ -62,13 +62,18 @@ module.exports = class LevelGuideView extends CocoView
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
super()
|
super()
|
||||||
if @docs.length is 1 and @helpVideos.length > 0
|
@setupVideoPlayer() unless @videoLocked
|
||||||
@setupVideoPlayer() unless @videoLocked
|
if @docs.length + @helpVideos.length > 1
|
||||||
else
|
if @helpVideos.length
|
||||||
|
startingTab = 0
|
||||||
|
else
|
||||||
|
startingTab = _.findIndex @docs, slug: 'intro'
|
||||||
|
startingTab = 0 if startingTab is -1
|
||||||
# incredible hackiness. Getting bootstrap tabs to work shouldn't be this complex
|
# incredible hackiness. Getting bootstrap tabs to work shouldn't be this complex
|
||||||
@$el.find('.nav-tabs li:first').addClass('active')
|
@$el.find(".nav-tabs li:nth(#{startingTab})").addClass('active')
|
||||||
@$el.find('.tab-content .tab-pane:first').addClass('active')
|
@$el.find(".tab-content .tab-pane:nth(#{startingTab})").addClass('active')
|
||||||
@$el.find('.nav-tabs a').click(@clickTab)
|
@$el.find('.nav-tabs a').click(@clickTab)
|
||||||
|
@$el.addClass 'has-tabs'
|
||||||
@configureACEEditors()
|
@configureACEEditors()
|
||||||
@playSound 'guide-open'
|
@playSound 'guide-open'
|
||||||
|
|
||||||
|
|
Reference in a new issue