0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-15 22:32:54 +01:00
discourse-custom-wizard/assets/javascripts/discourse/routes/admin-wizards-submissions-show.js.es6
2021-02-24 18:43:35 +11:00

36 Zeilen
849 B
JavaScript

import CustomWizard from "../models/custom-wizard";
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
model(params) {
return CustomWizard.submissions(params.wizardId);
},
setupController(controller, model) {
if (model.submissions) {
let fields = [];
model.submissions.forEach((s) => {
Object.keys(s).forEach((k) => {
if (fields.indexOf(k) < 0) {
fields.push(k);
}
});
});
let submissions = [];
model.submissions.forEach((s) => {
let submission = {};
fields.forEach((f) => {
submission[f] = s[f];
});
submissions.push(submission);
});
controller.setProperties({
wizard: model.wizard,
submissions,
fields,
});
}
},
});