From aa9a27bf0d3090f10915f7214312422b046d36c1 Mon Sep 17 00:00:00 2001 From: Shubhangi Date: Tue, 19 Jun 2018 13:42:17 -0700 Subject: [PATCH] Add amazon HOC modal after level 4 --- app/templates/play/modal/amazon-hoc-modal.jade | 3 +++ app/views/play/level/modal/HeroVictoryModal.coffee | 12 +++++++++--- app/views/play/modal/AmazonHocModal.coffee | 8 ++++++++ 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/app/templates/play/modal/amazon-hoc-modal.jade b/app/templates/play/modal/amazon-hoc-modal.jade index e1f0e26b5d2..866dd550d80 100644 --- a/app/templates/play/modal/amazon-hoc-modal.jade +++ b/app/templates/play/modal/amazon-hoc-modal.jade @@ -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 Continue Playing \ No newline at end of file diff --git a/app/views/play/level/modal/HeroVictoryModal.coffee b/app/views/play/level/modal/HeroVictoryModal.coffee index 471f22c3af0..c1392553e19 100644 --- a/app/views/play/level/modal/HeroVictoryModal.coffee +++ b/app/views/play/level/modal/HeroVictoryModal.coffee @@ -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 + 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' @@ -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 + @showAmazonHocButton = (gameDevHoc is 'game-dev-hoc') and ( lastLevel or amazonLastLevel ) if @showAmazonHocButton @trackAwsButtonShown() @showHoc2016ExploreButton = gameDevHoc and lastLevel @@ -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() diff --git a/app/views/play/modal/AmazonHocModal.coffee b/app/views/play/modal/AmazonHocModal.coffee index 15f68b86dc0..7eca75a94df 100644 --- a/app/views/play/modal/AmazonHocModal.coffee +++ b/app/views/play/modal/AmazonHocModal.coffee @@ -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' @@ -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