diff --git a/app/assets/javascripts/admin/addon/components/theme-translation.js b/app/assets/javascripts/admin/addon/components/theme-translation.js index eac13fd2126..3bb229ed16a 100644 --- a/app/assets/javascripts/admin/addon/components/theme-translation.js +++ b/app/assets/javascripts/admin/addon/components/theme-translation.js @@ -1,16 +1,23 @@ import SiteSettingComponent from "./site-setting"; +import { ajax } from "discourse/lib/ajax"; +import { url } from "discourse/lib/computed"; import { alias } from "@ember/object/computed"; export default class ThemeTranslation extends SiteSettingComponent { @alias("translation") setting; @alias("translation.key") settingName; + @url("model.id", "/admin/themes/%@") updateUrl; type = "string"; _save() { - return this.model.saveTranslation( - this.get("translation.key"), - this.get("buffered.value") - ); + const translations = { + [this.get("translation.key")]: this.get("buffered.value"), + }; + + return ajax(this.updateUrl, { + type: "PUT", + data: { theme: translations }, + }); } } diff --git a/app/assets/javascripts/admin/addon/models/theme.js b/app/assets/javascripts/admin/addon/models/theme.js index a4b7d6b64b5..83d96dddffc 100644 --- a/app/assets/javascripts/admin/addon/models/theme.js +++ b/app/assets/javascripts/admin/addon/models/theme.js @@ -309,16 +309,6 @@ class Theme extends RestModel { .finally(() => this.set("changed", false)) .catch(popupAjaxError); } - - saveSettings(name, value) { - const settings = {}; - settings[name] = value; - return this.save({ settings }); - } - - saveTranslation(name, value) { - return this.save({ translations: { [name]: value } }); - } } export default Theme;