0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-24 10:20:28 +01:00
discourse-custom-wizard/assets/javascripts/discourse/routes/admin-wizards-submissions-show.js
2024-11-22 16:45:50 +01:00

30 Zeilen
791 B
JavaScript

import { A } from "@ember/array";
import CustomWizardAdmin from "../models/custom-wizard-admin";
import DiscourseRoute from "discourse/routes/discourse";
import { formatModel } from "../lib/wizard-submission";
import { inject as service } from "@ember/service";
export default DiscourseRoute.extend({
router: service(),
model(params) {
return CustomWizardAdmin.submissions(params.wizardId);
},
afterModel(model) {
if (model === null) {
return this.router.transitionTo("adminWizardsSubmissions");
}
},
setupController(controller, model) {
const { fields, submissions } = formatModel(model);
controller.setProperties({
wizard: model.wizard,
fields: A(fields),
submissions: A(submissions),
total: model.total,
});
},
});