diff --git a/opentech/static_src/src/javascript/components/all-submissions-table.js b/opentech/static_src/src/javascript/components/all-submissions-table.js new file mode 100644 index 0000000000000000000000000000000000000000..e681e2e1567ab62304fe0c764973cf974dce0323 --- /dev/null +++ b/opentech/static_src/src/javascript/components/all-submissions-table.js @@ -0,0 +1,17 @@ +import $ from './../globals'; + +export default () => { + // 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', (e) => { + $(e.target).closest('.tr--parent').toggleClass('is-expanded'); + }); + }); +}; diff --git a/opentech/static_src/src/javascript/main.js b/opentech/static_src/src/javascript/main.js index fef9b3d499e7d1ab64dd1ab0590727200f6831f3..84364b5660a60e77cbcc9db009ae02e5878caa8a 100755 --- a/opentech/static_src/src/javascript/main.js +++ b/opentech/static_src/src/javascript/main.js @@ -7,6 +7,7 @@ import listInputFiles from './components/list-input-files'; import toggleActionsPanel from './components/toggle-actions-panel'; import activityFeed from './components/activity-feed'; import fancyboxGlobal from './components/fancybox-global'; +import allSubmissions from './components/all-submissions-table'; (function ($) { $(document).ready(function(){ @@ -41,19 +42,8 @@ import fancyboxGlobal from './components/fancybox-global'; // Activity feed functionality activityFeed(); - // 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'); - }); - }); + // Submissions overview table logic + allSubmissions(); // Allow click and drag scrolling within reviews table wrapper $('.js-reviews-table').attachDragger();