Add show subscribe modal events

This commit is contained in:
Matt Lott 2014-12-04 14:23:43 -08:00
parent bae90024b5
commit 4ff6e95f62
3 changed files with 10 additions and 1 deletions

View file

@ -29,6 +29,7 @@ module.exports = class PaymentsView extends RootView
onClickStartSubscription: (e) ->
@openModalView new SubscribeModal()
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'payments view'
onSubscribed: ->
document.location.reload()

View file

@ -120,7 +120,11 @@ module.exports = class WorldMapView extends RootView
@preloadTopHeroes() unless me.get('heroConfig')?.thangType
if @requiresSubscription
modal = if me.get('anonymous') then AuthModal else SubscribeModal
_.delay (=> @openModalView? new modal() unless window.currentModal), 2000
_.delay =>
@openModalView? new modal() unless window.currentModal
if modal is SubscribeModal
window.tracker?.trackEvent 'Show subscription modal', category: 'Subscription', label: 'world map loadded'
, 2000
onSubscribed: ->
@requiresSubscription = false
@ -208,6 +212,8 @@ module.exports = class WorldMapView extends RootView
if @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'
else if $(e.target).attr('disabled')
Backbone.Mediator.publish 'router:navigate', route: '/contribute/adventurer'
return

View file

@ -112,6 +112,8 @@ module.exports = class LevelLoadingView extends CocoView
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'
onSubscribed: ->
document.location.reload()