From e39da9464a2865fd5b7714e47d6e28c4ac659d15 Mon Sep 17 00:00:00 2001 From: Chris Lawton <chris.lawton@torchbox.com> Date: Wed, 21 Mar 2018 11:34:05 +0000 Subject: [PATCH] toggle show/hiding of child table rows --- opentech/static_src/src/javascript/main.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/opentech/static_src/src/javascript/main.js b/opentech/static_src/src/javascript/main.js index bda8806fd..e06d6fb33 100755 --- a/opentech/static_src/src/javascript/main.js +++ b/opentech/static_src/src/javascript/main.js @@ -74,6 +74,18 @@ import '@fancyapps/fancybox'; // Add <tr> toggle arrow $('.tr--parent td.title').prepend('<span class="js-tr-toggle arrow"></span>'); + + // Toggle show/hide for submissions overview table rows + const children = Array.prototype.slice.call( + document.querySelectorAll('.js-tr-toggle') + ); + + children.forEach(function (child) { + child.addEventListener('click', function (e) { + $(e.target).closest('.tr--parent').toggleClass('is-expanded'); + }); + }); + }); // Add active class to filters - dropdowns are dynamically appended to the dom, -- GitLab