discourse/app/assets/javascripts/wizard/addon/routes/wizard-step.js
Jarek Radosz fcb4e5a1a1
DEV: Make wizard an ember addon (#17027)
Co-authored-by: David Taylor <david@taylorhq.com>
2022-06-17 14:50:21 +02:00

18 lines
466 B
JavaScript

import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model(params) {
const allSteps = this.modelFor("wizard").steps;
const step = allSteps.findBy("id", params.step_id);
return step || allSteps[0];
},
setupController(controller, step) {
const wizard = this.modelFor("wizard");
this.controllerFor("wizard").set("currentStepId", step.id);
controller.setProperties({ step, wizard });
},
});