2020-05-14 05:42:11 +02:00
|
|
|
import I18n from "I18n";
|
|
|
|
|
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-09-29 13:27:03 +02:00
|
|
|
|
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);
|
|
|
|
},
|
|
|
|
|
2019-07-02 06:49:14 +02:00
|
|
|
setupController(controller, model) {
|
|
|
|
let props = {
|
|
|
|
step: model,
|
|
|
|
wizard: this.modelFor('custom')
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!model.permitted) {
|
|
|
|
props['stepMessage'] = {
|
|
|
|
state: 'not-permitted',
|
2019-07-27 09:01:29 +02:00
|
|
|
text: model.permitted_message || I18n.t('wizard.step_not_permitted')
|
2019-07-02 06:49:14 +02:00
|
|
|
};
|
2019-07-27 09:01:29 +02:00
|
|
|
if (model.index > 0) {
|
|
|
|
props['showReset'] = true;
|
|
|
|
}
|
2019-07-02 06:49:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
controller.setProperties(props);
|
2017-10-13 15:02:34 +02:00
|
|
|
}
|
|
|
|
});
|