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-wizard-submissions.js.es6
Angus McLeod 11953055fd various
2017-11-01 17:50:03 +08:00

29 Zeilen
647 B
JavaScript

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