Working "tous" filter for tags

This commit is contained in:
Théo Marchal 2021-03-06 14:05:04 +01:00
parent 34e8fe9b12
commit 25a09015d1
2 changed files with 22 additions and 3 deletions

View File

@ -109,8 +109,7 @@
<div class="item-cont">
<span><input type="checkbox" id="tags" name="tags" value="all">
<label for="tags">Tous</label></span>
<span><span class="inline">&#x203B;&nbsp;</span><select name="tag"></select></span>
<div class="generated"></div>
<span class="first"><span class="inline">&#x203B;&nbsp;</span><select name="tag"></select></span>
</div>
</div>
<div class="box dimensions">

View File

@ -237,6 +237,26 @@ jQuery(document).ready(function($)
// handle tags
function handleTags()
{
$('input[name="tags"]').change(function()
{
params["tag"] = []; // remove filter
if (this.checked)
{
$('select[name="tag"] option[value=""]').prop('selected', true);
$('select[name="tag"]').attr('disabled', 'disabled');
$(".box.tags span:not(.first) select").parent().remove();
}
else
$('select[name="tag"]').removeAttr('disabled');
selectedOptions = gatherURLdata();
data = originalData;
filterData(selectedOptions);
availableOptions = [];
availableOptions = gatherData();
updateMenu(availableOptions);
});
$('.box.tags .item-cont').delegate('select[name="tag"]', 'change', function()
{
params.tag = []; // collect all tags from all dropdowns
@ -344,7 +364,7 @@ jQuery(document).ready(function($)
filterData(selectedOptions);
availableOptions = [];
availableOptions = gatherData();
updateMenu(availableOptions);
updateMenu(availableOptions);
});
$('select[name="' + name + '"]').change(function()