mirror of
https://github.com/discourse/discourse-subscriptions.git
synced 2025-07-07 23:12:33 +00:00
DEV: migrate routes to the new @action pattern (#102)
This commit is contained in:
parent
9256a45c2a
commit
45780a1ebc
@ -1,14 +1,14 @@
|
||||
import Route from "@ember/routing/route";
|
||||
import AdminCoupon from "discourse/plugins/discourse-subscriptions/discourse/models/admin-coupon";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default Route.extend({
|
||||
model() {
|
||||
return AdminCoupon.list();
|
||||
},
|
||||
|
||||
actions: {
|
||||
@action
|
||||
reloadModel() {
|
||||
this.refresh();
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -1,13 +1,14 @@
|
||||
import Route from "@ember/routing/route";
|
||||
import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/models/admin-product";
|
||||
import I18n from "I18n";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default Route.extend({
|
||||
model() {
|
||||
return AdminProduct.findAll();
|
||||
},
|
||||
|
||||
actions: {
|
||||
@action
|
||||
destroyProduct(product) {
|
||||
bootbox.confirm(
|
||||
I18n.t(
|
||||
@ -33,5 +34,4 @@ export default Route.extend({
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -3,6 +3,7 @@ import AdminProduct from "discourse/plugins/discourse-subscriptions/discourse/mo
|
||||
import AdminPlan from "discourse/plugins/discourse-subscriptions/discourse/models/admin-plan";
|
||||
import I18n from "I18n";
|
||||
import { hash } from "rsvp";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default Route.extend({
|
||||
model(params) {
|
||||
@ -20,12 +21,10 @@ export default Route.extend({
|
||||
return hash({ plans, product });
|
||||
},
|
||||
|
||||
actions: {
|
||||
@action
|
||||
destroyPlan(plan) {
|
||||
bootbox.confirm(
|
||||
I18n.t(
|
||||
"discourse_subscriptions.admin.plans.operations.destroy.confirm"
|
||||
),
|
||||
I18n.t("discourse_subscriptions.admin.plans.operations.destroy.confirm"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
(confirmed) => {
|
||||
@ -46,5 +45,4 @@ export default Route.extend({
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -1,13 +1,14 @@
|
||||
import I18n from "I18n";
|
||||
import Route from "@ember/routing/route";
|
||||
import AdminSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/admin-subscription";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default Route.extend({
|
||||
model() {
|
||||
return AdminSubscription.find();
|
||||
},
|
||||
|
||||
actions: {
|
||||
@action
|
||||
cancelSubscription(model) {
|
||||
const subscription = model.subscription;
|
||||
const refund = model.refund;
|
||||
@ -19,13 +20,10 @@ export default Route.extend({
|
||||
this.send("closeModal");
|
||||
bootbox.alert(I18n.t("discourse_subscriptions.admin.canceled"));
|
||||
})
|
||||
.catch((data) =>
|
||||
bootbox.alert(data.jqXHR.responseJSON.errors.join("\n"))
|
||||
)
|
||||
.catch((data) => bootbox.alert(data.jqXHR.responseJSON.errors.join("\n")))
|
||||
.finally(() => {
|
||||
subscription.set("loading", false);
|
||||
this.refresh();
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -1,7 +1,8 @@
|
||||
import Route from "@ember/routing/route";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default Route.extend({
|
||||
actions: {
|
||||
@action
|
||||
showSettings() {
|
||||
const controller = this.controllerFor("adminSiteSettings");
|
||||
this.transitionTo("adminSiteSettingsCategory", "plugins").then(() => {
|
||||
@ -10,5 +11,4 @@ export default Route.extend({
|
||||
controller.filterContentNow("plugins");
|
||||
});
|
||||
},
|
||||
},
|
||||
});
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Route from "@ember/routing/route";
|
||||
import UserSubscription from "discourse/plugins/discourse-subscriptions/discourse/models/user-subscription";
|
||||
import I18n from "I18n";
|
||||
import { action } from "@ember/object";
|
||||
|
||||
export default Route.extend({
|
||||
templateName: "user/billing/subscriptions",
|
||||
@ -9,7 +10,7 @@ export default Route.extend({
|
||||
return UserSubscription.findAll();
|
||||
},
|
||||
|
||||
actions: {
|
||||
@action
|
||||
cancelSubscription(subscription) {
|
||||
bootbox.confirm(
|
||||
I18n.t(
|
||||
@ -35,5 +36,4 @@ export default Route.extend({
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user