1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/wizard/routes/custom-step.js.es6

24 Zeilen
569 B
Text

2017-10-13 15:02:34 +02:00
export default Ember.Route.extend({
model(params) {
const appModel = this.modelFor('custom');
const allSteps = appModel.steps;
if (allSteps) {
const step = allSteps.findBy('id', params.step_id);
return step ? step : allSteps[0];
};
2017-10-13 15:02:34 +02:00
return appModel;
},
afterModel(model) {
if (model.completed) return this.transitionTo('index');
return model.set("wizardId", this.modelFor('custom').id);
},
setupController(controller, step) {
controller.setProperties({
step, wizard: this.modelFor('custom')
});
}
});