Added extra lesson resource links to the Guide.

This commit is contained in:
Nick Winter 2015-03-05 08:58:11 -08:00
parent cbbdd4f3ab
commit 10f2df3480
3 changed files with 35 additions and 10 deletions
app
templates/play/menu
views/play/menu

View file

@ -9,6 +9,23 @@ if docs.length === 1
h3(data-i18n="game_menu.guide_tips")
div
!= docs[0].html
if (me.get('preferredLanguage') || 'en-US').substr(0, 2) == 'en'
hr
h3 Want more programming lessons?
ul
li
strong
a(class="resource-link", data-resource="one-month", href='http://mbsy.co/bVRtZ') One Month
| : Learn any tech skill in 30 days with just 15 minutes a day.
li
strong
a(class="resource-link", data-resource="code-school", href='http://mbsy.co/bVRsR') Code School
| : Learn web technologies with video lessons, coding challenges, and screencasts. Get your first month for only $9 ($20 off).
li
strong
a(class="resource-link", data-resource="treehouse", href='http://teamtreehouse.com/') Treehouse
| : Learn HTML, CSS, iPhone apps, and more with a comprehensive video library.
else
ul.nav.nav-tabs
for doc in docs

View file

@ -31,10 +31,11 @@ module.exports = class GameMenuModal extends ModalView
getRenderData: (context={}) ->
context = super(context)
docs = @options.level.get('documentation') ? {}
submenus = ["options", "save-load", "guide", "multiplayer"]
submenus = ['guide', 'options', 'save-load', 'multiplayer']
submenus = _.without submenus, 'guide' unless docs.specificArticles?.length or docs.generalArticles?.length
submenus = _.without submenus, 'save-load' unless me.isAdmin() or /https?:\/\/localhost/.test(window.location.href)
submenus = _.without submenus, 'multiplayer' unless me.isAdmin() or @level?.get('type') in ['ladder', 'hero-ladder']
@includedSubmenus = submenus
context.showTab = @options.showTab ? submenus[0]
context.submenus = submenus
context.iconMap =
@ -47,12 +48,11 @@ module.exports = class GameMenuModal extends ModalView
afterRender: ->
super()
@insertSubView new submenuView @options for submenuView in submenuViews
if @options.showTab
firstView = switch @options.showTab
when 'multiplayer' then @subviews.multiplayer_view
when 'guide' then @subviews.guide_view
unless firstView?
firstView = (@subviews.options_view)
firstView = switch @options.showTab
when 'multiplayer' then @subviews.multiplayer_view
when 'guide' then @subviews.guide_view
else
if 'guide' in @includedSubmenus then @subviews.guide_view else @subviews.options_view
firstView.$el.addClass 'active'
firstView.onShown?()
@playSound 'game-menu-open'
@ -69,7 +69,7 @@ module.exports = class GameMenuModal extends ModalView
subview.onHidden?() for subviewKey, subview of @subviews
@playSound 'game-menu-close'
Backbone.Mediator.publish 'music-player:exit-menu', {}
onClickSignupButton: (e) ->
window.tracker?.trackEvent 'Started Signup', category: 'Play Level', label: 'Game Menu', level: @options.levelID
# TODO: Default already seems to be prevented. Need to be explicit?

View file

@ -14,7 +14,8 @@ module.exports = class LevelGuideView extends CocoView
helpVideoWidth: '471'
events:
'click .start-subscription-button': "clickSubscribe"
'click .start-subscription-button': 'clickSubscribe'
'click .resource-link': 'clickResourceLink'
constructor: (options) ->
@levelSlug = options.level.get('slug')
@ -72,11 +73,18 @@ module.exports = class LevelGuideView extends CocoView
@$el.find('.nav-tabs a').click(@clickTab)
@playSound 'guide-open'
clickSubscribe: (e) =>
clickSubscribe: (e) ->
level = @levelSlug # Save ref to level slug
@openModalView new SubscribeModal()
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'help video clicked', level: level
clickResourceLink: (e) ->
e.preventDefault()
resource = $(e.target).data 'resource'
url = $(e.target).attr 'href'
window.tracker?.trackEvent 'Click resource', category: 'Resources', source: 'guide', level: @levelSlug, resource: resource
window.open url, '_blank'
clickTab: (e) =>
@$el.find('li.active').removeClass('active')
@playSound 'guide-tab-switch'