From b718e3fffc9f709b262c1e06dae2d6b357c7d26d Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 13 Feb 2023 10:53:15 +0000 Subject: [PATCH] DEV: Remove layoutName references to site-settings component template --- .../addon/components/theme-setting-editor.js | 13 +++++-------- .../theme-setting-relatives-selector.js | 14 +++++--------- .../admin/addon/components/theme-translation.js | 17 +++++++---------- 3 files changed, 17 insertions(+), 27 deletions(-) diff --git a/app/assets/javascripts/admin/addon/components/theme-setting-editor.js b/app/assets/javascripts/admin/addon/components/theme-setting-editor.js index 8ceaf32bbb6..1982145c03c 100644 --- a/app/assets/javascripts/admin/addon/components/theme-setting-editor.js +++ b/app/assets/javascripts/admin/addon/components/theme-setting-editor.js @@ -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"), }, }); - }, -}); + } +} diff --git a/app/assets/javascripts/admin/addon/components/theme-setting-relatives-selector.js b/app/assets/javascripts/admin/addon/components/theme-setting-relatives-selector.js index 4f02a147688..02c7c84b335 100644 --- a/app/assets/javascripts/admin/addon/components/theme-setting-relatives-selector.js +++ b/app/assets/javascripts/admin/addon/components/theme-setting-relatives-selector.js @@ -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; }); - }, -}); + } +} diff --git a/app/assets/javascripts/admin/addon/components/theme-translation.js b/app/assets/javascripts/admin/addon/components/theme-translation.js index 7a598db1c82..3204a8bdfa0 100644 --- a/app/assets/javascripts/admin/addon/components/theme-translation.js +++ b/app/assets/javascripts/admin/addon/components/theme-translation.js @@ -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") ); - }, -}); + } +}