discourse/app/assets/javascripts/admin/addon/routes/admin-web-hooks-show.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
883 B
JavaScript
Raw Normal View History

2019-10-31 16:28:10 -04:00
import { get } from "@ember/object";
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
2016-06-15 13:49:57 -04:00
serialize(model) {
return { web_hook_id: model.get("id") || "new" };
},
model(params) {
if (params.web_hook_id === "new") {
return this.store.createRecord("web-hook");
}
2019-10-31 16:28:10 -04:00
return this.store.find("web-hook", get(params, "web_hook_id"));
2016-06-15 13:49:57 -04:00
},
setupController(controller, model) {
if (model.get("isNew")) {
2016-06-15 13:49:57 -04:00
model.set("web_hook_event_types", controller.get("defaultEventTypes"));
}
model.set("category_ids", model.get("category_ids"));
model.set("tag_names", model.get("tag_names"));
2016-06-15 13:49:57 -04:00
model.set("group_ids", model.get("group_ids"));
controller.setProperties({ model, saved: false });
},
renderTemplate() {
this.render("admin/templates/web-hooks-show", { into: "adminApi" });
2016-06-15 13:49:57 -04:00
},
});