mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Added a simple payments page.
This commit is contained in:
parent
b27ac94382
commit
426202d80a
5 changed files with 60 additions and 1 deletions
|
@ -24,7 +24,7 @@ module.exports = class CocoRouter extends Backbone.Router
|
|||
'account/settings': go('account/AccountSettingsView')
|
||||
'account/unsubscribe': go('account/UnsubscribeView')
|
||||
'account/profile': go('user/JobProfileView') # legacy URL, sent in emails
|
||||
#'account/payment'
|
||||
'account/payments': go('account/PaymentsView')
|
||||
|
||||
'admin': go('admin/MainAdminView')
|
||||
'admin/candidates': go('admin/CandidatesView')
|
||||
|
|
|
@ -792,6 +792,12 @@
|
|||
recently_played: "Recently Played"
|
||||
no_recent_games: "No games played during the past two weeks."
|
||||
payments: "Payments"
|
||||
service_apple: "Apple"
|
||||
service_web: "Web"
|
||||
paid_on: "Paid On"
|
||||
service: "Service"
|
||||
price: "Price"
|
||||
gems: "Gems"
|
||||
|
||||
loading_error:
|
||||
could_not_load: "Error loading from server"
|
||||
|
|
5
app/models/Payment.coffee
Normal file
5
app/models/Payment.coffee
Normal file
|
@ -0,0 +1,5 @@
|
|||
CocoModel = require('./CocoModel')
|
||||
|
||||
module.exports = class Payment extends CocoModel
|
||||
@className: "Payment"
|
||||
urlRoot: "/db/payment"
|
30
app/templates/account/payments-view.jade
Normal file
30
app/templates/account/payments-view.jade
Normal file
|
@ -0,0 +1,30 @@
|
|||
extends /templates/base
|
||||
|
||||
block content
|
||||
|
||||
ol.breadcrumb
|
||||
li
|
||||
a(href="/")
|
||||
span.glyphicon.glyphicon-home
|
||||
li
|
||||
a(href="/account")(data-i18n="nav.account")
|
||||
li.active(data-i18n="account.payments")
|
||||
|
||||
if payments.models.length
|
||||
table.table.table-striped
|
||||
tr
|
||||
th(data-i18n="account.paid_on")
|
||||
th(data-i18n="account.service")
|
||||
th(data-i18n="account.price")
|
||||
th(data-i18n="account.gems")
|
||||
for payment in payments.models
|
||||
- var service = payment.get('service')
|
||||
tr
|
||||
td= moment(payment.getCreationDate()).format('lll')
|
||||
if service === 'ios'
|
||||
td(data-i18n="account.service_apple")
|
||||
td= payment.get('ios').localPrice
|
||||
else
|
||||
td(data-i18n="account.service_web")
|
||||
td $#{(payment.get('amount')/100).toFixed(2)}
|
||||
td= payment.get('gems')
|
18
app/views/account/PaymentsView.coffee
Normal file
18
app/views/account/PaymentsView.coffee
Normal file
|
@ -0,0 +1,18 @@
|
|||
RootView = require 'views/kinds/RootView'
|
||||
template = require 'templates/account/payments-view'
|
||||
CocoCollection = require 'collections/CocoCollection'
|
||||
Payment = require 'models/Payment'
|
||||
|
||||
module.exports = class PaymentsView extends RootView
|
||||
id: "payments-view"
|
||||
template: template
|
||||
|
||||
constructor: (options) ->
|
||||
super(options)
|
||||
@payments = new CocoCollection([], { url: '/db/payment', model: Payment })
|
||||
@supermodel.loadCollection(@payments, 'payments')
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.payments = @payments
|
||||
c
|
Loading…
Reference in a new issue