mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-07-08 15:22:46 +00:00
add spinner and use button template
This commit is contained in:
parent
9a0f3741ca
commit
7f8330cb62
@ -6,6 +6,7 @@ export default Ember.Component.extend({
|
|||||||
result: null,
|
result: null,
|
||||||
amount: null,
|
amount: null,
|
||||||
stripe: null,
|
stripe: null,
|
||||||
|
transactionInProgress: null,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super();
|
this._super();
|
||||||
@ -32,17 +33,18 @@ export default Ember.Component.extend({
|
|||||||
self.set('result', null);
|
self.set('result', null);
|
||||||
|
|
||||||
if (result.error) {
|
if (result.error) {
|
||||||
console.log('error yo');
|
console.log(result.error);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
self.set('transactionInProgress', true);
|
||||||
|
|
||||||
var params = {
|
var params = {
|
||||||
stripeToken: result.token.id,
|
stripeToken: result.token.id,
|
||||||
amount: self.get('amount') * 100
|
amount: self.get('amount') * 100
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(params);
|
|
||||||
|
|
||||||
ajax('/charges', { data: params, method: 'post' }).then(data => {
|
ajax('/charges', { data: params, method: 'post' }).then(data => {
|
||||||
|
self.set('transactionInProgress', false);
|
||||||
self.set('result', (data.status == 'succeeded' ? true : null));
|
self.set('result', (data.status == 'succeeded' ? true : null));
|
||||||
}).catch((data) => {
|
}).catch((data) => {
|
||||||
console.log('catch', data);
|
console.log('catch', data);
|
||||||
|
@ -14,7 +14,14 @@
|
|||||||
|
|
||||||
<div class="control-group save-button">
|
<div class="control-group save-button">
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<button {{action "submitStripeCard"}} class="btn btn-primary">{{i18n 'discourse_donations.submit'}}</button>
|
{{#d-button action="submitStripeCard" class="btn btn-primary btn-payment"}}
|
||||||
|
{{i18n 'discourse_donations.submit'}}
|
||||||
|
{{/d-button}}
|
||||||
|
|
||||||
|
{{#if transactionInProgress}}
|
||||||
|
{{loading-spinner size="small"}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if result}}
|
{{#if result}}
|
||||||
<span>{{i18n 'discourse_donations.success'}}</span>
|
<span>{{i18n 'discourse_donations.success'}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# name: discourse-donations
|
# name: discourse-donations
|
||||||
# about: Integrating Discourse with Stripe for donations
|
# about: Integrating Discourse with Stripe for donations
|
||||||
# version: 1.7.1
|
# version: 1.7.2
|
||||||
# url: https://github.com/choiceaustralia/discourse-donations
|
# url: https://github.com/choiceaustralia/discourse-donations
|
||||||
# authors: Rimian Perkins
|
# authors: Rimian Perkins
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user