mirror of
https://github.com/discourse/discourse.git
synced 2024-12-11 22:04:03 +08:00
ef99b97ea7
Why this change? Previously, we were preloading the necessary metadata for `adminCustomizeThemes.show.schema` route in the `adminCustomizeThemes.show` route. This is wasteful because we're loading data upfront when the objects setting editor may not be used. This change also lays the ground work for a future commit where we need to be shipping down additional metadata which may further add to the payload.
35 lines
846 B
JavaScript
35 lines
846 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 setting.loadMetadata(theme.id).then(() => {
|
|
return {
|
|
theme,
|
|
setting,
|
|
};
|
|
});
|
|
}
|
|
|
|
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
|
|
);
|
|
}
|
|
}
|