0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

IMPROVE: Make edit columns adjust submissions as well

Dieser Commit ist enthalten in:
Keegan George 2021-08-31 13:29:30 -07:00
Ursprung 0bc151fc7b
Commit 280d2ffe54

Datei anzeigen

@ -31,16 +31,20 @@ export default Controller.extend({
@discourseComputed('submissions', 'fields.@each.enabled')
displaySubmissions(submissions, fields) {
return submissions.map(submission => {
let field = fields.find(f => Object.keys(submission).includes(f.id));
if (!field.enabled) {
// insert field / submission deletion code here:
console.log(field, "is not enabled for ", submission);
} else if (field.enabled) {
console.log(field, "is enabled for ", submission);
let result = [];
submissions.forEach(submission => {
let sub = {};
Object.keys(submission).forEach(fieldId => {
if (fields.some(f => f.id === fieldId && f.enabled)) {
sub[fieldId] = submission[fieldId];
}
return submission;
});
result.push(sub);
});
return result;
},
actions: {