0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-09-20 07:41:11 +02:00
discourse-custom-wizard/assets/javascripts/discourse/routes/admin-wizard.js.es6
Angus McLeod 3fa2735c63 various
2017-09-25 22:47:40 +08:00

23 Zeilen
588 B
JavaScript

import CustomWizard from '../models/custom-wizard';
export default Discourse.Route.extend({
model(params) {
if (params.name === 'new') {
this.set('new', true);
return CustomWizard.create({ name: '', steps: []});
}
this.set('new', false);
const wizard = this.modelFor('admin-wizards-custom').findBy('dasherizedName', params.name);
if (!wizard) return this.transitionTo('adminWizardsCustom.index');
return wizard;
},
setupController(controller, model) {
controller.set("new", this.get('new'));
controller.set("model", model);
}
});