mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-01 16:33:38 -04:00
Now showing SubscribeModal before AuthModal for players who need to sign up before subscribing.
This commit is contained in:
parent
e9ab0c1f4d
commit
175cdb5151
4 changed files with 11 additions and 14 deletions
app
models
views/play
|
@ -45,7 +45,7 @@ class CocoModel extends Backbone.Model
|
|||
@loading = false
|
||||
@jqxhr = null
|
||||
if jqxhr.status is 402
|
||||
Backbone.Mediator.publish 'level:subscription-required'
|
||||
Backbone.Mediator.publish 'level:subscription-required', {}
|
||||
|
||||
onLoaded: ->
|
||||
@loaded = true
|
||||
|
|
|
@ -208,9 +208,7 @@ module.exports = class WorldMapView extends RootView
|
|||
@endHighlight()
|
||||
else
|
||||
if level.requiresSubscription and @requiresSubscription and not @levelStatusMap[level.id] and not level.adventurer
|
||||
modal = if me.get('anonymous') then AuthModal else SubscribeModal
|
||||
@openModalView new modal()
|
||||
if modal is SubscribeModal
|
||||
@openModalView new SubscribeModal()
|
||||
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'map level clicked'
|
||||
window.tracker?.trackPageView "subscription/show-modal", ['Google Analytics']
|
||||
else if $(e.target).attr('disabled')
|
||||
|
|
|
@ -2,7 +2,6 @@ CocoView = require 'views/core/CocoView'
|
|||
template = require 'templates/play/level/level_loading'
|
||||
utils = require 'core/utils'
|
||||
SubscribeModal = require 'views/play/modal/SubscribeModal'
|
||||
AuthModal = require 'views/core/AuthModal'
|
||||
|
||||
module.exports = class LevelLoadingView extends CocoView
|
||||
id: 'level-loading-view'
|
||||
|
@ -110,9 +109,7 @@ module.exports = class LevelLoadingView extends CocoView
|
|||
@$el.find('.subscription-required').show()
|
||||
|
||||
onClickStartSubscription: (e) ->
|
||||
modal = if me.get('anonymous') then AuthModal else SubscribeModal
|
||||
@openModalView new modal()
|
||||
if modal is SubscribeModal
|
||||
@openModalView new SubscribeModal()
|
||||
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'level loading'
|
||||
window.tracker?.trackPageView "subscription/show-modal", ['Google Analytics']
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ ModalView = require 'views/core/ModalView'
|
|||
template = require 'templates/play/modal/subscribe-modal'
|
||||
stripeHandler = require 'core/services/stripe'
|
||||
utils = require 'core/utils'
|
||||
AuthModal = require 'views/core/AuthModal'
|
||||
|
||||
module.exports = class SubscribeModal extends ModalView
|
||||
id: 'subscribe-modal'
|
||||
|
@ -49,6 +50,7 @@ module.exports = class SubscribeModal extends ModalView
|
|||
|
||||
onClickPurchaseButton: (e) ->
|
||||
@playSound 'menu-button-click'
|
||||
return @openModalView new AuthModal() if me.get('anonymous')
|
||||
application.tracker?.trackEvent 'Started subscription purchase', {}
|
||||
application.tracker?.trackPageView "subscription/start-purchase", ['Google Analytics']
|
||||
stripeHandler.open({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue