pretty
This commit is contained in:
parent
b0a4665bf4
commit
bec2d57920
|
@ -16,7 +16,7 @@ const Plan = Discourse.Model.extend({
|
|||
@computed("amountDollars", "currency", "interval")
|
||||
subscriptionRate(amountDollars, currency, interval) {
|
||||
return `$${amountDollars} ${currency.toUpperCase()} / ${interval}`;
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
Plan.reopenClass({
|
||||
|
|
|
@ -10,7 +10,7 @@ const Subscription = Discourse.Model.extend({
|
|||
|
||||
@computed("status")
|
||||
canceled(status) {
|
||||
return status === 'canceled';
|
||||
return status === "canceled";
|
||||
},
|
||||
|
||||
save() {
|
||||
|
@ -23,10 +23,10 @@ const Subscription = Discourse.Model.extend({
|
|||
},
|
||||
|
||||
destroy() {
|
||||
return ajax(`/patrons/subscriptions/${this.id}`, { method: "delete" }).then(result =>
|
||||
Subscription.create(result)
|
||||
return ajax(`/patrons/subscriptions/${this.id}`, { method: "delete" }).then(
|
||||
result => Subscription.create(result)
|
||||
);
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
Subscription.reopenClass({
|
||||
|
|
|
@ -16,14 +16,16 @@ export default Discourse.Route.extend({
|
|||
actions: {
|
||||
cancelSubscription(subscription) {
|
||||
bootbox.confirm(
|
||||
I18n.t("discourse_patrons.user.subscriptions.operations.destroy.confirm"),
|
||||
I18n.t(
|
||||
"discourse_patrons.user.subscriptions.operations.destroy.confirm"
|
||||
),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
confirmed => {
|
||||
if (confirmed) {
|
||||
subscription
|
||||
.destroy()
|
||||
.then(result => subscription.set('status', result.status))
|
||||
.then(result => subscription.set("status", result.status))
|
||||
.catch(data =>
|
||||
bootbox.alert(data.jqXHR.responseJSON.errors.join("\n"))
|
||||
);
|
||||
|
|
|
@ -22,7 +22,8 @@ textarea[readonly] {
|
|||
|
||||
table.discourse-patrons-user-table {
|
||||
width: 100%;
|
||||
th, td {
|
||||
th,
|
||||
td {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ QUnit.module("discourse-patrons:model:plan");
|
|||
QUnit.test("subscriptionRate", assert => {
|
||||
const plan = Plan.create({
|
||||
amount: "2399",
|
||||
currency: 'aud',
|
||||
interval: 'month'
|
||||
currency: "aud",
|
||||
interval: "month"
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
|
@ -29,9 +29,5 @@ QUnit.test("amountDollars", assert => {
|
|||
QUnit.test("amount", assert => {
|
||||
const plan = Plan.create({ amountDollars: "22.12" });
|
||||
|
||||
assert.equal(
|
||||
plan.get("amount"),
|
||||
2212,
|
||||
"it returns the cents amount"
|
||||
);
|
||||
assert.equal(plan.get("amount"), 2212, "it returns the cents amount");
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue