From 03fb7b7adab3780fc0860ed8da27cc144861095c Mon Sep 17 00:00:00 2001 From: angusmcleod Date: Wed, 25 Aug 2021 09:59:24 +0800 Subject: [PATCH] WIP: update field data handling to support column toggling --- .../admin-wizards-submissions-show.js.es6 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 b/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 index 6352b3b2..28a1c825 100644 --- a/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 +++ b/assets/javascripts/discourse/controllers/admin-wizards-submissions-show.js.es6 @@ -24,6 +24,18 @@ export default Controller.extend({ this.set("loadingMore", false); }); }, + + + @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) { + submission.delete(field.id); + }; + return submission; + }); + }, actions: { loadMore() {