discourse/app/assets/javascripts/wizard/controllers/application.js
Penar Musaraj 85b8fea262
UX: Add Styling step to wizard (#14132)
Refactors three wizard steps (colors, fonts, homepage style) into one new step called Styling.
2021-08-25 17:10:12 -04:00

26 lines
652 B
JavaScript

import Controller from "@ember/controller";
import { dasherize } from "@ember/string";
import discourseComputed from "discourse-common/utils/decorators";
export default Controller.extend({
currentStepId: null,
@discourseComputed("currentStepId")
showCanvas(currentStepId) {
return currentStepId === "finished";
},
@discourseComputed("model")
fontClasses(model) {
const fontsStep = model.steps.findBy("id", "styling");
if (!fontsStep) {
return [];
}
const fontField = fontsStep.get("fieldsById.body_font");
return fontField.choices.map(
(choice) => `body-font-${dasherize(choice.id)}`
);
},
});