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:
Ursprung
0bc151fc7b
Commit
280d2ffe54
1 geänderte Dateien mit 13 neuen und 9 gelöschten Zeilen
|
@ -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: {
|
||||
|
|
Laden …
In neuem Issue referenzieren