mirror of
https://github.com/discourse/discourse.git
synced 2024-12-15 12:33:45 +08:00
27 lines
764 B
Plaintext
27 lines
764 B
Plaintext
|
import Component from "@ember/component";
|
||
|
import BufferedContent from "discourse/mixins/buffered-content";
|
||
|
import SettingComponent from "admin/mixins/setting-component";
|
||
|
|
||
|
export default Component.extend(BufferedContent, SettingComponent, {
|
||
|
layoutName: "admin/templates/components/site-setting",
|
||
|
|
||
|
_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;
|
||
|
});
|
||
|
}
|
||
|
});
|