diff --git a/site/static/js/filter_orgs.js b/site/static/js/filter_orgs.js index 8ac457b..8667d3f 100644 --- a/site/static/js/filter_orgs.js +++ b/site/static/js/filter_orgs.js @@ -26,6 +26,13 @@ function selectOrgType(type) { li_orgs[i].style.display = "inline-block"; } } + + // Hide the 'expand' arrow if there is no need for it + if (countOrgsToDisplay(li_orgs, type) < 27) { + document.getElementsByClassName('expand')[0].style.visibility = 'hidden'; + } else { + document.getElementsByClassName('expand')[0].style.visibility = 'visible'; + } } function showAllOrgs() { @@ -35,3 +42,9 @@ function showAllOrgs() { li_orgs[i].style.display = "inline-block"; } } + +function countOrgsToDisplay(orgs, type) { + return Array.from(orgs).filter(function(element) { + return element.getAttribute('orgtype') === type; + }).length; +}