mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 07:51:36 +08:00
24 lines
621 B
JavaScript
24 lines
621 B
JavaScript
import SiteSettingComponent from "./site-setting";
|
|
|
|
export default class ThemeSettingRelativesSelectorComponent extends SiteSettingComponent {
|
|
_save() {
|
|
return this.model
|
|
.save({ [this.setting.setting]: this.convertNamesToIds() })
|
|
.then(() => this.store.findAll("theme"));
|
|
}
|
|
|
|
convertNamesToIds() {
|
|
return this.get("buffered.value")
|
|
.split("|")
|
|
.filter(Boolean)
|
|
.map((themeName) => {
|
|
if (themeName !== "") {
|
|
return this.setting.allThemes.find(
|
|
(theme) => theme.name === themeName
|
|
).id;
|
|
}
|
|
return themeName;
|
|
});
|
|
}
|
|
}
|