2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2021-08-25 17:10:12 -04:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
|
|
import { set } from "@ember/object";
|
2020-10-05 13:40:41 -04:00
|
|
|
|
2019-10-23 12:30:52 -04:00
|
|
|
export default Component.extend({
|
2021-08-25 17:10:12 -04:00
|
|
|
init(...args) {
|
|
|
|
this._super(...args);
|
|
|
|
|
|
|
|
if (this.field.id === "color_scheme") {
|
|
|
|
for (let choice of this.field.choices) {
|
|
|
|
if (choice?.data?.colors) {
|
|
|
|
set(choice, "colors", choice.data.colors);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
@discourseComputed("field.id")
|
|
|
|
componentName(id) {
|
|
|
|
if (id === "color_scheme") {
|
|
|
|
return "color-palettes";
|
|
|
|
}
|
|
|
|
return "combo-box";
|
|
|
|
},
|
|
|
|
|
2018-09-05 08:40:38 -04:00
|
|
|
keyPress(e) {
|
|
|
|
e.stopPropagation();
|
|
|
|
},
|
2021-08-25 17:10:12 -04:00
|
|
|
|
|
|
|
actions: {
|
|
|
|
onChangeValue(value) {
|
|
|
|
this.set("field.value", value);
|
2022-06-04 12:04:00 -04:00
|
|
|
|
|
|
|
if (this.field.id === "homepage_style") {
|
|
|
|
this.wizard.trigger("homepageStyleChanged");
|
|
|
|
}
|
2021-08-25 17:10:12 -04:00
|
|
|
},
|
|
|
|
},
|
2018-09-05 08:40:38 -04:00
|
|
|
});
|