custom-step.js.es6 569 B

1234567891011121314151617181920212223
  1. export default Ember.Route.extend({
  2. model(params) {
  3. const appModel = this.modelFor('custom');
  4. const allSteps = appModel.steps;
  5. if (allSteps) {
  6. const step = allSteps.findBy('id', params.step_id);
  7. return step ? step : allSteps[0];
  8. };
  9. return appModel;
  10. },
  11. afterModel(model) {
  12. if (model.completed) return this.transitionTo('index');
  13. return model.set("wizardId", this.modelFor('custom').id);
  14. },
  15. setupController(controller, step) {
  16. controller.setProperties({
  17. step, wizard: this.modelFor('custom')
  18. });
  19. }
  20. });