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