2023-02-13 18:53:15 +08:00
|
|
|
import SiteSettingComponent from "./site-setting";
|
2019-11-28 13:19:01 +08:00
|
|
|
|
2023-02-13 18:53:15 +08:00
|
|
|
export default class ThemeSettingRelativesSelectorComponent extends SiteSettingComponent {
|
2019-11-28 13:19:01 +08:00
|
|
|
_save() {
|
|
|
|
return this.model
|
|
|
|
.save({ [this.setting.setting]: this.convertNamesToIds() })
|
|
|
|
.then(() => this.store.findAll("theme"));
|
2023-02-13 18:53:15 +08:00
|
|
|
}
|
2019-11-28 13:19:01 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
});
|
2023-02-13 18:53:15 +08:00
|
|
|
}
|
|
|
|
}
|