DEV: Remove layoutName references to site-settings component template

This commit is contained in:
David Taylor 2023-02-13 10:53:15 +00:00
parent 076af132a1
commit b718e3fffc
3 changed files with 17 additions and 27 deletions

View File

@ -1,12 +1,9 @@
import BufferedContent from "discourse/mixins/buffered-content"; import SiteSettingComponent from "./site-setting";
import Component from "@ember/component";
import SettingComponent from "admin/mixins/setting-component";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { url } from "discourse/lib/computed"; import { url } from "discourse/lib/computed";
export default Component.extend(BufferedContent, SettingComponent, { export default class extends SiteSettingComponent {
layoutName: "admin/templates/components/site-setting", @url("model.id", "/admin/themes/%@/setting") updateUrl;
updateUrl: url("model.id", "/admin/themes/%@/setting"),
_save() { _save() {
return ajax(this.updateUrl, { return ajax(this.updateUrl, {
@ -16,5 +13,5 @@ export default Component.extend(BufferedContent, SettingComponent, {
value: this.get("buffered.value"), value: this.get("buffered.value"),
}, },
}); });
}, }
}); }

View File

@ -1,15 +1,11 @@
import BufferedContent from "discourse/mixins/buffered-content"; import SiteSettingComponent from "./site-setting";
import Component from "@ember/component";
import SettingComponent from "admin/mixins/setting-component";
export default Component.extend(BufferedContent, SettingComponent, {
layoutName: "admin/templates/components/site-setting",
export default class ThemeSettingRelativesSelectorComponent extends SiteSettingComponent {
_save() { _save() {
return this.model return this.model
.save({ [this.setting.setting]: this.convertNamesToIds() }) .save({ [this.setting.setting]: this.convertNamesToIds() })
.then(() => this.store.findAll("theme")); .then(() => this.store.findAll("theme"));
}, }
convertNamesToIds() { convertNamesToIds() {
return this.get("buffered.value") return this.get("buffered.value")
@ -23,5 +19,5 @@ export default Component.extend(BufferedContent, SettingComponent, {
} }
return themeName; return themeName;
}); });
}, }
}); }

View File

@ -1,18 +1,15 @@
import BufferedContent from "discourse/mixins/buffered-content"; import SiteSettingComponent from "./site-setting";
import Component from "@ember/component";
import SettingComponent from "admin/mixins/setting-component";
import { alias } from "@ember/object/computed"; import { alias } from "@ember/object/computed";
export default Component.extend(BufferedContent, SettingComponent, { export default class ThemeTranslation extends SiteSettingComponent {
layoutName: "admin/templates/components/site-setting", @alias("translation") setting;
setting: alias("translation"), type = "string";
type: "string", @alias("translation.key") settingName;
settingName: alias("translation.key"),
_save() { _save() {
return this.model.saveTranslation( return this.model.saveTranslation(
this.get("translation.key"), this.get("translation.key"),
this.get("buffered.value") this.get("buffered.value")
); );
}, }
}); }