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 * Format the currency
* Check against other themes * Check against other themes
* Add billing info to confirm dialog * Add billing info to confirm dialog
* Confirm dialog heading
* Validate the model properly. Not in the stripe component * Validate the model properly. Not in the stripe component
* Show the transaction on the thank you page. * 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"> <table class="discourse-patrons-confirmation">
<tr> <tr>
<td>{{i18n 'discourse_patrons.confirmation.amount'}}</td> <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>
<tr> <tr>
<td>{{i18n 'discourse_patrons.confirmation.last4'}}</td> <td>{{i18n 'discourse_patrons.confirmation.last4'}}</td>
@ -17,7 +17,7 @@
<div class='modal-footer'> <div class='modal-footer'>
{{#d-button action="confirmStripeCard" class="btn btn-primary btn-payment btn-discourse-patrons"}} {{#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}} {{/d-button}}
</div> </div>

View File

@ -3,7 +3,7 @@
<div id="card-element"></div> <div id="card-element"></div>
<div id="card-action"> <div id="card-action">
{{#d-button action="submitStripeCard" class="btn btn-primary btn-payment btn-discourse-patrons"}} {{#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}} {{/d-button}}
{{#if cardError}} {{#if cardError}}

View File

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