Hooked up Viking Code School offer for players who beat Lost Viking.

This commit is contained in:
Nick Winter 2015-04-07 11:19:22 -07:00
parent 50adb7b982
commit b388d25435
4 changed files with 32 additions and 3 deletions
app
locale
styles/play/level/modal
templates/play/level/modal
views/play/level/modal

View file

@ -263,6 +263,7 @@
victory_hour_of_code_done_yes: "Yes, I'm finished with my Hour of Code™!"
victory_experience_gained: "XP Gained"
victory_gems_gained: "Gems Gained"
victory_become_a_viking: "Become a Viking"
guide_title: "Guide"
tome_minion_spells: "Your Minions' Spells" # Only in old-style levels.
tome_read_only_spells: "Read-Only Spells" # Only in old-style levels.

View file

@ -369,6 +369,11 @@
.text-link
color: lighten(#0b63bc, 10%)
.offer
display: none
p
color: white
html.no-borderimage
#hero-victory-modal

View file

@ -89,5 +89,12 @@ block modal-footer-content
img(src="/images/level/csedweek-logo-final-small.jpg", alt="CS Ed Week Hour of Code", title="I'm finished with my Hour of Code", width=80)
strong(data-i18n="play_level.victory_hour_of_code_done") Are You Done?
a.text-link(href="http://code.org/api/hour/finish")
span(data-i18n="play_level.victory_hour_of_code_done_yes") Yes, I'm finished with my Hour of Code!
.clearfix
span(data-i18n="play_level.victory_hour_of_code_done_yes") Yes, I am finished with my Hour of Code!
.clearfix
.offer.lost-viking
p
img.pull-left(src="/file/db/level/55144b509f0c4854051769c1/viking1.png")
img.pull-right(src="/file/db/level/55144b509f0c4854051769c1/viking_2.png")
| Holy smokes, that was a hard level you just beat! If you aren't already a software developer, you should be. You've just skipped past the first application step and straight to an interview with Viking Code School, where you can take your skills to the next level and become a professional web developer in 14 weeks.
button.btn.btn-illustrated.btn-primary.btn-lg.world-map-button.continue-from-offer-button(data-i18n="play_level.victory_become_a_viking") Become a Viking

View file

@ -26,6 +26,7 @@ module.exports = class HeroVictoryModal extends ModalView
'click .leaderboard-button': 'onClickLeaderboard'
'click .return-to-ladder-button': 'onClickReturnToLadder'
'click .sign-up-button': 'onClickSignupButton'
'click .continue-from-offer-button': 'onClickContinueFromOffer'
constructor: (options) ->
super(options)
@ -339,7 +340,11 @@ module.exports = class HeroVictoryModal extends ModalView
justBeatLevel: @level
supermodel: if @options.hasReceivedMemoryWarning then null else @supermodel
_.merge options, extraOptions if extraOptions
Backbone.Mediator.publish 'router:navigate', route: nextLevelLink, viewClass: require('views/play/CampaignView'), viewArgs: [options, @getNextLevelCampaign()]
navigationEvent = route: nextLevelLink, viewClass: require('views/play/CampaignView'), viewArgs: [options, @getNextLevelCampaign()]
if @level.get('slug') is 'lost-viking' and not (me.get('age') in ['0-13', '14-17'])
@showOffer navigationEvent
else
Backbone.Mediator.publish 'router:navigate', navigationEvent
onClickLeaderboard: (e) ->
@onClickContinue e, showLeaderboard: true
@ -355,3 +360,14 @@ module.exports = class HeroVictoryModal extends ModalView
e.preventDefault()
window.tracker?.trackEvent 'Started Signup', category: 'Play Level', label: 'Hero Victory Modal', level: @level.get('slug')
@openModalView new AuthModal {mode: 'signup'}
showOffer: (@navigationEventUponCompletion) ->
@$el.find('.modal-footer > *').hide()
@$el.find(".modal-footer > .offer.#{@level.get('slug')}").show()
onClickContinueFromOffer: (e) ->
url = {
'lost-viking': 'http://www.vikingcodeschool.com/?utm_source=codecombat&utm_medium=lost_viking&utm_campaign=affiliate&ref=Code+Combat'
}[@level.get('slug')]
Backbone.Mediator.publish 'router:navigate', @navigationEventUponCompletion
window.open url, '_blank' if url