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 DiscourseRoute from "discourse/routes/discourse";
import Group from "discourse/models/group"; import Group from "discourse/models/group";
import { action } from "@ember/object";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
model(params) { model(params) {
@ -30,18 +31,18 @@ export default DiscourseRoute.extend({
return { provider: model["provider"].get("id") }; return { provider: model["provider"].get("id") };
}, },
actions: { @action
closeModal() { closeModal() {
if (this.get("controller.modalShowing")) { if (this.get("controller.modalShowing")) {
this.refresh();
this.set("controller.modalShowing", false);
}
return true; // Continue bubbling up, so the modal actually closes
},
refreshProvider() {
this.refresh(); 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 DiscourseRoute from "discourse/routes/discourse";
import { action } from "@ember/object";
export default DiscourseRoute.extend({ export default DiscourseRoute.extend({
model() { model() {
return this.store.findAll("provider"); return this.store.findAll("provider");
}, },
actions: { @action
showSettings() { showSettings() {
this.transitionTo("adminSiteSettingsCategory", "plugins", { this.transitionTo("adminSiteSettingsCategory", "plugins", {
queryParams: { filter: "chat_integration" }, queryParams: { filter: "chat_integration" },
}); });
},
}, },
}); });