2024-03-13 11:15:12 +08:00
|
|
|
import Route from "@ember/routing/route";
|
|
|
|
import { inject as service } from "@ember/service";
|
|
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
import { sanitize } from "discourse/lib/text";
|
|
|
|
import AdminPlugin from "admin/models/admin-plugin";
|
|
|
|
|
|
|
|
export default class AdminPluginsShowRoute extends Route {
|
|
|
|
@service router;
|
2024-03-21 11:42:06 +08:00
|
|
|
@service adminPluginNavManager;
|
2024-03-13 11:15:12 +08:00
|
|
|
|
|
|
|
model(params) {
|
|
|
|
const pluginId = sanitize(params.plugin_id).substring(0, 100);
|
|
|
|
return ajax(`/admin/plugins/${pluginId}.json`).then((plugin) => {
|
|
|
|
return AdminPlugin.create(plugin);
|
|
|
|
});
|
|
|
|
}
|
2024-03-21 11:42:06 +08:00
|
|
|
|
|
|
|
afterModel(model) {
|
|
|
|
this.adminPluginNavManager.currentPlugin = model;
|
|
|
|
}
|
|
|
|
|
|
|
|
deactivate() {
|
|
|
|
this.adminPluginNavManager.currentPlugin = null;
|
|
|
|
}
|
2024-03-13 11:15:12 +08:00
|
|
|
}
|