Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 17:30:29 +01:00
32 Zeilen
682 B
JavaScript
32 Zeilen
682 B
JavaScript
import CustomWizardApi from '../models/custom-wizard-api';
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
export default DiscourseRoute.extend({
|
|
model() {
|
|
return CustomWizardApi.list();
|
|
},
|
|
|
|
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');
|
|
}
|
|
},
|
|
|
|
setupController(controller, model){
|
|
controller.set("model", model);
|
|
},
|
|
|
|
actions: {
|
|
refreshModel() {
|
|
this.refresh();
|
|
}
|
|
}
|
|
});
|