Skip to content

Commit

Permalink
fix(search): Show date only if a certain input is selected #288
Browse files Browse the repository at this point in the history
Check, if only Historical Documents is checked and only then expand the
date widget.
  • Loading branch information
plutonik-a committed Nov 29, 2017
1 parent a5f0358 commit 0f8066d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion resources/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ $(document).ready(function() {
return sections.filter(':checked').size() === sections.size();
}

// Return all filters unchecked except for input "Historical Documents"
function allSelectedButDocuments() {
return sections.not(documentsInput).filter(':checked').size() === 0;
}

/**
* Toggle visibility of date component, if sections input "Historical Documents" is checked or not
*/
Expand All @@ -191,10 +196,11 @@ $(document).ready(function() {
});

function toggleDateComponent () {
if ( $( documentsInput ).is( ":checked" )) {
if (documentsInput.is( ":checked" ) && allSelectedButDocuments()) {
dateComponent.removeClass("hsg-hidden");
dateComponent.addClass("hsg-active");
s }

else {
dateComponent.addClass("hsg-hidden");
dateComponent.removeClass("hsg-active");
Expand Down

0 comments on commit 0f8066d

Please sign in to comment.