custom-index.js.es6 742 B

123456789101112131415161718192021222324252627282930
  1. export default Ember.Route.extend({
  2. beforeModel() {
  3. const appModel = this.modelFor('custom');
  4. if (appModel && appModel.permitted && !appModel.completed && appModel.start) {
  5. this.replaceWith('custom.step', appModel.start);
  6. }
  7. },
  8. model() {
  9. return this.modelFor('custom');
  10. },
  11. setupController(controller, model) {
  12. if (model) {
  13. const completed = model.get('completed');
  14. const permitted = model.get('permitted');
  15. const minTrust = model.get('min_trust');
  16. const wizardId = model.get('id');
  17. controller.setProperties({
  18. completed,
  19. notPermitted: !permitted,
  20. minTrust,
  21. wizardId
  22. });
  23. } else {
  24. controller.set('noWizard', true);
  25. }
  26. }
  27. });