mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-02-07 20:18:16 +00:00
04c4ff8cf0
In this PR, we added functionality to hide the admin header for edit/new actions - https://github.com/discourse/discourse/pull/30175 To make it work properly, we have to rename `show` to `edit` which is also a more accurate name.
19 lines
595 B
JavaScript
19 lines
595 B
JavaScript
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
export default class DiscourseAiToolsEditRoute extends DiscourseRoute {
|
|
async model(params) {
|
|
const allTools = this.modelFor("adminPlugins.show.discourse-ai-tools");
|
|
const id = parseInt(params.id, 10);
|
|
|
|
return allTools.find((tool) => tool.id === id);
|
|
}
|
|
|
|
setupController(controller) {
|
|
super.setupController(...arguments);
|
|
const toolsModel = this.modelFor("adminPlugins.show.discourse-ai-tools");
|
|
|
|
controller.set("allTools", toolsModel);
|
|
controller.set("presets", toolsModel.resultSetMeta.presets);
|
|
}
|
|
}
|