1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/routes/admin-wizard.js.es6

22 Zeilen
562 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.wizard_id === 'new') {
2017-09-23 04:34:07 +02:00
this.set('new', true);
return CustomWizard.create();
2017-09-23 04:34:07 +02:00
}
this.set('new', false);
const wizard = this.modelFor('admin-wizards-custom').findBy('id', params.wizard_id);
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);
}
});