currency format helper

This commit is contained in:
Rimian Perkins 2019-09-12 18:16:47 +10:00
parent 035187d843
commit 6f87f11e4a
5 changed files with 24 additions and 6 deletions

View File

@ -44,5 +44,7 @@ Many thanks to Chris Beach and Angus McLeod who helped on the previous version o
* Format the currency
* Check against other themes
* Add billing info to confirm dialog
* Confirm dialog heading
* Validate the model properly. Not in the stripe component
* Show the transaction on the thank you page.
* Work out where to put the helper tests. Name collision!

View File

@ -0,0 +1,16 @@
export default Ember.Helper.helper(function(params) {
let currencySign;
switch (Discourse.SiteSettings.discourse_patrons_currency) {
case 'EUR':
currencySign = "€";
break;
case 'GBP':
currencySign = "£";
break;
default:
currencySign = "$";
}
return [currencySign, params[0]].join('');
});

View File

@ -5,7 +5,7 @@
<table class="discourse-patrons-confirmation">
<tr>
<td>{{i18n 'discourse_patrons.confirmation.amount'}}</td>
<td class="discourse-donations-amount">{{amount}}</td>
<td class="discourse-donations-amount">{{format-curency amount}}</td>
</tr>
<tr>
<td>{{i18n 'discourse_patrons.confirmation.last4'}}</td>
@ -17,7 +17,7 @@
<div class='modal-footer'>
{{#d-button action="confirmStripeCard" class="btn btn-primary btn-payment btn-discourse-patrons"}}
{{i18n 'discourse_patrons.buttons.confirm_payment'}}{{amount}}
{{i18n 'discourse_patrons.buttons.confirm_payment'}} {{format-curency amount}}
{{/d-button}}
</div>

View File

@ -3,7 +3,7 @@
<div id="card-element"></div>
<div id="card-action">
{{#d-button action="submitStripeCard" class="btn btn-primary btn-payment btn-discourse-patrons"}}
{{i18n 'discourse_patrons.buttons.make_payment'}}{{amount}}
{{i18n 'discourse_patrons.buttons.make_payment'}} {{format-curency amount}}
{{/d-button}}
{{#if cardError}}

View File

@ -27,9 +27,9 @@ en:
email: Email
phone: Phone Number
confirmation:
amount: Amount $
amount: Amount
last4: Card number
buttons:
make_payment: Make payment $
confirm_payment: Confirm payment $
make_payment: Make payment
confirm_payment: Confirm payment
success: Go back