DEV: migrate routes to the new @action pattern (#100)

This commit is contained in:
Andrei Prigorshnev 2022-01-06 12:16:23 +01:00 committed by GitHub
parent e9522c5f7d
commit 356a1d1a72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 18 deletions

View File

@ -1,5 +1,6 @@
import DiscourseRoute from "discourse/routes/discourse";
import Group from "discourse/models/group";
import { action } from "@ember/object";
export default DiscourseRoute.extend({
model(params) {
@ -30,18 +31,18 @@ export default DiscourseRoute.extend({
return { provider: model["provider"].get("id") };
},
actions: {
closeModal() {
if (this.get("controller.modalShowing")) {
this.refresh();
this.set("controller.modalShowing", false);
}
return true; // Continue bubbling up, so the modal actually closes
},
refreshProvider() {
@action
closeModal() {
if (this.get("controller.modalShowing")) {
this.refresh();
},
this.set("controller.modalShowing", false);
}
return true; // Continue bubbling up, so the modal actually closes
},
@action
refreshProvider() {
this.refresh();
},
});

View File

@ -1,15 +1,15 @@
import DiscourseRoute from "discourse/routes/discourse";
import { action } from "@ember/object";
export default DiscourseRoute.extend({
model() {
return this.store.findAll("provider");
},
actions: {
showSettings() {
this.transitionTo("adminSiteSettingsCategory", "plugins", {
queryParams: { filter: "chat_integration" },
});
},
@action
showSettings() {
this.transitionTo("adminSiteSettingsCategory", "plugins", {
queryParams: { filter: "chat_integration" },
});
},
});