mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 12:13:40 +08:00
979eca99d5
Followup 73c6bb2593
The admin sidebar was also disappearing on another
child admin route (in this case the docker_manager
plugin update page). Instead of relying on the route
name which is flaky, we can set a boolean when the
sidebar is forced in the root admin route, then
turn it off when leaving admin.
38 lines
958 B
JavaScript
38 lines
958 B
JavaScript
import { tracked } from "@glimmer/tracking";
|
|
import { service } from "@ember/service";
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
import I18n from "discourse-i18n";
|
|
|
|
export default class AdminRoute extends DiscourseRoute {
|
|
@service sidebarState;
|
|
@service siteSettings;
|
|
@service store;
|
|
@service currentUser;
|
|
@service adminSidebarStateManager;
|
|
@tracked initialSidebarState;
|
|
|
|
titleToken() {
|
|
return I18n.t("admin_title");
|
|
}
|
|
|
|
activate() {
|
|
this.adminSidebarStateManager.maybeForceAdminSidebar({
|
|
onlyIfAlreadyActive: false,
|
|
});
|
|
|
|
this.controllerFor("application").setProperties({
|
|
showTop: false,
|
|
});
|
|
}
|
|
|
|
deactivate(transition) {
|
|
this.controllerFor("application").set("showTop", true);
|
|
|
|
if (this.adminSidebarStateManager.currentUserUsingAdminSidebar) {
|
|
if (!transition?.to.name.startsWith("admin")) {
|
|
this.adminSidebarStateManager.stopForcingAdminSidebar();
|
|
}
|
|
}
|
|
}
|
|
}
|