Fix tags handling that was broken with filter
This commit is contained in:
@ -235,10 +235,56 @@ jQuery(document).ready(function($)
|
||||
{
|
||||
generateMenu(originalAvailableOptions);
|
||||
availableOptions = gatherData();
|
||||
updateMenu(availableOptions);
|
||||
|
||||
userActionHandle(availableOptions);
|
||||
URLGeneration(availableOptions);
|
||||
URLGeneration(originalAvailableOptions);
|
||||
updateMenu(availableOptions);
|
||||
|
||||
// handle tags
|
||||
function handleTags()
|
||||
{
|
||||
$('.box.tags .item-cont').delegate('select[name="tag"]', 'change', function()
|
||||
{
|
||||
paramTag = []; // collect all tags from all dropdowns
|
||||
$('.box.tags .item-cont select[name="tag"]').each(function()
|
||||
{
|
||||
if (paramTag.indexOf(this.value) === -1 && this.value != "")
|
||||
paramTag.push(this.value);
|
||||
});
|
||||
|
||||
if (this.value != "")
|
||||
{
|
||||
createNewElem = true; // if we modify an existing element to a value, we don't delete it
|
||||
$('.box.tags select').each(function()
|
||||
{
|
||||
if ($(this).val() == "")
|
||||
createNewElem = false;
|
||||
});
|
||||
if (createNewElem)
|
||||
{
|
||||
html = '<span><span class="inline">※ </span><select name="tag">';
|
||||
html += '<option value="">Aucun</option>';
|
||||
for (a of originalAvailableOptions.tags)
|
||||
html += '<option value="' + a + '">' + a + '</option>';
|
||||
html += '</select></span>';
|
||||
$(".box.tags .item-cont").append(html);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// if the element has no value, we delete it
|
||||
$(this).parent().remove();
|
||||
}
|
||||
|
||||
selectedOptions = gatherURLdata();
|
||||
data = originalData;
|
||||
filterData(selectedOptions);
|
||||
availableOptions = [];
|
||||
availableOptions = gatherData();
|
||||
updateMenu(availableOptions);
|
||||
});
|
||||
}
|
||||
handleTags();
|
||||
|
||||
function visualFilterCheckboxItem(name, param)
|
||||
{
|
||||
@ -285,7 +331,6 @@ jQuery(document).ready(function($)
|
||||
visualFilterCheckboxItem("help", paramHelp);
|
||||
|
||||
visualFilterListItem("place", paramPlace);
|
||||
visualFilterListItem("tag", paramTag);
|
||||
});
|
||||
|
||||
/*********************/
|
||||
|
Reference in New Issue
Block a user