Bug 38958: Search history deletion broken in the staff interface

There is some JS on the staff interface search history page which uses a
jQuery selector that doesn't seem to work after the DataTables upgrade.
This patch fixes it.

To test, apply the patch and enable EnableSearchHistory if necessary.

- In the staff interface, perform a few catalog searches if necessary.
- Choose "Search history" from the user menu in the upper right.
- In the table of searches, check the checkbox next to one or more
  search history entries.
- The delete button at the top of the table should become enabled.
- Clicking the delete button should work correctly to delete your
  selected searches.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Owen Leonard 2025-01-23 16:20:12 +00:00 committed by Katrin Fischer
parent a575d38770
commit b6709f2984
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 4 additions and 4 deletions

View File

@ -248,7 +248,7 @@
.attr('action', form.attr('action'))
.attr('method', form.attr('method'));
form.find('input[type="hidden"]')
.add(table.$('input:checkbox:checked'))
.add( $('input:checkbox:checked', table) )
.each(function() {
var input = $('<input type="hidden">')
.attr('name', $(this).attr('name'))
@ -281,7 +281,7 @@
e.preventDefault();
var form = $(this).parents("form").first();
var table = form.find('table').dataTable();
var ids = table.$("input:checkbox:checked");
var ids = $("input:checkbox:checked", table);
if ( $(ids).length < 1 ) {
return false;
}
@ -306,8 +306,8 @@
function enableCheckboxActions(form){
// Enable/disable controls if checkboxes are checked
var table = form.find('table').dataTable();
var checked_count = table.$("input:checkbox:checked").length;
var table = form.find('table');
var checked_count = $("input:checkbox:checked", table).length;
if (checked_count) {
if (checked_count == 1) {
form.find(".selections").html(_("With selected search: "));