mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 19:08:33 +08:00
This builds onto #32013 in two major ways: - Unsaved changes are now persisted when you browse categories inside "All site settings". - If you're about to navigate away (and lose edits) you will be prompted if you want to save or discard changes. (This applies to individual category site setting pages as well.
27 lines
711 B
JavaScript
Vendored
27 lines
711 B
JavaScript
Vendored
import { ajax } from "discourse/lib/ajax";
|
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
|
import SiteSetting from "admin/models/site-setting";
|
|
|
|
export default class ThemeSettings extends SiteSetting {
|
|
updateSetting(themeId, newValue) {
|
|
if (this.objects_schema) {
|
|
newValue = JSON.stringify(newValue);
|
|
}
|
|
|
|
return ajax(`/admin/themes/${themeId}/setting`, {
|
|
type: "PUT",
|
|
data: {
|
|
name: this.setting,
|
|
value: newValue,
|
|
},
|
|
});
|
|
}
|
|
|
|
loadMetadata(themeId) {
|
|
return ajax(
|
|
`/admin/themes/${themeId}/objects_setting_metadata/${this.setting}.json`
|
|
)
|
|
.then((result) => this.set("metadata", result))
|
|
.catch(popupAjaxError);
|
|
}
|
|
}
|