mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 06:30:15 +08:00
85b8fea262
Refactors three wizard steps (colors, fonts, homepage style) into one new step called Styling.
37 lines
789 B
JavaScript
37 lines
789 B
JavaScript
import Component from "@ember/component";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
import { set } from "@ember/object";
|
|
|
|
export default Component.extend({
|
|
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";
|
|
},
|
|
|
|
keyPress(e) {
|
|
e.stopPropagation();
|
|
},
|
|
|
|
actions: {
|
|
onChangeValue(value) {
|
|
this.set("field.value", value);
|
|
this.stylingDropdownChanged(this.field.id, value);
|
|
},
|
|
},
|
|
});
|