2024-03-12 23:15:12 -04:00
|
|
|
import Route from "@ember/routing/route";
|
2024-07-25 09:09:06 -04:00
|
|
|
import { service } from "@ember/service";
|
2024-03-12 23:15:12 -04:00
|
|
|
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-20 23:42:06 -04:00
|
|
|
@service adminPluginNavManager;
|
2024-03-12 23:15:12 -04:00
|
|
|
|
2024-07-05 16:25:42 -04:00
|
|
|
async model(params) {
|
2024-03-12 23:15:12 -04:00
|
|
|
const pluginId = sanitize(params.plugin_id).substring(0, 100);
|
2024-07-05 16:25:42 -04:00
|
|
|
const pluginAttrs = await ajax(`/admin/plugins/${pluginId}.json`);
|
|
|
|
return AdminPlugin.create(pluginAttrs);
|
2024-03-12 23:15:12 -04:00
|
|
|
}
|
2024-03-20 23:42:06 -04:00
|
|
|
|
|
|
|
afterModel(model) {
|
|
|
|
this.adminPluginNavManager.currentPlugin = model;
|
|
|
|
}
|
|
|
|
|
|
|
|
deactivate() {
|
|
|
|
this.adminPluginNavManager.currentPlugin = null;
|
|
|
|
}
|
2024-03-12 23:15:12 -04:00
|
|
|
}
|