1
0
Fork 0
discourse-custom-wizard-unl.../assets/javascripts/discourse/routes/admin-wizards-submissions-show.js.es6
Angus McLeod cf50a7deb3
Apply prettier 💄 (#80)
* Apply prettier

* applied prettier for similar-topics-validator

Co-authored-by: Faizaan Gagan <fzngagan@gmail.com>
2021-03-28 14:36:49 +05:30

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,
});
}
},
});