mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 10:36:18 +08:00
99d22c85ae
This commit ensures that additional keywords for admin sidebar links (which are also stored in the admin sidebar state manager) are translated with I18n, which was discussed in https://meta.discourse.org/t/introducing-experimental-admin-sidebar-navigation/289281/58?u=martin This also changes the admin sidebar state manager keywords to not be a TrackedObject -- this is not necessary as keywords are only set once, and it was causing rendering issues because the keywords were being set at the same time they were read. Finally this adds a "theme" keyword to the "Components" link because we often refer to components as Theme Components Co-authored-by: Jarek Radosz <jradosz@gmail.com>
39 lines
1000 B
JavaScript
39 lines
1000 B
JavaScript
import { tracked } from "@glimmer/tracking";
|
|
import { service } from "@ember/service";
|
|
import { 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 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.sidebarState.setPanel(MAIN_PANEL);
|
|
}
|
|
}
|
|
}
|
|
}
|