codecombat/app/views/LegalView.coffee

21 lines
660 B
CoffeeScript
Raw Normal View History

RootView = require 'views/core/RootView'
2014-01-03 10:32:13 -08:00
template = require 'templates/legal'
2015-12-15 13:24:02 -08:00
Products = require 'collections/Products'
2014-01-03 10:32:13 -08:00
module.exports = class LegalView extends RootView
2014-07-01 10:16:26 +08:00
id: 'legal-view'
2014-01-03 10:32:13 -08:00
template: template
2015-12-23 10:07:32 -08:00
2015-12-15 13:24:02 -08:00
initialize: ->
@products = new Products()
@supermodel.loadCollection(@products, 'products')
2015-12-23 10:07:32 -08:00
2015-12-15 13:24:02 -08:00
afterRender: ->
super()
2015-12-16 10:34:49 -08:00
basicSub = @products.findWhere({name: 'basic_subscription'})
return unless basicSub
2015-12-23 10:07:32 -08:00
text = $.i18n.t('legal.cost_description')
2015-12-16 10:34:49 -08:00
text = text.replace('{{price}}', (basicSub.get('amount') / 100).toFixed(2))
text = text.replace('{{gems}}', basicSub.get('gems'))
@$('#cost-description').text(text)