discourse/app/assets/javascripts/admin/routes/admin-web-hooks-show.js.es6
Vinoth Kannan d33d031742
FEATURE: Filter topic and post web hook events by tags (#6726)
* FEATURE: Filter topic and post web hook events by tags

* Add a spec test with unmatched tags
2018-12-05 14:44:06 +05:30

31 lines
864 B
JavaScript

export default Discourse.Route.extend({
serialize(model) {
return { web_hook_id: model.get("id") || "new" };
},
model(params) {
if (params.web_hook_id === "new") {
return this.store.createRecord("web-hook");
}
return this.store.find("web-hook", Ember.get(params, "web_hook_id"));
},
setupController(controller, model) {
if (
model.get("isNew") ||
Ember.isEmpty(model.get("web_hook_event_types"))
) {
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"));
model.set("group_ids", model.get("group_ids"));
controller.setProperties({ model, saved: false });
},
renderTemplate() {
this.render("admin/templates/web-hooks-show", { into: "adminApi" });
}
});