mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 08:33:41 +08:00
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
import { tracked } from "@glimmer/tracking";
|
|
import { service } from "@ember/service";
|
|
import { ADMIN_PANEL, MAIN_PANEL } from "discourse/lib/sidebar/panels";
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
import I18n from "discourse-i18n";
|
|
|
|
export default class AdminRoute extends DiscourseRoute {
|
|
@service sidebarState;
|
|
@service siteSettings;
|
|
@service currentUser;
|
|
@tracked initialSidebarState;
|
|
|
|
titleToken() {
|
|
return I18n.t("admin_title");
|
|
}
|
|
|
|
activate() {
|
|
if (this.currentUser.use_admin_sidebar) {
|
|
this.sidebarState.setPanel(ADMIN_PANEL);
|
|
this.sidebarState.setSeparatedMode();
|
|
this.sidebarState.hideSwitchPanelButtons();
|
|
}
|
|
|
|
this.controllerFor("application").setProperties({
|
|
showTop: false,
|
|
});
|
|
}
|
|
|
|
deactivate(transition) {
|
|
this.controllerFor("application").set("showTop", true);
|
|
|
|
if (this.currentUser.use_admin_sidebar) {
|
|
if (!transition?.to.name.startsWith("admin")) {
|
|
this.sidebarState.setPanel(MAIN_PANEL);
|
|
}
|
|
}
|
|
}
|
|
}
|