mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-14 23:27:06 +08:00
Fixed the refs to the `setting` argument and refactored more of the component over to glimmer style, added test against regression
26 lines
631 B
JavaScript
26 lines
631 B
JavaScript
import { ajax } from "discourse/lib/ajax";
|
|
import getURL from "discourse/lib/get-url";
|
|
import SiteSettingComponent from "./site-setting";
|
|
|
|
export default class ThemeTranslation extends SiteSettingComponent {
|
|
type = "string";
|
|
|
|
get setting() {
|
|
return this.args.translation;
|
|
}
|
|
|
|
get settingName() {
|
|
return this.args.translation.key;
|
|
}
|
|
|
|
_save() {
|
|
const translations = {
|
|
[this.args.translation.key]: this.buffered.get("value"),
|
|
};
|
|
|
|
return ajax(getURL(`/admin/themes/${this.args.model.id}`), {
|
|
type: "PUT",
|
|
data: { theme: { translations, locale: this.args.model.locale } },
|
|
});
|
|
}
|
|
}
|