2019-05-30 07:04:34 +02:00
|
|
|
import CustomWizardApi from '../models/custom-wizard-api';
|
2020-03-21 18:30:11 +01:00
|
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
2019-05-30 07:04:34 +02:00
|
|
|
|
2020-03-21 18:30:11 +01:00
|
|
|
export default DiscourseRoute.extend({
|
2019-05-30 07:04:34 +02:00
|
|
|
model() {
|
|
|
|
return CustomWizardApi.list();
|
|
|
|
},
|
|
|
|
|
2019-06-02 12:54:31 +02:00
|
|
|
afterModel(model) {
|
|
|
|
const apiParams = this.paramsFor('admin-wizards-api');
|
|
|
|
|
|
|
|
if (model.length) {
|
|
|
|
if (!apiParams.name) {
|
|
|
|
this.transitionTo('adminWizardsApi', model[0].name.dasherize());
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.transitionTo('adminWizardsApi', 'new');
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2019-05-30 07:04:34 +02:00
|
|
|
setupController(controller, model){
|
|
|
|
controller.set("model", model);
|
2019-06-02 12:54:31 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
refreshModel() {
|
|
|
|
this.refresh();
|
|
|
|
}
|
2019-05-30 07:04:34 +02:00
|
|
|
}
|
|
|
|
});
|