Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-14 13:52:54 +01:00
cf50a7deb3
* Apply prettier * applied prettier for similar-topics-validator Co-authored-by: Faizaan Gagan <fzngagan@gmail.com>
36 Zeilen
849 B
JavaScript
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,
|
|
});
|
|
}
|
|
},
|
|
});
|