Fixed bug with subscriptions not working. Added subscription status text to the world map.

This commit is contained in:
Nick Winter 2014-12-03 11:19:10 -08:00
parent 898b22723e
commit 0ac9b3758b
7 changed files with 45 additions and 6 deletions

View file

@ -69,6 +69,11 @@
change_hero: "Change Hero" # Go back from choose inventory to choose hero
choose_inventory: "Equip Items"
buy_gems: "Buy Gems"
campaign_forest: "Forest Campaign"
campaign_dungeon: "Dungeon Campaign"
subscription_required: "Subscription Required"
free: "Free"
subscribed: "Subscribed"
older_campaigns: "Older Campaigns"
anonymous: "Anonymous Player"
level_difficulty: "Difficulty: "
@ -90,8 +95,6 @@
campaign_player_created_description: "... in which you battle against the creativity of your fellow <a href=\"/contribute#artisan\">Artisan Wizards</a>."
campaign_classic_algorithms: "Classic Algorithms"
campaign_classic_algorithms_description: "... in which you learn the most popular algorithms in Computer Science."
campaign_forest: "Forest Campaign"
campaign_dungeon: "Dungeon Campaign"
login:
sign_up: "Create Account"

View file

@ -466,7 +466,7 @@ module.exports = nativeDescription: "español (América Latina)", englishDescrip
new_password: "Nueva Contraseña"
new_password_verify: "Verificar"
email_subscriptions: "Suscripciones de Email"
email_subscriptions_none: "No tienes subcripciones."
email_subscriptions_none: "No tienes suscripciones."
email_announcements: "Noticias"
email_announcements_description: "Recibe correos electrónicos con las últimas noticias y desarrollos de CodeCombat."
email_notifications: "Notificaciones"

View file

@ -56,6 +56,8 @@ module.exports =
'buy-gems-modal:purchase-initiated': c.object {required: ['productID']},
productID: { type: 'string' }
'subscribe-modal:subscribed': c.object {}
'stripe:received-token': c.object { required: ['token'] },
token: { type: 'object', properties: {
id: {type: 'string'}

View file

@ -240,8 +240,8 @@ $gameControlMargin: 30px
transform: rotate(-35deg)
&#dungeon-link
left: 26.6%
top: 43%
left: 13.01%
top: 58%
transform: rotate(180deg)
.game-controls
@ -332,6 +332,18 @@ $gameControlMargin: 30px
&.vol-down .glyphicon.glyphicon-volume-down
display: inline-block
#campaign-status
position: absolute
left: 0
top: 15px
width: 100%
margin: 0
text-align: center
color: rgb(254,188,68)
font-size: 30px
text-shadow: black 2px 2px 0, black -2px -2px 0, black 2px -2px 0, black -2px 2px 0, black 2px 0px 0, black 0px -2px 0, black -2px 0px 0, black 0px 2px 0
body:not(.ipad) #world-map-view
.level-info-container
pointer-events: none

View file

@ -62,7 +62,7 @@
span.spl.spr(data-i18n="general.player_level")
span.spr= me.level()
if me.get('anonymous')
span.spr(data-i18n="play.anonymous_player") Anonymous Player
span.spr(data-i18n="play.anonymous") Anonymous Player
button.btn.btn-default.btn-flat.btn-sm(data-toggle='coco-modal', data-target='core/AuthModal', data-i18n="login.log_in")
else
span.spr= me.get('name')
@ -72,3 +72,16 @@ button.btn.btn-lg.btn-inverse#volume-button(title="Adjust volume")
.glyphicon.glyphicon-volume-off
.glyphicon.glyphicon-volume-down
.glyphicon.glyphicon-volume-up
h1#campaign-status
if mapType == 'dungeon'
span.spr(data-i18n="play.campaign_dungeon")
else if mapType == 'forest'
span.spr(data-i18n="play.campaign_forest")
| -
if requiresSubscription
span.spl(data-i18n="play.subscription_required")
else if mapType == 'dungeon'
span.spl(data-i18n="play.free")
else
span.spl(data-i18n="play.subscribed")

View file

@ -25,6 +25,9 @@ module.exports = class WorldMapView extends RootView
id: 'world-map-view'
template: template
subscriptions:
'subscribe-modal:subscribed': 'onSubscribed'
events:
'click .map-background': 'onClickMap'
'click .level a': 'onClickLevel'
@ -118,6 +121,10 @@ module.exports = class WorldMapView extends RootView
if @requiresSubscription
_.delay (=> @openModalView? new SubscribeModal() unless window.currentModal), 2000
onSubscribed: ->
@requiresSubscription = false
@render()
getRenderData: (context={}) ->
context = super(context)
context.campaign = _.find campaigns, { id: @terrain }
@ -140,6 +147,7 @@ module.exports = class WorldMapView extends RootView
context.mapType = _.string.slugify @terrain
context.nextLevel = @nextLevel
context.forestIsAvailable = @startedForestLevel or '541b67f71ccc8eaae19f3c62' in (me.get('earned')?.levels or [])
context.requiresSubscription = @requiresSubscription
context
afterRender: ->

View file

@ -69,6 +69,7 @@ module.exports = class SubscribeModal extends ModalView
onSubscriptionSuccess: ->
application.tracker?.trackEvent 'Finished subscription purchase', {}
Backbone.Mediator.publish 'subscribe-modal:subscribed', {}
@playSound 'victory'
@hide()