0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-10 12:22:54 +01:00
discourse-custom-wizard/assets/javascripts/discourse/routes/admin-wizard.js.es6

24 Zeilen
588 B
Text

2017-09-23 04:34:07 +02:00
import CustomWizard from '../models/custom-wizard';
export default Discourse.Route.extend({
model(params) {
if (params.name === 'new') {
this.set('new', true);
2017-09-24 05:01:18 +02:00
return CustomWizard.create({ name: '', steps: []});
2017-09-23 04:34:07 +02:00
}
this.set('new', false);
2017-09-25 16:47:40 +02:00
const wizard = this.modelFor('admin-wizards-custom').findBy('dasherizedName', params.name);
2017-09-23 04:34:07 +02:00
2017-09-24 05:01:18 +02:00
if (!wizard) return this.transitionTo('adminWizardsCustom.index');
2017-09-23 04:34:07 +02:00
return wizard;
},
setupController(controller, model) {
controller.set("new", this.get('new'));
controller.set("model", model);
}
});