pretty js

This commit is contained in:
Rimian Perkins 2019-11-06 20:59:35 +11:00
parent 78cbfc2652
commit 482ce178d5
7 changed files with 18 additions and 18 deletions

View File

@ -34,7 +34,9 @@ export default Ember.Controller.extend({
} }
subscription.save().then(() => { subscription.save().then(() => {
bootbox.alert(I18n.t("discourse_patrons.transactions.payment.success")); bootbox.alert(
I18n.t("discourse_patrons.transactions.payment.success")
);
this.transitionToRoute( this.transitionToRoute(
"user.subscriptions", "user.subscriptions",
Discourse.User.current().username.toLowerCase() Discourse.User.current().username.toLowerCase()

View File

@ -1,4 +1,3 @@
// TODO: typo in this helper name: currency not curency. // TODO: typo in this helper name: currency not curency.
export default Ember.Helper.helper(function(params) { export default Ember.Helper.helper(function(params) {
let currencySign; let currencySign;

View File

@ -1,4 +1,3 @@
export default Ember.Helper.helper(function(params) { export default Ember.Helper.helper(function(params) {
let currencySign; let currencySign;
@ -13,5 +12,5 @@ export default Ember.Helper.helper(function(params) {
currencySign = "$"; currencySign = "$";
} }
return currencySign + params.map(p => p.toUpperCase()).join(' '); return currencySign + params.map(p => p.toUpperCase()).join(" ");
}); });

View File

@ -10,8 +10,8 @@ Product.reopenClass({
}, },
find(id) { find(id) {
return ajax(`/patrons/products/${id}`, { method: "get" }).then( return ajax(`/patrons/products/${id}`, { method: "get" }).then(product =>
product => Product.create(product) Product.create(product)
); );
} }
}); });

View File

@ -9,9 +9,9 @@ const UserSubscription = Discourse.Model.extend({
}, },
destroy() { destroy() {
return ajax(`/patrons/user/subscriptions/${this.id}`, { method: "delete" }).then( return ajax(`/patrons/user/subscriptions/${this.id}`, {
result => UserSubscription.create(result) method: "delete"
); }).then(result => UserSubscription.create(result));
} }
}); });

View File

@ -4,13 +4,13 @@ import Subscription from "discourse/plugins/discourse-patrons/discourse/models/s
export default Discourse.Route.extend({ export default Discourse.Route.extend({
model(params) { model(params) {
const product_id = params["subscription-id"]; const product_id = params["subscription-id"];
const product = Product.find(product_id); const product = Product.find(product_id);
const subscription = Subscription.create(); const subscription = Subscription.create();
const plans = Plan.findAll({ product_id: product_id }).then(results => const plans = Plan.findAll({ product_id: product_id }).then(results =>
results.map(p => ({ id: p.id, name: p.subscriptionRate })) results.map(p => ({ id: p.id, name: p.subscriptionRate }))
); );
return Ember.RSVP.hash({ plans, product, subscription }); return Ember.RSVP.hash({ plans, product, subscription });
}, }
}); });

View File

@ -3,5 +3,5 @@ import Product from "discourse/plugins/discourse-patrons/discourse/models/produc
export default Discourse.Route.extend({ export default Discourse.Route.extend({
model() { model() {
return Product.findAll(); return Product.findAll();
}, }
}); });