Skip to content

Commit

Permalink
Add amazon HOC modal after level 4 (#4756)
Browse files Browse the repository at this point in the history
* Add amazon HOC modal after level 4

* Localize continue button text + Add comments
  • Loading branch information
shubhi1092 committed Jun 25, 2018
1 parent efb1d2b commit f0c6830
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions app/templates/play/modal/amazon-hoc-modal.jade
Expand Up @@ -31,3 +31,6 @@
a#aws-future-eng-link(href="http://amazonfutureengineer.com/" data-i18n="amazon_hoc.future_eng_4" target="_blank")
=" "
span(data-i18n="amazon_hoc.future_eng_5")

if(view.options.showContinue)
button.btn.btn-illustrated.btn-success.btn-lg#continue-button(data-i18n="courses.continue_playing")
12 changes: 9 additions & 3 deletions app/views/play/level/modal/HeroVictoryModal.coffee
Expand Up @@ -212,10 +212,12 @@ module.exports = class HeroVictoryModal extends ModalView
when 'game-dev-hoc' then '57ee6f5786cf4e1f00afca2c' # game grove
when 'game-dev-hoc-2' then '57b71dce7a14ff35003a8f71' # palimpsest
else '541c9a30c6362edfb0f34479' # kithgard gates for dungeon
amazonLastLevel = @level.get('original') is '541875da4c16460000ab990f' # true names - for amazon kids-to-work-day
lastLevel = @level.get('original') is lastLevelOriginal
enough = elapsed >= 20 * 60 * 1000 or lastLevel
tooMuch = elapsed > 120 * 60 * 1000
showDone = (elapsed >= 30 * 60 * 1000 and not tooMuch) or lastLevel
#showDone = (elapsed >= 30 * 60 * 1000 and not tooMuch) or lastLevel # TODO: revert to this after amazon kids-to-work-day
showDone = (elapsed >= 30 * 60 * 1000 and not tooMuch) or lastLevel or amazonLastLevel
if enough and not tooMuch and not me.get('hourOfCodeComplete')
pixelCode = switch gameDevHoc
when 'game-dev-hoc' then 'code_combat_gamedev'
Expand All @@ -227,7 +229,8 @@ module.exports = class HeroVictoryModal extends ModalView
window.tracker?.trackEvent 'Hour of Code Finish'
# Show the "I'm done" button between 30 - 120 minutes if they definitely came from Hour of Code
c.showHourOfCodeDoneButton = showDone
@showAmazonHocButton = (gameDevHoc is 'game-dev-hoc') and lastLevel
# @showAmazonHocButton = (gameDevHoc is 'game-dev-hoc') and lastLevel # TODO: revert to this after amazon kids-to-work-day
@showAmazonHocButton = (gameDevHoc is 'game-dev-hoc') and ( lastLevel or amazonLastLevel )
if @showAmazonHocButton
@trackAwsButtonShown()
@showHoc2016ExploreButton = gameDevHoc and lastLevel
Expand Down Expand Up @@ -538,7 +541,10 @@ module.exports = class HeroVictoryModal extends ModalView

onClickAmazonHocButton: ->
window.tracker?.trackEvent 'Click Amazon Modal Button'
@openModalView new AmazonHocModal()
if @level.get('original') is '541875da4c16460000ab990f' # true names - for amazon kids-to-work-day
@openModalView new AmazonHocModal showContinue:true
else
@openModalView new AmazonHocModal()

onSubscribeButtonClicked: ->
@openModalView new SubscribeModal()
Expand Down
8 changes: 8 additions & 0 deletions app/views/play/modal/AmazonHocModal.coffee
Expand Up @@ -11,6 +11,7 @@ module.exports = class AmazonHocModal extends ModalView
'mouseup #aws-educate-link': 'onClickAwsEducateLink' # mouseup detects middle click as well
'mouseup #aws-alexa-link': 'onClickAwsAlexaLink'
'mouseup #aws-future-eng-link': 'onClickAwsFutureEngLink'
'click #continue-button': 'onClickContinue'

onClickAwsEducateLink: ->
window.tracker?.trackEvent 'Click Amazon link', label: 'aws-educate-link'
Expand All @@ -20,3 +21,10 @@ module.exports = class AmazonHocModal extends ModalView

onClickAwsFutureEngLink: ->
window.tracker?.trackEvent 'Click Amazon link', label: 'aws-future-eng-link'

onClickContinue: ->
navigateOptions =
trigger: true
replace: true
navigationEvent = route: '/play/game-dev-hoc?hour_of_code=true', viewArgs: [navigateOptions]
Backbone.Mediator.publish 'router:navigate', navigationEvent

0 comments on commit f0c6830

Please sign in to comment.