mirror of
https://github.com/discourse/discourse.git
synced 2025-03-02 08:36:40 +08:00

Fixes an issue where saving a theme translation would reset unsaved changes made to other theme translations. Also cleans up unused `saveSettings` and `saveTranslations` actions. Co-authored-by: Jarek Radosz <jradosz@gmail.com>
24 lines
619 B
JavaScript
24 lines
619 B
JavaScript
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() {
|
|
const translations = {
|
|
[this.get("translation.key")]: this.get("buffered.value"),
|
|
};
|
|
|
|
return ajax(this.updateUrl, {
|
|
type: "PUT",
|
|
data: { theme: translations },
|
|
});
|
|
}
|
|
}
|