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

36 Zeilen
853 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
});
}
}
});