mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-27 06:23:41 -04:00
Remove SubscriptionSaleView
This commit is contained in:
parent
a28e7bde2c
commit
ef3f847932
4 changed files with 0 additions and 199 deletions
app
core
styles/account
templates/account
views/account
|
@ -24,7 +24,6 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
'account/profile': go('EmployersView') # Show the not-recruiting-now screen
|
||||
'account/payments': go('account/PaymentsView')
|
||||
'account/subscription': go('account/SubscriptionView')
|
||||
'account/subscription/sale': go('account/SubscriptionSaleView')
|
||||
'account/invoices': go('account/InvoicesView')
|
||||
'account/prepaid': go('account/PrepaidView')
|
||||
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
#subscription-sale-view
|
||||
.above-blurb
|
||||
margin: 0 16% 0 16%
|
||||
.center
|
||||
text-align: center
|
||||
.feature-description
|
||||
font-size: 16px
|
||||
.sale-blurb
|
||||
font-size: 22px
|
||||
.sale-ends
|
||||
position: relative
|
||||
left: 0px
|
||||
top: 50px
|
||||
font-size: 18px
|
||||
line-height: 18px
|
||||
background-color: red
|
||||
color: white
|
||||
margin: 0 7px
|
||||
border-radius: 3px
|
||||
padding: 6px
|
||||
width: 200px
|
||||
text-align: center
|
||||
-ms-transform: rotate(330deg) /* IE 9 */
|
||||
-moz-transform: rotate(330deg) /* Firefox */
|
||||
-webkit-transform: rotate(330deg) /* Safari and Chrome */
|
||||
-o-transform: rotate(330deg) /* Opera */
|
||||
.sub-extended
|
||||
font-size: 12px
|
||||
#pay-button
|
||||
font-size: 18px
|
|
@ -1,76 +0,0 @@
|
|||
extends /templates/base
|
||||
|
||||
block content
|
||||
|
||||
ol.breadcrumb
|
||||
li
|
||||
a(href="/")
|
||||
span.glyphicon.glyphicon-home
|
||||
li
|
||||
a(href="/account", data-i18n="nav.account")
|
||||
li
|
||||
a(href="/account/subscription", data-i18n="account.subscription")
|
||||
li.active(data-i18n="account.sale") Sale
|
||||
|
||||
if hasSubscription
|
||||
h1(data-i18n="subscribe.sale_already_subscribed")
|
||||
span.spr(data-i18n="subscribe.sale_continue")
|
||||
a(href="/play", data-i18n="subscribe.sale_click_here")
|
||||
else
|
||||
if state === 'purchasing'
|
||||
.alert.alert-info(data-i18n="account_invoices.purchasing")
|
||||
else
|
||||
if view.onSale
|
||||
div.sale-ends
|
||||
if new Date() < saleEndDate
|
||||
span.spr(data-i18n="subscribe.sale_ends")
|
||||
span #{moment(saleEndDate).fromNow()}
|
||||
else
|
||||
span(data-i18n="subscribe.sale_limited_time")
|
||||
if view.onSale
|
||||
h1.center(data-i18n="subscribe.sale_title")
|
||||
p.center
|
||||
img(src="/images/pages/account/subscription/teacher-banner.png")
|
||||
br
|
||||
.above-blurb
|
||||
p.sale-blurb
|
||||
strong.spr(data-i18n="subscribe.sale_blurb1")
|
||||
span(data-i18n="subscribe.sale_blurb2")
|
||||
br
|
||||
div
|
||||
.sale-blurb(data-i18n="subscribe.sale_feature_here")
|
||||
ul
|
||||
li.feature-description(data-i18n="[html]subscribe.sale_feature2")
|
||||
li.feature-description(data-i18n="subscribe.feature3")
|
||||
li.feature-description(data-i18n="[html]subscribe.sale_feature4")
|
||||
li.feature-description(data-i18n="subscribe.feature5")
|
||||
li.feature-description(data-i18n="[html]subscribe.feature7")
|
||||
div.sub-extended(data-i18n="subscribe.sale_extended")
|
||||
br
|
||||
p.center
|
||||
button.btn.btn-success#pay-button #{payButtonText}
|
||||
table.above-blurb(cellpadding="8")
|
||||
tr
|
||||
td(colspan=2)
|
||||
h2.center(data-i18n="subscribe.sale_new_heroes")
|
||||
each hero in heroes
|
||||
if hero.get('extendedName') !== 'Captain Anya Weston' && hero.get('extendedName') !== 'Sir Tharin Thunderfist'
|
||||
tr
|
||||
td
|
||||
img(src="http://codecombat.com#{hero.getPortraitURL()}")
|
||||
td
|
||||
p.sale-blurb #{hero.name}
|
||||
p #{hero.class}
|
||||
p #{hero.description}
|
||||
br
|
||||
if state === 'declined'
|
||||
#declined-alert.alert.alert-danger.alert-dismissible
|
||||
span(data-i18n="account_invoices.declined")
|
||||
button.close(type="button" data-dismiss="alert")
|
||||
span(aria-hidden="true") ×
|
||||
if state === 'unknown_error'
|
||||
#error-alert.alert.alert-danger.alert-dismissible
|
||||
button.close(type="button" data-dismiss="alert")
|
||||
span(aria-hidden="true") ×
|
||||
p(data-i18n="loading_error.unknown")
|
||||
p= stateMessage
|
|
@ -1,92 +0,0 @@
|
|||
RootView = require 'views/core/RootView'
|
||||
template = require 'templates/account/subscription-sale-view'
|
||||
app = require 'core/application'
|
||||
AuthModal = require 'views/core/AuthModal'
|
||||
CocoCollection = require 'collections/CocoCollection'
|
||||
stripeHandler = require 'core/services/stripe'
|
||||
ThangType = require 'models/ThangType'
|
||||
utils = require 'core/utils'
|
||||
|
||||
module.exports = class SubscriptionSaleView extends RootView
|
||||
id: "subscription-sale-view"
|
||||
template: template
|
||||
yearSaleAmount: 9900
|
||||
saleEndDate: new Date('2015-09-05')
|
||||
onSale: false
|
||||
|
||||
events:
|
||||
'click #pay-button': 'onPayButton'
|
||||
|
||||
subscriptions:
|
||||
'stripe:received-token': 'onStripeReceivedToken'
|
||||
|
||||
constructor: (options) ->
|
||||
super(options)
|
||||
@description = $.i18n.t('subscribe.stripe_description_year_sale')
|
||||
displayAmount = (@yearSaleAmount / 100).toFixed(2)
|
||||
@payButtonText = "#{$.i18n.t('subscribe.sale_view_button')} $#{displayAmount}"
|
||||
@heroes = new CocoCollection([], {model: ThangType})
|
||||
@heroes.url = '/db/thang.type?view=heroes'
|
||||
@heroes.setProjection ['original','name','heroClass','description', 'gems','extendedName','i18n']
|
||||
@heroes.comparator = 'gems'
|
||||
@listenToOnce @heroes, 'sync', @onHeroesLoaded
|
||||
@supermodel.loadCollection(@heroes, 'heroes')
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.hasSubscription = me.get('stripe')?.sponsorID
|
||||
c.heroes = @heroes.models
|
||||
c.payButtonText = @payButtonText
|
||||
c.saleEndDate = @saleEndDate
|
||||
c.state = @state
|
||||
c.stateMessage = @stateMessage
|
||||
c
|
||||
|
||||
onHeroesLoaded: ->
|
||||
@formatHero hero for hero in @heroes.models
|
||||
|
||||
formatHero: (hero) ->
|
||||
hero.name = utils.i18n hero.attributes, 'extendedName'
|
||||
hero.name ?= utils.i18n hero.attributes, 'name'
|
||||
hero.description = utils.i18n hero.attributes, 'description'
|
||||
hero.class = hero.get('heroClass') or 'Warrior'
|
||||
|
||||
onPayButton: ->
|
||||
return @openModalView new AuthModal() if me.isAnonymous()
|
||||
@state = undefined
|
||||
@stateMessage = undefined
|
||||
@render()
|
||||
|
||||
# Show Stripe handler
|
||||
application.tracker?.trackEvent 'Started sale landing page subscription purchase'
|
||||
@timestampForPurchase = new Date().getTime()
|
||||
stripeHandler.open
|
||||
amount: @yearSaleAmount
|
||||
description: @description
|
||||
bitcoin: true
|
||||
alipay: if me.get('country') is 'china' or (me.get('preferredLanguage') or 'en-US')[...2] is 'zh' then true else 'auto'
|
||||
|
||||
onStripeReceivedToken: (e) ->
|
||||
@state = 'purchasing'
|
||||
@render?()
|
||||
|
||||
# Call year sale API
|
||||
data =
|
||||
stripe:
|
||||
token: e.token.id
|
||||
timestamp: @timestampForPurchase
|
||||
jqxhr = $.post('/db/subscription/-/year_sale', data)
|
||||
jqxhr.done (data, textStatus, jqXHR) =>
|
||||
application.tracker?.trackEvent 'Finished sale landing page subscription purchase', value: @yearSaleAmount
|
||||
me.fetch(cache: false).always =>
|
||||
app.router.navigate '/play', trigger: true
|
||||
jqxhr.fail (xhr, textStatus, errorThrown) =>
|
||||
console.error 'We got an error subscribing with Stripe from our server:', textStatus, errorThrown
|
||||
application.tracker?.trackEvent 'Failed to finish 1 year subscription purchase', status: textStatus
|
||||
if xhr.status is 402
|
||||
@state = 'declined'
|
||||
@stateMessage = arguments[2]
|
||||
else
|
||||
@state = 'unknown_error'
|
||||
@stateMessage = "#{xhr.status}: #{xhr.responseText}"
|
||||
@render?()
|
Loading…
Add table
Add a link
Reference in a new issue