mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 01:32:23 +08:00
f9bdda84ca
1. The events table had broken styling, making each row overflow 2. It had confusing routes: `/:id` for "edit" and `/:id/events` for "show" (now it's `/:id/edit` and `/:id` respectively) 3. There previously was an unused backend action (`#edit`) - now it is used (and `web_hooks/:id/events` route has been removed) 4. There was outdated/misplaced/duplicated CSS 5. And more
29 lines
625 B
JavaScript
29 lines
625 B
JavaScript
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
export default DiscourseRoute.extend({
|
|
serialize(model) {
|
|
return { web_hook_id: model.id || "new" };
|
|
},
|
|
|
|
model(params) {
|
|
if (params.web_hook_id === "new") {
|
|
return this.store.createRecord("web-hook");
|
|
}
|
|
|
|
return this.store.find("web-hook", params.web_hook_id);
|
|
},
|
|
|
|
setupController(controller, model) {
|
|
this._super(...arguments);
|
|
|
|
if (model.get("isNew")) {
|
|
model.set(
|
|
"web_hook_event_types",
|
|
this.controllerFor("adminWebHooks").defaultEventTypes
|
|
);
|
|
}
|
|
|
|
controller.set("saved", false);
|
|
},
|
|
});
|