LevelLoadingView now handling when a subscription is required (although it can't be, yet, since LevelLoader doesn't tell it).

This commit is contained in:
Nick Winter 2014-12-03 12:04:12 -08:00
parent 50ec896fd8
commit 6e57cbfb66
5 changed files with 33 additions and 2 deletions

View file

@ -98,7 +98,7 @@ module.exports = class LevelLoader extends CocoClass
if e.id is modulePath
@languageModuleResource.markLoaded()
@stopListening application.moduleLoader
# hero-ladder games require the correct session team in level:loaded
team = @team ? @session.get('team')
Backbone.Mediator.publish 'level:loaded', level: @level, team: team

View file

@ -349,6 +349,7 @@
parents_blurb3: "No Risk: 100% money back guarantee, easy 1-click unsubscribe."
subscribe_button: "Subscribe Now"
stripe_description: "Monthly Subscription"
subscription_required_to_play: "You'll need a subscription to play this level."
choose_hero:
choose_hero: "Choose Your Hero"

View file

@ -92,6 +92,18 @@
font-size: 40px
font-variant: small-caps
.subscription-required
display: none
margin-top: -160px
color: black
font-size: 24px
.start-subscription-button
width: 100%
margin: 0px auto
font-size: 40px
font-variant: small-caps
#tip-wrapper
position: absolute
z-index: 2

View file

@ -11,13 +11,17 @@
.errors
.progress-or-start-container
button.start-level-button.btn.btn-lg.btn-success.header-fontneedsclick(data-i18n="play_level.loading_start") Start Level
button.start-level-button.btn.btn-lg.btn-success.header-font.needsclick(data-i18n="play_level.loading_start") Start Level
.load-progress
.progress
.progress-bar.progress-bar-success
.rim
.subscription-required
span(data-i18n="subscribe.subscription_required_to_play") You'll need a subscription to play this level.
button.start-subscription-button.btn.btn-lg.btn-warning(data-i18n="subscribe.subscribe") Subscribe
#tip-wrapper
strong.tip(data-i18n='play_level.tip_toggle_play') Toggle play/paused with Ctrl+P.
strong.tip(data-i18n='play_level.tip_scrub_shortcut') Ctrl+[ and Ctrl+] rewind and fast-forward.

View file

@ -1,6 +1,7 @@
CocoView = require 'views/core/CocoView'
template = require 'templates/play/level/level_loading'
utils = require 'core/utils'
SubscribeModal = require 'views/play/modal/SubscribeModal'
module.exports = class LevelLoadingView extends CocoView
id: 'level-loading-view'
@ -9,9 +10,12 @@ module.exports = class LevelLoadingView extends CocoView
events:
'mousedown .start-level-button': 'startUnveiling' # Split into two for animation smoothness.
'click .start-level-button': 'onClickStartLevel'
'click .start-subscription-button': 'onClickStartSubscription'
subscriptions:
'level:loaded': 'onLevelLoaded' # If Level loads after level loading view.
'level:subscription-required': 'onSubscriptionRequired' # If they'd need a subscription to start playing.
'subscribe-modal:subscribed': 'onSubscribed'
shortcuts:
'enter': 'onEnterPressed'
@ -99,3 +103,13 @@ module.exports = class LevelLoadingView extends CocoView
onUnveilEnded: =>
return if @destroyed
Backbone.Mediator.publish 'level:loading-view-unveiled', view: @
onSubscriptionRequired: (e) ->
@$el.find('.level-loading-goals, .tip, .load-progress').hide()
@$el.find('.subscription-required').show()
onClickStartSubscription: (e) ->
@openModalView new SubscribeModal()
onSubscribed: ->
document.location.reload()