mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Add theme-components route for admin (#24264)
This commit adds an /admin/customize/theme-components route, that opens the theme page with the components tab pre-selected, so people can navigate to that directly.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import Route from "@ember/routing/route";
|
||||
import { inject as service } from "@ember/service";
|
||||
import { COMPONENTS } from "admin/models/theme";
|
||||
|
||||
export default class AdminCustomizeThemeComponents extends Route {
|
||||
@service router;
|
||||
|
||||
beforeModel(transition) {
|
||||
transition.abort();
|
||||
this.router.transitionTo("adminCustomizeThemes", {
|
||||
queryParams: { tab: COMPONENTS },
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@ export default class AdminCustomizeThemesRoute extends Route {
|
||||
queryParams = {
|
||||
repoUrl: null,
|
||||
repoName: null,
|
||||
tab: null,
|
||||
};
|
||||
|
||||
model() {
|
||||
@@ -21,7 +22,17 @@ export default class AdminCustomizeThemesRoute extends Route {
|
||||
|
||||
setupController(controller, model) {
|
||||
super.setupController(controller, model);
|
||||
controller.set("editingTheme", false);
|
||||
|
||||
if (controller.tab) {
|
||||
controller.setProperties({
|
||||
editingTheme: false,
|
||||
currentTab: controller.tab,
|
||||
|
||||
// this is to get rid of the queryString since we don't want it hanging around
|
||||
tab: undefined,
|
||||
});
|
||||
}
|
||||
|
||||
if (controller.repoUrl) {
|
||||
next(() => {
|
||||
this.modal.show(InstallThemeModal, {
|
||||
|
||||
@@ -58,6 +58,11 @@ export default function () {
|
||||
}
|
||||
);
|
||||
|
||||
this.route("adminCustomizeThemeComponents", {
|
||||
path: "theme-components",
|
||||
resetNamespace: true,
|
||||
});
|
||||
|
||||
this.route(
|
||||
"adminSiteText",
|
||||
{ path: "/site_texts", resetNamespace: true },
|
||||
|
||||
Reference in New Issue
Block a user