Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 01:10:28 +01:00
FIX: re-add logic incorrectly removed submissions logic during merge
Dieser Commit ist enthalten in:
Ursprung
072a3ea142
Commit
60abb6981e
1 geänderte Dateien mit 35 neuen und 5 gelöschten Zeilen
|
@ -9,15 +9,45 @@ export default DiscourseRoute.extend({
|
|||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
const fields = model.fields.map((f) => {
|
||||
const fieldsObject = EmberObject.create(f);
|
||||
fieldsObject.enabled = true;
|
||||
return fieldsObject;
|
||||
let fields = [
|
||||
EmberObject.create({ id: "username", label: "User", enabled: true }),
|
||||
];
|
||||
let submissions = [];
|
||||
|
||||
model.submissions.forEach((s) => {
|
||||
let submission = {
|
||||
username: s.user,
|
||||
};
|
||||
|
||||
Object.keys(s.fields).forEach((fieldId) => {
|
||||
if (!fields.some((field) => field.id === fieldId)) {
|
||||
fields.push(
|
||||
EmberObject.create({
|
||||
id: fieldId,
|
||||
label: s.fields[fieldId].label,
|
||||
enabled: true,
|
||||
})
|
||||
);
|
||||
}
|
||||
submission[fieldId] = s.fields[fieldId];
|
||||
});
|
||||
|
||||
submission["submitted_at"] = s.submitted_at;
|
||||
submissions.push(EmberObject.create(submission));
|
||||
});
|
||||
|
||||
let submittedAt = {
|
||||
id: "submitted_at",
|
||||
label: "Submitted At",
|
||||
enabled: true,
|
||||
};
|
||||
|
||||
fields.push(EmberObject.create(submittedAt));
|
||||
|
||||
controller.setProperties({
|
||||
wizard: model.wizard,
|
||||
fields: A(fields),
|
||||
submissions: A(model.submissions),
|
||||
submissions: A(submissions),
|
||||
total: model.total,
|
||||
});
|
||||
},
|
||||
|
|
Laden …
In neuem Issue referenzieren