mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 09:35:39 -05:00
Refactor InvoicesView to use view in template
This commit is contained in:
parent
cd065f3ba6
commit
b475815e41
2 changed files with 9 additions and 17 deletions
|
@ -21,32 +21,32 @@ block content
|
|||
.form
|
||||
.form-group
|
||||
label.control-label(for="amount", data-i18n="account_invoices.amount")
|
||||
input#amount.form-control(name="amount", type="text", value="#{amount}")
|
||||
input#amount.form-control(name="amount", type="text", value="#{(view.amount / 100).toFixed(2)}")
|
||||
.form-group
|
||||
label.control-label(for="description", data-i18n="general.description")
|
||||
input#description.form-control(name="description", type="text", value="#{description}")
|
||||
input#description.form-control(name="description", type="text", value="#{view.description}")
|
||||
button#pay-button.btn.form-control.btn-primary(data-i18n="account_invoices.pay")
|
||||
|
||||
br
|
||||
|
||||
if state === 'invoice_paid'
|
||||
if view.state === 'invoice_paid'
|
||||
#declined-alert.alert.alert-success.alert-dismissible
|
||||
button.close(type="button" data-dismiss="alert")
|
||||
span(aria-hidden="true") ×
|
||||
p= stateMessage
|
||||
if state === 'validation_error'
|
||||
p= view.stateMessage
|
||||
if view.state === 'validation_error'
|
||||
#declined-alert.alert.alert-danger.alert-dismissible
|
||||
button.close(type="button" data-dismiss="alert")
|
||||
span(aria-hidden="true") ×
|
||||
p= stateMessage
|
||||
if state === 'declined'
|
||||
p= view.stateMessage
|
||||
if view.state === 'declined'
|
||||
#declined-alert.alert.alert-danger.alert-dismissible
|
||||
span(data-i18n="account_invoices.declined")
|
||||
button.close(type="button" data-dismiss="alert")
|
||||
span(aria-hidden="true") ×
|
||||
if state === 'unknown_error'
|
||||
if view.state === 'unknown_error'
|
||||
#error-alert.alert.alert-danger.alert-dismissible
|
||||
button.close(type="button" data-dismiss="alert")
|
||||
span(aria-hidden="true") ×
|
||||
p(data-i18n="loading_error.unknown")
|
||||
p= stateMessage
|
||||
p= view.stateMessage
|
||||
|
|
|
@ -20,14 +20,6 @@ module.exports = class InvoicesView extends RootView
|
|||
@amount = utils.getQueryVariable('a', 0)
|
||||
@description = utils.getQueryVariable('d', '')
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
c.amount = (@amount / 100).toFixed(2)
|
||||
c.description = @description
|
||||
c.state = @state
|
||||
c.stateMessage = @stateMessage
|
||||
c
|
||||
|
||||
onPayButton: ->
|
||||
@description = $('#description').val()
|
||||
|
||||
|
|
Loading…
Reference in a new issue