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

View File

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

View File

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