Merge pull request #10 from chrisbeach/amount_setting
Make donation amounts a customisable setting
This commit is contained in:
commit
76c5641041
|
@ -3,14 +3,6 @@ import { getRegister } from 'discourse-common/lib/get-owner';
|
|||
import { default as computed } from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
donateAmounts: [
|
||||
{ value: 1, name: '1.00'},
|
||||
{ value: 2, name: '2.00'},
|
||||
{ value: 5, name: '5.00'},
|
||||
{ value: 10, name: '10.00'},
|
||||
{ value: 20, name: '20.00'},
|
||||
{ value: 50, name: '50.00'}
|
||||
],
|
||||
result: [],
|
||||
amount: 1,
|
||||
stripe: null,
|
||||
|
@ -26,6 +18,21 @@ export default Ember.Component.extend({
|
|||
this.set('stripe', Stripe(this.get('settings').discourse_donations_public_key));
|
||||
},
|
||||
|
||||
@computed
|
||||
donateAmounts() {
|
||||
const setting = Discourse.SiteSettings.discourse_donations_amounts.split('|');
|
||||
if (setting.length) {
|
||||
return setting.map((amount) => {
|
||||
return {
|
||||
value: parseInt(amount, 10),
|
||||
name: `${amount}.00`
|
||||
};
|
||||
});
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
||||
@computed('stripe')
|
||||
card(stripe) {
|
||||
let elements = stripe.elements();
|
||||
|
|
|
@ -15,6 +15,10 @@ en:
|
|||
discourse_donations_enable_transaction_fee: "Give the user the option of including the Stripe transaction fee in their donation."
|
||||
discourse_donations_transaction_fee_fixed: "Fixed part of Stripe transaction fee (changes per region). See <a href='https://stripe.com/pricing'>Stripe's pricing for your region</a> and <a href='https://support.stripe.com/questions/can-i-charge-my-stripe-fees-to-my-customers'>Stripe's explaination of passing fees onto customers</a>."
|
||||
discourse_donations_transaction_fee_percent: "Percent part of Stripe transaction fee (changes per region). See <a href='https://stripe.com/pricing'>Stripe's pricing for your region</a> and <a href='https://support.stripe.com/questions/can-i-charge-my-stripe-fees-to-my-customers'>Stripe's explaination of passing fees onto customers</a>."
|
||||
discourse_donations_amounts: "Donation amounts available to user"
|
||||
discourse_donations_custom_amount: "Allow custom donation amount"
|
||||
errors:
|
||||
discourse_donations_amount_must_be_number: "Amounts must be numbers"
|
||||
|
||||
js:
|
||||
discourse_donations:
|
||||
|
|
|
@ -44,3 +44,9 @@ plugins:
|
|||
discourse_donations_transaction_fee_percent:
|
||||
client: true
|
||||
default: 0.029
|
||||
discourse_donations_amounts:
|
||||
client: true
|
||||
type: list
|
||||
default: '1|2|5|10|20|50'
|
||||
regex: "^[0-9\\|]+$"
|
||||
regex_error: "site_settings.errors.discourse_donations_amount_must_be_number"
|
||||
|
|
Loading…
Reference in New Issue