mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:23:43 +08:00
fcb4e5a1a1
Co-authored-by: David Taylor <david@taylorhq.com>
36 lines
801 B
JavaScript
36 lines
801 B
JavaScript
import Component from "@ember/component";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
import { action, set } from "@ember/object";
|
|
|
|
export default Component.extend({
|
|
init() {
|
|
this._super(...arguments);
|
|
|
|
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) {
|
|
return id === "color_scheme" ? "color-palettes" : "combo-box";
|
|
},
|
|
|
|
keyPress(e) {
|
|
e.stopPropagation();
|
|
},
|
|
|
|
@action
|
|
onChangeValue(value) {
|
|
this.set("field.value", value);
|
|
|
|
if (this.field.id === "homepage_style") {
|
|
this.wizard.trigger("homepageStyleChanged");
|
|
}
|
|
},
|
|
});
|