-
Notifications
You must be signed in to change notification settings - Fork 442
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filters behaviors to dedicated assets
- Loading branch information
Showing
10 changed files
with
114 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
$(document).ready(function(){ | ||
function highlightSelectedFilters() { | ||
var filters = $('#filters .accordion .accordion-item'); | ||
filters.each(function() { | ||
var currentFilter = $(this); | ||
var selectedContentWrapper = currentFilter.find('.selected-content'); | ||
if (selectedContentWrapper.length > 0) { | ||
var anySelected = []; | ||
$(this).find('input').each(function() { | ||
if ($(this).is(':checked')) { | ||
anySelected.push($(this).next('label').html()); | ||
} | ||
}); | ||
if (anySelected.length > 0) { | ||
currentFilter.find('.selected-content').html(anySelected.join(', ')); | ||
} | ||
else { | ||
currentFilter.find('.selected-content').text(""); | ||
} | ||
} | ||
}); | ||
} | ||
highlightSelectedFilters(); | ||
|
||
function submitFilters() { | ||
$('#filter-form').submit(); | ||
$('#filters input').attr('disabled', 'disabled'); | ||
$('#requests-list').hide(); | ||
$('#requests-list-loading').removeClass('d-none'); | ||
} | ||
let submitFiltersTimeout; | ||
|
||
$(document).on('change keyup', '#filter-form input, #filter-form select', function() { | ||
highlightSelectedFilters(); | ||
$(window).clearTimeout(submitFiltersTimeout); | ||
submitFiltersTimeout = $(window).setTimeout(submitFilters, 2000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#filters { | ||
.accordion-item { | ||
.accordion-button { | ||
&.no-style { | ||
cursor: pointer; | ||
padding: 0; | ||
background: none; | ||
} | ||
&:focus { | ||
box-shadow: none; | ||
} | ||
&:not(.collapsed) { | ||
box-shadow: none; | ||
} | ||
&:hover { | ||
background-color: var(--bs-secondary-bg); | ||
} | ||
} | ||
|
||
.accordion-button { | ||
.selected-content { | ||
display: none; | ||
} | ||
} | ||
.accordion-button.collapsed { | ||
.selected-content { | ||
display: inline; | ||
} | ||
} | ||
|
||
.scroll-list-wrapper { | ||
overflow-y: scroll; | ||
max-height: 15rem; | ||
word-break: break-all; | ||
} | ||
} | ||
} | ||
|
||
|
||
@include media-breakpoint-up(md) { | ||
#filters.collapse { | ||
display: block !important; | ||
} | ||
} | ||
|
||
@include media-breakpoint-between(xs, md) { | ||
#filter-desktop { | ||
&.show { border-top: 1px solid $gray-300; } | ||
&.sticky-top { top: $top-navigation-height; } | ||
height: $notifications-filter-box-height; | ||
// To not overlap with the notification action bar | ||
z-index: calc(#{$zindex-sticky} + 1); | ||
|
||
#filters { | ||
max-height: 100vw; overflow: auto; | ||
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); | ||
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); | ||
box-shadow: 2px 3px 5px rgba(0,0,0,.2); | ||
} | ||
} | ||
|
||
@media (orientation: landscape) { | ||
#filters { max-height: 20vw; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters