2014-11-28 20:49:41 -05:00
|
|
|
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
|
|
|
|
2014-07-17 20:16:32 -04: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-15 16:24:02 -05:00
|
|
|
|
|
|
|
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
|