Bug 33568: Fix select/clear all links

Follow-up for "Bug 33568: Preserve item selection across pagination and filtering"

FIXME We should deal with the items selection in a better way, but I
would not consider it blocker, that can be done later.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2023-05-30 10:28:00 +02:00 committed by Katrin Fischer
parent 0db40981db
commit 026adcbcd3
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 15 additions and 9 deletions

View File

@ -105,11 +105,11 @@
function itemSelectionBuildActionLinks(tab_id) {
var delete_link_ok = itemSelectionBuildDeleteLink(tab_id);
var modify_link_ok = itemSelectionBuildModifyLink(tab_id);
var div = $("#" + tab_id);
var tab = $("#" + tab_id);
if (modify_link_ok || delete_link_ok) {
$('.itemselection_actions', div).show();
$('.itemselection_actions', tab).show();
} else {
$('.itemselection_actions', div).hide();
$('.itemselection_actions', tab).hide();
}
}
@ -117,16 +117,22 @@
$(".SelectAll").on("click",function(e){
e.preventDefault();
var tab = $(this).data("tab");
$("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', true);
itemSelectionBuildActionLinks(tab);
let tab_id = $(this).data("tab");
let tab = $("#"+tab_id);
tab.find("input[name='itemnumber'][type='checkbox']").each( (i, input) => {
items_selection[tab_id].push($(input).val());
$(input).prop('checked', true);
});
itemSelectionBuildActionLinks(tab_id);
});
$(".ClearAll").on("click",function(e){
e.preventDefault();
var tab = $(this).data("tab");
$("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false);
itemSelectionBuildActionLinks(tab);
let tab_id = $(this).data("tab");
let tab = $("#"+tab_id);
items_selection[tab_id] = [];
$("input[name='itemnumber'][type='checkbox']", tab).prop('checked', false);
itemSelectionBuildActionLinks(tab_id);
});
$(".show_filters").on("click",function(e){