DEV: Resolve transitionTo deprecation (#185)
This commit is contained in:
parent
316303da5d
commit
2ea8d7b6eb
|
@ -1,7 +1,10 @@
|
|||
import Controller from "@ember/controller";
|
||||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Controller.extend({
|
||||
router: service(),
|
||||
|
||||
actions: {
|
||||
createPlan() {
|
||||
if (this.get("model.plan.product_id") === undefined) {
|
||||
|
@ -12,7 +15,9 @@ export default Controller.extend({
|
|||
this.get("model.plan")
|
||||
.save()
|
||||
.then(() => {
|
||||
this.transitionToRoute("adminPlugins.discourse-subscriptions.plans");
|
||||
this.router.transitionTo(
|
||||
"adminPlugins.discourse-subscriptions.plans"
|
||||
);
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
},
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||
import Controller from "@ember/controller";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Controller.extend({
|
||||
router: service(),
|
||||
|
||||
actions: {
|
||||
cancelProduct() {
|
||||
this.transitionToRoute("adminPlugins.discourse-subscriptions.products");
|
||||
this.router.transitionTo("adminPlugins.discourse-subscriptions.products");
|
||||
},
|
||||
|
||||
createProduct() {
|
||||
this.get("model.product")
|
||||
.save()
|
||||
.then((product) => {
|
||||
this.transitionToRoute(
|
||||
this.router.transitionTo(
|
||||
"adminPlugins.discourse-subscriptions.products.show",
|
||||
product.id
|
||||
);
|
||||
|
@ -23,7 +26,7 @@ export default Controller.extend({
|
|||
this.get("model.product")
|
||||
.update()
|
||||
.then(() => {
|
||||
this.transitionToRoute(
|
||||
this.router.transitionTo(
|
||||
"adminPlugins.discourse-subscriptions.products"
|
||||
);
|
||||
})
|
||||
|
|
|
@ -8,6 +8,7 @@ import { inject as service } from "@ember/service";
|
|||
|
||||
export default Controller.extend({
|
||||
dialog: service(),
|
||||
router: service(),
|
||||
selectedPlan: null,
|
||||
promoCode: null,
|
||||
cardholderName: null,
|
||||
|
@ -98,7 +99,7 @@ export default Controller.extend({
|
|||
this.alert("plans.success");
|
||||
this.set("loading", false);
|
||||
|
||||
this.transitionToRoute(
|
||||
this.router.transitionTo(
|
||||
plan.type === "recurring"
|
||||
? "user.billing.subscriptions"
|
||||
: "user.billing.payments",
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import { action } from "@ember/object";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Route.extend({
|
||||
router: service(),
|
||||
|
||||
@action
|
||||
showSettings() {
|
||||
const controller = this.controllerFor("adminSiteSettings");
|
||||
this.transitionTo("adminSiteSettingsCategory", "plugins").then(() => {
|
||||
controller.set("filter", "plugin:discourse-subscriptions campaign");
|
||||
controller.set("_skipBounce", true);
|
||||
controller.filterContentNow("plugins");
|
||||
});
|
||||
this.router
|
||||
.transitionTo("adminSiteSettingsCategory", "plugins")
|
||||
.then(() => {
|
||||
controller.set("filter", "plugin:discourse-subscriptions campaign");
|
||||
controller.set("_skipBounce", true);
|
||||
controller.filterContentNow("plugins");
|
||||
});
|
||||
},
|
||||
});
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import Product from "discourse/plugins/discourse-subscriptions/discourse/models/product";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Route.extend({
|
||||
router: service(),
|
||||
|
||||
model() {
|
||||
return Product.findAll();
|
||||
},
|
||||
|
@ -11,12 +14,12 @@ export default Route.extend({
|
|||
const product = products[0];
|
||||
|
||||
if (this.currentUser && product.subscribed && !product.repurchaseable) {
|
||||
this.transitionTo(
|
||||
this.router.transitionTo(
|
||||
"user.billing.subscriptions",
|
||||
this.currentUser.username
|
||||
);
|
||||
} else {
|
||||
this.transitionTo("subscribe.show", product.id);
|
||||
this.router.transitionTo("subscribe.show", product.id);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import Route from "@ember/routing/route";
|
||||
import { inject as service } from "@ember/service";
|
||||
|
||||
export default Route.extend({
|
||||
router: service(),
|
||||
templateName: "user/billing/index",
|
||||
|
||||
redirect() {
|
||||
this.transitionTo("user.billing.subscriptions.index");
|
||||
this.router.transitionTo("user.billing.subscriptions.index");
|
||||
},
|
||||
});
|
||||
|
|
|
@ -6,13 +6,14 @@ import { inject as service } from "@ember/service";
|
|||
|
||||
export default Route.extend({
|
||||
dialog: service(),
|
||||
router: service(),
|
||||
model() {
|
||||
return UserSubscription.findAll();
|
||||
},
|
||||
|
||||
@action
|
||||
updateCard(subscriptionId) {
|
||||
this.transitionTo("user.billing.subscriptions.card", subscriptionId);
|
||||
this.router.transitionTo("user.billing.subscriptions.card", subscriptionId);
|
||||
},
|
||||
@action
|
||||
cancelSubscription(subscription) {
|
||||
|
|
Loading…
Reference in New Issue