0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-14 05:52:52 +01:00
discourse-custom-wizard/assets/javascripts/wizard/routes/custom-step.js.es6
Angus McLeod e859e3efa2 various
2017-10-13 21:02:34 +08:00

23 Zeilen
569 B
JavaScript

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];
};
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')
});
}
});