2017-10-22 05:37:58 +02:00
|
|
|
import CustomWizard from '../models/custom-wizard';
|
|
|
|
|
2017-10-05 02:36:46 +02:00
|
|
|
export default Discourse.Route.extend({
|
|
|
|
model(params) {
|
2017-11-01 10:50:03 +01:00
|
|
|
return CustomWizard.submissions(params.wizard_id);
|
2017-10-05 02:36:46 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
setupController(controller, model) {
|
2017-11-01 10:50:03 +01:00
|
|
|
let fields = [];
|
|
|
|
model.forEach((s) => {
|
|
|
|
Object.keys(s).forEach((k) => {
|
|
|
|
if (fields.indexOf(k) < 0) {
|
|
|
|
fields.push(k);
|
|
|
|
}
|
|
|
|
});
|
2017-10-30 07:24:51 +01:00
|
|
|
});
|
|
|
|
|
2017-11-01 10:50:03 +01:00
|
|
|
let submissions = [];
|
|
|
|
model.forEach((s) => {
|
|
|
|
let submission = {};
|
|
|
|
fields.forEach((f) => {
|
|
|
|
submission[f] = s[f];
|
|
|
|
});
|
|
|
|
submissions.push(submission);
|
2017-10-30 07:24:51 +01:00
|
|
|
});
|
2017-11-01 10:50:03 +01:00
|
|
|
|
|
|
|
controller.setProperties({ submissions, fields });
|
2017-10-05 02:36:46 +02:00
|
|
|
}
|
|
|
|
});
|