2023-02-13 05:53:15 -05:00
|
|
|
import SiteSettingComponent from "./site-setting";
|
2023-06-19 10:37:43 -04:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
|
|
|
import { url } from "discourse/lib/computed";
|
2019-10-30 16:28:29 -04:00
|
|
|
import { alias } from "@ember/object/computed";
|
2018-03-04 19:04:23 -05:00
|
|
|
|
2023-02-13 05:53:15 -05:00
|
|
|
export default class ThemeTranslation extends SiteSettingComponent {
|
|
|
|
@alias("translation") setting;
|
|
|
|
@alias("translation.key") settingName;
|
2023-06-19 10:37:43 -04:00
|
|
|
@url("model.id", "/admin/themes/%@") updateUrl;
|
2019-01-17 06:46:11 -05:00
|
|
|
|
2023-02-23 10:32:53 -05:00
|
|
|
type = "string";
|
|
|
|
|
2018-03-04 19:04:23 -05:00
|
|
|
_save() {
|
2023-06-19 10:37:43 -04:00
|
|
|
const translations = {
|
|
|
|
[this.get("translation.key")]: this.get("buffered.value"),
|
|
|
|
};
|
|
|
|
|
|
|
|
return ajax(this.updateUrl, {
|
|
|
|
type: "PUT",
|
2023-06-27 14:27:32 -04:00
|
|
|
data: { theme: { translations } },
|
2023-06-19 10:37:43 -04:00
|
|
|
});
|
2023-02-13 05:53:15 -05:00
|
|
|
}
|
|
|
|
}
|