Update some copy to use db products

This commit is contained in:
Scott Erickson 2015-12-15 13:24:02 -08:00 committed by Rob
parent ef3f847932
commit 96e6920722
4 changed files with 36 additions and 6 deletions

View file

@ -438,11 +438,11 @@
parents_title: "Dear Parent: Your child is learning to code. Will you help them continue?"
parents_blurb1: "Your child has played __nLevels__ levels and learned programming basics. Help cultivate their interest and buy them a subscription so they can keep playing."
parents_blurb1a: "Computer programming is an essential skill that your child will undoubtedly use as an adult. By 2020, basic software skills will be needed by 77% of jobs, and software engineers are in high demand across the world. Did you know that Computer Science is the highest-paid university degree?"
parents_blurb2: "For $9.99 USD/mo, your child will get new challenges every week and personal email support from professional programmers."
parents_blurb2a: "For ${{price}} USD/mo, your child will get new challenges every week and personal email support from professional programmers."
parents_blurb3: "No Risk: 100% money back guarantee, easy 1-click unsubscribe."
payment_methods: "Payment Methods"
payment_methods_title: "Accepted Payment Methods"
payment_methods_blurb1: "We currently accept credit cards and Alipay. You can also PayPal 29.97 USD to nick@codecombat.com with your account email in the memo to purchase three months' subscription and gems, or $99 for a year."
payment_methods_blurb1a: "We currently accept credit cards and Alipay. You can also PayPal {{three_month_price}} USD to nick@codecombat.com with your account email in the memo to purchase three months' subscription and gems, or ${{year_price}} for a year."
payment_methods_blurb2: "If you require an alternate form of payment, please contact"
sale_already_subscribed: "You're already subscribed!"
sale_blurb1: "Save $21"
@ -1569,7 +1569,7 @@
email_settings_url: "your email settings"
email_description_suffix: "or through links in the emails we send, you can change your preferences and easily unsubscribe at any time."
cost_title: "Cost"
cost_description: "CodeCombat is free to play for all of its core levels, with a $9.99 USD/mo subscription for access to extra level branches and 3500 bonus gems per month. You can cancel with a click, and we offer a 100% money-back guarantee."
cost_description: "CodeCombat is free to play for all of its core levels, with a ${{price}} USD/mo subscription for access to extra level branches and {{gems}} bonus gems per month. You can cancel with a click, and we offer a 100% money-back guarantee."
copyrights_title: "Copyrights and Licenses"
contributor_title: "Contributor License Agreement"
contributor_description_prefix: "All contributions, both on the site and on our GitHub repository, are subject to our"

View file

@ -52,7 +52,7 @@ block content
if !me.isOnPremiumServer()
h4(data-i18n="legal.cost_title")
| Cost
p(data-i18n="legal.cost_description")
p#cost-description(data-i18n="legal.cost_description")
| CodeCombat is free to play for all of its core levels, with a $9.99 USD/mo subscription for access to extra level branches and 3500 bonus gems per month. You can cancel with a click, and we offer a 100% money-back guarantee.
h2(data-i18n="legal.copyrights_title")

View file

@ -1,6 +1,26 @@
RootView = require 'views/core/RootView'
template = require 'templates/legal'
Products = require 'collections/Products'
module.exports = class LegalView extends RootView
id: 'legal-view'
template: template
initialize: ->
@products = new Products()
@supermodel.loadCollection(@products, 'products')
onLoaded: ->
basicSub = @products.findWhere({name: 'basic_subscription'})
@price = (basicSub.get('amount') / 100).toFixed(2)
@gems = basicSub.get('gems')
super()
afterRender: ->
super()
# TODO: Figure out how to use i18n interpolation in this case
$el = @$('#cost-description')
f = =>
$el.text($el.text().replace('{{price}}', @price))
$el.text($el.text().replace('{{gems}}', @gems))
_.defer(f) # i18n call gets made immediately after render

View file

@ -56,11 +56,15 @@ module.exports = class SubscribeModal extends ModalView
application.tracker?.trackEvent 'Subscription ask parent button click'
setupParentInfoPopover: ->
return unless @products.size()
popoverTitle = $.i18n.t 'subscribe.parents_title'
levelsCompleted = me.get('stats')?.gamesCompleted or 'several'
popoverContent = "<p>" + $.i18n.t('subscribe.parents_blurb1', nLevels: levelsCompleted) + "</p>"
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb1a') + "</p>"
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb2') + "</p>"
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb2a') + "</p>"
price = (@products.findWhere({'name': 'basic_subscription'}).get('amount') / 100).toFixed(2)
# TODO: Update i18next and use its own interpolation system instead
popoverContent = popoverContent.replace('{{price}}', price)
popoverContent += "<p>" + $.i18n.t('subscribe.parents_blurb3') + "</p>"
#popoverContent = popoverContent.replace /9[.,]99/g, '3.99' # Sale
@$el.find('#parents-info').popover(
@ -75,9 +79,15 @@ module.exports = class SubscribeModal extends ModalView
application.tracker?.trackEvent 'Subscription parent hover'
setupPaymentMethodsInfoPopover: ->
return unless @products.size()
popoverTitle = $.i18n.t('subscribe.payment_methods_title')
three_month_price = (@products.findWhere({'name': 'basic_subscription'}).get('amount') * 3 / 100).toFixed(2)
year_price = (@products.findWhere({name: 'year_subscription'}).get('amount') / 100).toFixed(2)
popoverTitle += '<button type="button" class="close" onclick="$(&#39;#payment-methods-info&#39;).popover(&#39;hide&#39;);">&times;</button>'
popoverContent = "<p>" + $.i18n.t('subscribe.payment_methods_blurb1') + "</p>"
popoverContent = "<p>" + $.i18n.t('subscribe.payment_methods_blurb1a') + "</p>"
# TODO: Update i18next and use its own interpolation system instead
popoverContent = popoverContent.replace('{{three_month_price}}', three_month_price)
popoverContent = popoverContent.replace('{{year_price}}', year_price)
popoverContent += "<p>" + $.i18n.t('subscribe.payment_methods_blurb2') + " <a href='mailto:support@codecombat.com'>support@codecombat.com</a>."
@$el.find('#payment-methods-info').popover(
animation: true