codecombat/app/views/LegalView.coffee

21 lines
660 B
CoffeeScript
Raw Normal View History

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