0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 17:30:29 +01:00
discourse-custom-wizard/assets/javascripts/discourse/routes/admin-wizards-submissions-show.js.es6

31 Zeilen
791 B
Text

2021-07-14 08:04:19 +02:00
import { A } from "@ember/array";
2022-07-27 12:47:50 +02:00
import CustomWizardAdmin from "../models/custom-wizard-admin";
import DiscourseRoute from "discourse/routes/discourse";
import { formatModel } from "../lib/wizard-submission";
2023-09-14 15:47:52 +02:00
import { inject as service } from "@ember/service";
2020-03-21 18:30:11 +01:00
export default DiscourseRoute.extend({
2023-09-14 15:42:12 +02:00
router: service(),
2017-10-05 02:36:46 +02:00
model(params) {
2022-07-27 12:47:50 +02:00
return CustomWizardAdmin.submissions(params.wizardId);
2017-10-05 02:36:46 +02:00
},
afterModel(model) {
if (model === null) {
2023-09-14 15:42:12 +02:00
return this.router.transitionTo("adminWizardsSubmissions");
}
},
2017-10-05 02:36:46 +02:00
setupController(controller, model) {
2022-10-05 17:20:25 +02:00
const { fields, submissions } = formatModel(model);
2021-07-14 08:04:19 +02:00
controller.setProperties({
wizard: model.wizard,
fields: A(fields),
submissions: A(submissions),
2021-07-14 08:05:13 +02:00
total: model.total,
2021-07-14 08:04:19 +02:00
});
},
2017-10-05 02:36:46 +02:00
});