1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-11-04 17:23:18 +00:00

Advanced search tags are now multiselects (#1240)

This commit is contained in:
Ozzieisaacs
2020-12-28 13:44:17 +01:00
parent 7e0ed537b7
commit d33b0587cb
3 changed files with 27 additions and 17 deletions

View File

@@ -249,18 +249,26 @@ promisePublishers.done(function() {
);
});
$("#search").on("change input.typeahead:selected", function() {
$("#search").on("change input.typeahead:selected", function(event) {
if (event.target.type == "search" && event.target.tagName == "INPUT") {
return;
}
var form = $("form").serialize();
$.getJSON( getPath() + "/get_matching_tags", form, function( data ) {
$(".tags_click").each(function() {
if ($.inArray(parseInt($(this).children("input").first().val(), 10), data.tags) === -1 ) {
if (!($(this).hasClass("active"))) {
$(this).addClass("disabled");
if ($.inArray(parseInt($(this).val(), 10), data.tags) === -1) {
if(!$(this).prop("selected")) {
$(this).prop("disabled", true);
}
} else {
$(this).removeClass("disabled");
$(this).prop("disabled", false);
}
});
$("#include_tag option:selected").each(function () {
$("#exclude_tag").find("[value="+$(this).val()+"]").prop("disabled", true);
});
$('#include_tag').selectpicker("refresh");
$('#exclude_tag').selectpicker("refresh");
});
});