Skip to content

Commit

Permalink
Fixes balanced#1634 & fixes balanced#1572: Update 'on statement as' f…
Browse files Browse the repository at this point in the history
…ield
  • Loading branch information
kyungmin committed Jan 30, 2015
1 parent 1de34bf commit b3fceaa
Show file tree
Hide file tree
Showing 22 changed files with 80 additions and 72 deletions.
14 changes: 3 additions & 11 deletions app/templates/modals/add-funds-modal.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#view "form-fields/form-section" appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText appearsOnStatementAsMaxLength=view.appearsOnStatementAsMaxLength debitableBankAccounts=view.debitableBankAccounts model=view.model sectionTitle="Payment information"}}
{{#view "form-fields/form-section" debitableBankAccounts=view.debitableBankAccounts model=view.model sectionTitle="Payment information" sectionDescription="Funds will appear in your balance in 3-5 business days."}}
{{#if view.debitableBankAccounts}}
{{view "form-fields/select-form-field"
model=view.model
Expand Down Expand Up @@ -32,12 +32,10 @@
field="dollar_amount"
}}

{{view "form-fields/text-form-field"
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
labelText=view.appearsOnStatementAsLabelText
field="appears_on_statement_as"
inputClassNames="full"
maxlength=view.appearsOnStatementAsMaxLength
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field"
Expand All @@ -47,9 +45,3 @@
field="description"
}}
{{/view}}

{{#view "form-fields/form-section" sectionTitle="Note"}}
<div class="form-group">
<p>Funds will appear in your balance in 3-5 business days.</p>
</div>
{{/view}}
8 changes: 6 additions & 2 deletions app/templates/modals/bank-account-credit-create-modal.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#view "form-fields/form-section" appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText bankAccountTypes=view.bankAccountTypes model=view.model sectionTitle="Credit information" sectionDescription="Funds will appear in the bank account by the next business day. First time credits to new accounts may take 3-5 business days."}}
{{#view "form-fields/form-section" bankAccountTypes=view.bankAccountTypes model=view.model sectionTitle="Credit information" sectionDescription="Funds will appear in the bank account by the next business day. First time credits to new accounts may take 3-5 business days."}}
{{view "form-fields/text-form-field" model=view.model field="name" labelText="Name on account" inputClassNames="full"}}
{{view "form-fields/text-form-field" model=view.model field="routing_number" labelText="Routing number" inputClassNames="full" tooltipTitle="Where is the routing number?" tooltipContent='<img src="images/bank-account-instructions.png" alt="Bank Account Instructions"/>'}}
{{view "form-fields/text-form-field" model=view.model field="account_number" labelText="Account number" inputClassNames="full" tooltipTitle="Where is the account number?" tooltipContent='<img src="images/bank-account-instructions.png" alt="Bank Account Instructions"/>'}}
Expand All @@ -16,7 +16,11 @@

{{view "form-fields/amount-form-field" model=view.model field="dollar_amount" labelText="Amount"}}

{{view "form-fields/text-form-field" model=view.model field="appears_on_statement_as" labelText=view.appearsOnStatementAsLabelText maxlength=view.appearsOnStatementAsMaxLength inputClassNames="full"}}
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
field="appears_on_statement_as"
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field" model=view.model field="description" labelText="Internal description" inputClassNames="full"}}
{{/view}}
8 changes: 6 additions & 2 deletions app/templates/modals/card-debit-create-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@
{{view "form-fields/text-form-field" model=view.model field="postal_code" labelText="Billing zip code" explanationText="Required for American Express cards"}}
{{/view}}

{{#view "form-fields/form-section" sectionTitle="Debit information" appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText appearsOnStatementAsMaxLength=view.appearsOnStatementAsMaxLength model=view.model}}
{{#view "form-fields/form-section" sectionTitle="Debit information" model=view.model}}
{{view "form-fields/amount-form-field" model=view.model field="dollar_amount" labelText="Amount"}}

{{view "form-fields/text-form-field" model=view.model field="appears_on_statement_as" labelText=view.appearsOnStatementAsLabelText maxlength=view.appearsOnStatementAsMaxLength inputClassNames="full"}}
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
field="appears_on_statement_as"
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field" model=view.model field="debit_description" labelText="Internal description" inputClassNames="full"}}
{{/view}}
8 changes: 6 additions & 2 deletions app/templates/modals/credit-customer-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@
{{/if}}
{{/view}}

{{#view "form-fields/form-section" appearsOnStatementAsMaxLength=view.appearsOnStatementAsMaxLength appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText model=view.model sectionTitle="Credit information"}}
{{#view "form-fields/form-section" model=view.model sectionTitle="Credit information"}}
{{view "form-fields/amount-form-field" model=view.model field="dollar_amount" labelText="Amount" explanationText=view.parentView.orderBalanceText}}

{{view "form-fields/text-form-field" model=view.model field="appears_on_statement_as" labelText=view.appearsOnStatementAsLabelText maxLength=view.appearsOnStatementAsMaxLength inputClassNames="full" maxlength=view.appearsOnStatementAsMaxLength}}
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
field="appears_on_statement_as"
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field" model=view.model field="credit_description" labelText="Internal description" maxlength=Constants.MAXLENGTH.DESCRIPTION inputClassNames="full"}}
{{/view}}
Expand Down
8 changes: 6 additions & 2 deletions app/templates/modals/credit-funding-instrument.hbs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{{#view "form-fields/form-section" appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText model=view.model sectionTitle="Credit information" sectionDescription=view.expectedDateText}}
{{#view "form-fields/form-section" model=view.model sectionTitle="Credit information" sectionDescription=view.expectedDateText}}
{{view "form-fields/amount-form-field" model=view.model field="dollar_amount" labelText="Amount"}}

{{view "form-fields/text-form-field" model=view.model field="appears_on_statement_as" labelText=view.appearsOnStatementAsLabelText maxlength=view.model.destination.appears_on_statement_max_length inputClassNames="full"}}
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
field="appears_on_statement_as"
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field" model=view.model field="description" labelText="Internal description" inputClassNames="full" maxlength=Constants.MAXLENGTH.DESCRIPTION}}
{{/view}}
6 changes: 5 additions & 1 deletion app/templates/modals/credit-order-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@
{{#view "form-fields/form-section" model=view.model sectionTitle="Credit information" sectionDescription="Funds will appear in the bank account by the next business day. First time credits to new accounts may take 3-5 business days."}}
{{view "form-fields/amount-form-field" model=view.model field="dollar_amount" labelText="Amount"}}

{{view "form-fields/text-form-field" model=view.model field="appears_on_statement_as" labelText=view.parentView.appearsOnStatementAsLabelText maxLength=view.parentView.appearsOnStatementAsMaxLength inputClassNames="full" maxlength=view.appearsOnStatementAsMaxLength}}
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
field="appears_on_statement_as"
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field" model=view.model field="description" labelText="Internal description" maxlength=Constants.MAXLENGTH.DESCRIPTION inputClassNames="full"}}
{{/view}}
10 changes: 7 additions & 3 deletions app/templates/modals/debit-customer-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@
{{/if}}
{{/view}}

{{#view "form-fields/form-section" sectionTitle="Debit information" appearsOnStatementAsMaxLength=view.appearsOnStatementAsMaxLength appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText model=view.model}}
{{#view "form-fields/form-section" sectionTitle="Debit information" model=view.model}}
{{view "form-fields/amount-form-field" model=view.model field="dollar_amount" labelText="Amount"}}

{{view "form-fields/text-form-field" model=view.model field="appears_on_statement_as" labelText=view.appearsOnStatementAsLabelText maxlength=view.appearsOnStatementAsMaxLength inputClassNames="full"}}
{{view.model}} || {{view.parentView.appearsOnStatementAsMaxLength}}
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
field="appears_on_statement_as"
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field" model=view.model field="debit_description" labelText="Internal description" inputClassNames="full" maxlength=Constants.MAXLENGTH.DESCRIPTION}}
{{/view}}
8 changes: 6 additions & 2 deletions app/templates/modals/debit-funding-instrument.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
{{view "form-fields/email-form-field" model=view.model field="seller_email_address" labelText="Merchant's email address" inputClassNames="full"}}
{{/view}}

{{#view "form-fields/form-section" appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText model=view.model sectionTitle="Debit information"}}
{{#view "form-fields/form-section" model=view.model sectionTitle="Debit information"}}
{{view "form-fields/amount-form-field" model=view.model field="dollar_amount" labelText="Amount"}}

{{view "form-fields/text-form-field" model=view.model field="appears_on_statement_as" labelText=view.appearsOnStatementAsLabelText maxlength=view.model.source.appears_on_statement_max_length inputClassNames="full"}}
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
field="appears_on_statement_as"
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field" model=view.model field="description" labelText="Internal description" inputClassNames="full" maxlength=Constants.MAXLENGTH.DESCRIPTION}}
{{/view}}
8 changes: 6 additions & 2 deletions app/templates/modals/debit-order-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@
{{view "form-fields/text-form-field" model=view.model field="postal_code" labelText="Billing zip code" explanationText="Required for American Express cards"}}
{{/view}}

{{#view "form-fields/form-section" sectionTitle="Debit information" appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText appearsOnStatementAsMaxLength=view.appearsOnStatementAsMaxLength model=view.model}}
{{#view "form-fields/form-section" sectionTitle="Debit information" model=view.model}}
{{view "form-fields/amount-form-field" model=view.model field="dollar_amount" labelText="Amount"}}

{{view "form-fields/text-form-field" model=view.model field="appears_on_statement_as" labelText=view.appearsOnStatementAsLabelText maxlength=view.appearsOnStatementAsMaxLength inputClassNames="full"}}
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
field="appears_on_statement_as"
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field" model=view.model field="debit_description" labelText="Internal description" inputClassNames="full"}}
{{/view}}
7 changes: 3 additions & 4 deletions app/templates/modals/withdraw-funds-modal.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{#view "form-fields/form-section" availableBalance=view.availableBalance appearsOnStatementAsLabelText=view.appearsOnStatementAsLabelText appearsOnStatementAsMaxLength=view.appearsOnStatementAsMaxLength bankAccounts=view.bankAccounts model=view.model sectionTitle="Payment information"}}
{{#view "form-fields/form-section" availableBalance=view.availableBalance bankAccounts=view.bankAccounts model=view.model sectionTitle="Payment information"}}
{{#if view.bankAccounts}}
{{view "form-fields/select-form-field"
model=view.model
Expand Down Expand Up @@ -35,11 +35,10 @@
explanationText=view.availableBalance
}}

{{view "form-fields/text-form-field"
{{view "form-fields/statement-descriptor-text-form-field"
model=view.model
labelText=view.appearsOnStatementAsLabelText
field="appears_on_statement_as"
maxlength=view.appearsOnStatementAsMaxLength
maxlength=view.parentView.appearsOnStatementAsMaxLength
}}

{{view "form-fields/text-form-field"
Expand Down
19 changes: 19 additions & 0 deletions app/views/form-fields/statement-descriptor-text-form-field.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import TextFormFieldView from "./text-form-field";

var StatementDescriptorTextFormFieldView = TextFormFieldView.extend({
maxlength: 0,
labelText: "On statement as",
explanationText: function() {
var maxLength = this.get('maxlength');

if (maxLength > 0) {
var noteLength = this.get('value') ? this.get('value.length') : 0;
var remaining = maxLength - noteLength;
var unit = (remaining === 1) ? "character" : "characters";

return "%@ %@ remaining".fmt(remaining, unit);
}
}.property('value.length'),
});

export default StatementDescriptorTextFormFieldView;
5 changes: 3 additions & 2 deletions app/views/form-fields/textarea-form-field.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ var TextAreaFormFieldView = BaseFormFieldView.extend({
if (maxLength > 0) {
var noteLength = this.get('value') ? this.get('value.length') : 0;
var remaining = maxLength - noteLength;
return "%@ characters remaining".fmt(remaining);
var unit = (remaining === 1) ? "character" : "characters";

return "%@ %@ remaining".fmt(remaining, unit);
}
}.property('value.length'),

});

export default TextAreaFormFieldView;
3 changes: 0 additions & 3 deletions app/views/modals/add-funds-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ var AddFundsModalView = ModalBaseView.extend(Full, Form, Action, {
submitButtonText: "Add",

appearsOnStatementAsMaxLength: Constants.MAXLENGTH.APPEARS_ON_STATEMENT_BANK_ACCOUNT,
appearsOnStatementAsLabelText: function() {
return "Appears on statement as (%@ characters max)".fmt(this.get("appearsOnStatementAsMaxLength"));
}.property("appearsOnStatementAsMaxLength"),

debitableBankAccounts: Ember.computed.readOnly("marketplace.owner_customer.debitable_bank_accounts"),
debitableBankAccountsForSelect: Ember.computed.map("debitableBankAccounts", function(bankAccount) {
Expand Down
5 changes: 0 additions & 5 deletions app/views/modals/bank-account-credit-create-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ var BankAccountCreditCreateModalView = ModalBaseView.extend(Save, Full, Form, {
};
}),

appearsOnStatementAsLabelText: function() {
var length = this.get("appearsOnStatementAsMaxLength");
return "Appears on statement as (%@ characters max)".fmt(length);
}.property("appearsOnStatementAsMaxLength"),

appearsOnStatementAsMaxLength: Constants.MAXLENGTH.APPEARS_ON_STATEMENT_BANK_ACCOUNT,

actions: {
Expand Down
5 changes: 0 additions & 5 deletions app/views/modals/card-debit-create-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ var CardDebitCreateModalView = ModalBaseView.extend(Save, Full, Form, {

appearsOnStatementAsMaxLength: Constants.MAXLENGTH.APPEARS_ON_STATEMENT_CARD,

appearsOnStatementAsLabelText: function() {
var length = this.get("appearsOnStatementAsMaxLength");
return "Appears on statement as (%@ characters max)".fmt(length);
}.property("appearsOnStatementAsMaxLength"),

actions: {
save: function() {
var controller = this.get("controller");
Expand Down
4 changes: 0 additions & 4 deletions app/views/modals/credit-customer-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ var CreditCustomerModalView = ModalBaseView.extend(Full, Form, Save, {
}.property("model.order.amount_escrowed"),

appearsOnStatementAsMaxLength: Ember.computed.oneWay("model.appears_on_statement_max_length"),
appearsOnStatementAsLabelText: function() {
var length = this.get("appearsOnStatementAsMaxLength");
return "Appears on statement as (%@ characters max)".fmt(length);
}.property("appearsOnStatementAsMaxLength"),

creditableOrders: function() {
return this.get("customer").getOrdersLoader().get("results");
Expand Down
6 changes: 1 addition & 5 deletions app/views/modals/credit-funding-instrument-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ var CreditFundingInstrumentModalView = BaseFundingInstrumentModalView.extend({
return "This credit is expected to appear on %@.".fmt(Utils.humanReadableDate(creditDate));
}.property("model.destination.expected_credit_date"),

appearsOnStatementAsLabelText: function() {
var length = this.get("model.destination.appears_on_statement_max_length");
return "Appears on statement as (%@ characters max)".fmt(length);
}.property("model.destination.appears_on_statement_max_length"),

appearsOnStatementAsMaxLength: Ember.computed.reads("model.destination.appears_on_statement_max_length"),
});

CreditFundingInstrumentModalView.reopenClass({
Expand Down
2 changes: 2 additions & 0 deletions app/views/modals/credit-order-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ var CreditOrderModalView = CreditCustomerModalView.extend({
elementId: "credit-order",
title: "Credit from this order",

appearsOnStatementAsMaxLength: Ember.computed.reads("model.appears_on_statement_max_length"),

model: function() {
return CreditExistingFundingInstrumentTransactionFactory.create({
customer: this.get("recipient"),
Expand Down
4 changes: 0 additions & 4 deletions app/views/modals/debit-customer-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ var DebitCustomerModalView = ModalBaseView.extend(Full, Form, Save, {
submitButtonText: "Debit",

appearsOnStatementAsMaxLength: Ember.computed.oneWay("model.appears_on_statement_max_length"),
appearsOnStatementAsLabelText: function() {
var length = this.get("appearsOnStatementAsMaxLength");
return "Appears on statement as (%@ characters max)".fmt(length);
}.property("appearsOnStatementAsMaxLength"),

transactionFactoryClass: function() {
if (this.get("isDisplayExistingFundingInstruments")) {
Expand Down
5 changes: 1 addition & 4 deletions app/views/modals/debit-funding-instrument-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ var DebitFundingInstrumentModalView = BaseFundingInstrumentModalView.extend({
cancelButtonText: "Cancel",
submitButtonText: "Debit",

appearsOnStatementAsLabelText: function() {
var length = this.get("model.source.appears_on_statement_max_length");
return "Appears on statement as (%@ characters max)".fmt(length);
}.property("model.source.appears_on_statement_max_length"),
appearsOnStatementAsMaxLength: Ember.computed.reads("model.source.appears_on_statement_max_length"),
});

DebitFundingInstrumentModalView.reopenClass({
Expand Down
5 changes: 0 additions & 5 deletions app/views/modals/debit-order-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ var DebitOrderModalView = ModalBaseView.extend(Save, Full, Form, {

appearsOnStatementAsMaxLength: Constants.MAXLENGTH.APPEARS_ON_STATEMENT_CARD,

appearsOnStatementAsLabelText: function() {
var length = this.get("appearsOnStatementAsMaxLength");
return "Appears on statement as (%@ characters max)".fmt(length);
}.property("appearsOnStatementAsMaxLength"),

actions: {
save: function() {
var controller = this.get("controller");
Expand Down
4 changes: 0 additions & 4 deletions app/views/modals/withdraw-funds-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ var WithdrawFundsModalView = ModalBaseView.extend(Full, Form, {
submitButtonText: "Withdraw",

appearsOnStatementAsMaxLength: Constants.MAXLENGTH.APPEARS_ON_STATEMENT_BANK_ACCOUNT,
appearsOnStatementAsLabelText: function() {
var length = this.get("appearsOnStatementAsMaxLength");
return "Appears on statement as (%@ characters max)".fmt(length);
}.property("appearsOnStatementAsMaxLength"),

bankAccounts: Ember.computed.readOnly('marketplace.owner_customer.bank_accounts'),
availableBalance: function() {
Expand Down

0 comments on commit b3fceaa

Please sign in to comment.