mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-07-08 15:22:46 +00:00
combo box with amounts. use decimals
This commit is contained in:
parent
c3e3b7ad67
commit
7ad42c9b48
@ -10,10 +10,13 @@ export default Ember.Component.extend({
|
|||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
const settings = Discourse.SiteSettings;
|
const settings = Discourse.SiteSettings;
|
||||||
|
const amounts = Discourse.SiteSettings.discourse_patrons_amounts.split('|');
|
||||||
|
|
||||||
this.setProperties({
|
this.setProperties({
|
||||||
confirmation: false,
|
confirmation: false,
|
||||||
currency: settings.discourse_donations_currency
|
currency: settings.discourse_donations_currency,
|
||||||
|
amounts,
|
||||||
|
amount: amounts[0]
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
{{#if confirmation}}
|
{{#if confirmation}}
|
||||||
{{#d-modal closeModal=(action "closeModal") modalStyle="inline-modal" title=(i18n "discourse_donations.confirm")}}
|
{{#d-modal closeModal=(action "closeModal") modalStyle="inline-modal" title=(i18n "discourse_patrons.confirm")}}
|
||||||
{{#d-modal-body}}
|
{{#d-modal-body}}
|
||||||
<table class="discourse-donations-confirmation">
|
<table class="discourse-donations-confirmation">
|
||||||
<tr>
|
<tr>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
<div class='modal-footer'>
|
<div class='modal-footer'>
|
||||||
{{#d-button action="confirmStripeCard" class="btn btn-primary btn-payment"}}
|
{{#d-button action="confirmStripeCard" class="btn btn-primary btn-payment"}}
|
||||||
{{i18n 'discourse_donations.submit'}} {{amount}}
|
{{i18n 'discourse_patrons.submit'}} {{amount}}
|
||||||
{{/d-button}}
|
{{/d-button}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -32,14 +32,16 @@
|
|||||||
{{else}}
|
{{else}}
|
||||||
<div class="discourse-patrons-section-columns">
|
<div class="discourse-patrons-section-columns">
|
||||||
<div class="section-column">
|
<div class="section-column">
|
||||||
<h3>Your information</h3>
|
<h3>{{i18n 'discourse_patrons.your_information'}}</h3>
|
||||||
|
|
||||||
<div class="user-controls">
|
<div class="user-controls">
|
||||||
<div class="display-row">
|
<div class="display-row">
|
||||||
<div class="field">Payment Amount</div>
|
<div class="field">
|
||||||
|
{{i18n 'discourse_patrons.amount'}}
|
||||||
|
{{siteSettings.discourse_patrons_currency}}
|
||||||
|
</div>
|
||||||
<div class="value">
|
<div class="value">
|
||||||
{{input value=amount}}<br>
|
{{combo-box valueAttribute="value" content=amounts value=amount}}
|
||||||
Enter {{currency}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
en:
|
en:
|
||||||
site_settings:
|
site_settings:
|
||||||
discourse_patrons_enabled: "Enable the Discourse Donations plugin."
|
discourse_patrons_enabled: "Enable the Discourse Patrons plugin."
|
||||||
discourse_patrons_secret_key: "Stripe Secret Key"
|
discourse_patrons_secret_key: "Stripe Secret Key"
|
||||||
discourse_patrons_public_key: "Stripe Public Key"
|
discourse_patrons_public_key: "Stripe Public Key"
|
||||||
discourse_patrons_description: "Description shown in Stripe Checkout form"
|
discourse_patrons_description: "Description shown in Stripe Checkout form"
|
||||||
@ -9,9 +9,9 @@ en:
|
|||||||
discourse_patrons_billing_address: "Collect billing address"
|
discourse_patrons_billing_address: "Collect billing address"
|
||||||
discourse_patrons_reward_badge_name: "Grant this badge to user when a payment is successful"
|
discourse_patrons_reward_badge_name: "Grant this badge to user when a payment is successful"
|
||||||
discourse_patrons_reward_group_name: "Add the user to this group when a payment is successful"
|
discourse_patrons_reward_group_name: "Add the user to this group when a payment is successful"
|
||||||
discourse_patrons_page_description: "Text to be added to /donate page. Markdown is supported."
|
discourse_patrons_page_description: "Text to be added to /patrons page. Markdown is supported."
|
||||||
errors:
|
errors:
|
||||||
discourse_patrons_amount_must_be_number: "Amounts must be numbers"
|
discourse_patrons_amount_must_be_currency: "Currency amounts must be currencies (eg 1.50)"
|
||||||
|
|
||||||
js:
|
js:
|
||||||
discourse_patrons:
|
discourse_patrons:
|
||||||
|
@ -10,6 +10,12 @@ plugins:
|
|||||||
discourse_patrons_description:
|
discourse_patrons_description:
|
||||||
client: true
|
client: true
|
||||||
default: ''
|
default: ''
|
||||||
|
discourse_patrons_amounts:
|
||||||
|
client: true
|
||||||
|
type: list
|
||||||
|
default: '1.00|2.00|5.00|10.00|20.00|50.00|100.00'
|
||||||
|
regex: "^([0-9]+.[0-9]{2}\\|)+[0-9]+.[0-9]{2}$"
|
||||||
|
regex_error: "site_settings.errors.discourse_patrons_amount_must_be_currency"
|
||||||
discourse_patrons_currency:
|
discourse_patrons_currency:
|
||||||
client: true
|
client: true
|
||||||
default: "USD"
|
default: "USD"
|
||||||
@ -18,6 +24,5 @@ plugins:
|
|||||||
- AUD
|
- AUD
|
||||||
- CAD
|
- CAD
|
||||||
- EUR
|
- EUR
|
||||||
- JPY
|
|
||||||
- GBP
|
- GBP
|
||||||
- USD
|
- USD
|
||||||
|
@ -10,6 +10,7 @@ componentTest("Discourse Patrons donation form has content", {
|
|||||||
"component:stripe-card",
|
"component:stripe-card",
|
||||||
Ember.Component.extend({ tagName: "dummy-component-tag" })
|
Ember.Component.extend({ tagName: "dummy-component-tag" })
|
||||||
);
|
);
|
||||||
|
Discourse.SiteSettings.discourse_patrons_amounts = "1.00|2.01";
|
||||||
},
|
},
|
||||||
|
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
@ -29,6 +30,7 @@ componentTest("donation form has a confirmation", {
|
|||||||
|
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
this.registry.register("component:stripe-card", Ember.Component.extend());
|
this.registry.register("component:stripe-card", Ember.Component.extend());
|
||||||
|
Discourse.SiteSettings.discourse_patrons_amounts = "1.00|2.01";
|
||||||
},
|
},
|
||||||
|
|
||||||
async test(assert) {
|
async test(assert) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user