mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 05:53:39 -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,14 +45,14 @@ 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
|
||||
@loading = false
|
||||
@jqxhr = null
|
||||
@loadFromBackup()
|
||||
|
||||
|
||||
getCreationDate: -> new Date(parseInt(@id.slice(0,8), 16)*1000)
|
||||
|
||||
getNormalizedURL: -> "#{@urlRoot}/#{@id}"
|
||||
|
@ -351,7 +351,7 @@ class CocoModel extends Backbone.Model
|
|||
|
||||
CocoCollection = require 'collections/CocoCollection'
|
||||
Achievement = require 'models/Achievement'
|
||||
|
||||
|
||||
class NewAchievementCollection extends CocoCollection
|
||||
model: Achievement
|
||||
initialize: (me = require('core/auth').me) ->
|
||||
|
|
|
@ -208,11 +208,9 @@ 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
|
||||
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'map level clicked'
|
||||
window.tracker?.trackPageView "subscription/show-modal", ['Google Analytics']
|
||||
@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')
|
||||
Backbone.Mediator.publish 'router:navigate', route: '/contribute/adventurer'
|
||||
return
|
||||
|
|
|
@ -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,11 +109,9 @@ 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
|
||||
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'level loading'
|
||||
window.tracker?.trackPageView "subscription/show-modal", ['Google Analytics']
|
||||
@openModalView new SubscribeModal()
|
||||
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'level loading'
|
||||
window.tracker?.trackPageView "subscription/show-modal", ['Google Analytics']
|
||||
|
||||
onSubscribed: ->
|
||||
document.location.reload()
|
||||
|
|
|
@ -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