mirror of
https://github.com/discourse/discourse.git
synced 2025-02-12 12:57:15 +08:00
![Alan Guo Xiang Tan](/assets/img/avatar_default.png)
Why this change? The `/admin/customize/themes/:id/schema/name` route is a work in progress but we want to be able to start navigating to it from the `/admin/customize/themes/:id` route. What does this change do? 1. Move `adminCustomizeThemes.schema` to a child route of `adminCustomizeThemes.show`. This is because we need the model from the parent route and if it isn't a child route we end up having to load the theme model again from the server. 1. Add the `objects_schema` attribute to `ThemeSettingsSerializer` 1. Refactor `SiteSettingComponent` to be able to render a button so that we don't have to hardcode the button rendering into the `SiteSettings::String` component
33 lines
812 B
JavaScript
33 lines
812 B
JavaScript
import Route from "@ember/routing/route";
|
|
|
|
export default class AdminCustomizeThemesShowSchemaRoute extends Route {
|
|
model(params) {
|
|
const theme = this.modelFor("adminCustomizeThemesShow");
|
|
const setting = theme.settings.findBy("setting", params.setting_name);
|
|
|
|
return {
|
|
data: setting.value,
|
|
schema: setting.objects_schema,
|
|
};
|
|
}
|
|
|
|
setupController() {
|
|
super.setupController(...arguments);
|
|
this.controllerFor("adminCustomizeThemes").set("editingTheme", true);
|
|
|
|
this.controllerFor("adminCustomizeThemes.show").set(
|
|
"editingThemeSetting",
|
|
true
|
|
);
|
|
}
|
|
|
|
deactivate() {
|
|
this.controllerFor("adminCustomizeThemes").set("editingTheme", false);
|
|
|
|
this.controllerFor("adminCustomizeThemes.show").set(
|
|
"editingThemeSetting",
|
|
false
|
|
);
|
|
}
|
|
}
|