admin-wizard.js.es6 589 B

1234567891011121314151617181920212223
  1. import CustomWizard from '../models/custom-wizard';
  2. export default Discourse.Route.extend({
  3. model(params) {
  4. if (params.name === 'new') {
  5. this.set('new', true);
  6. return CustomWizard.create({ name: '', steps: []});
  7. }
  8. this.set('new', false);
  9. const wizard = this.modelFor('admin-wizards-custom').findBy('dasherizedName', params.name );
  10. if (!wizard) return this.transitionTo('adminWizardsCustom.index');
  11. return wizard;
  12. },
  13. setupController(controller, model) {
  14. controller.set("new", this.get('new'));
  15. controller.set("model", model);
  16. }
  17. });