From 452f9586b6a8f26c4cc444030db83b6c9903879b Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 19 Feb 2021 12:40:01 +0000 Subject: [PATCH] Bug 27728: Add a search box on OPAC Search history This patch makes changes to the OPAC search history DataTables configuration so that table controls appear, including search, copy, CSV, and print. The patch also makes some improvements to the checkbox interactions: The date column is now a label for the checkbox, and the "Remove selected searched" button is now disabled until a checkbox has been checked. To test, apply the patch and log into the OPAC as a user with a search history. If possible, past and current searches of both bibliographic and authority records. - On the search history page, confirm that the DataTables controls appear above each table: "Current" and "Previous" under both the "Catalog" and "Authority" tabs. - All controls should work correctly and affect only the corresponding table: Search, Clear filter, Copy, CSV, and Print. - Confirm that clicking a date in the date column checks the correct checkbox. - Confirm that toggling a checkbox correctly enables and disables the "Remove selected searches" button as well as the "Select searches to:" menu at the top of the table. --- .../bootstrap/en/modules/opac-search-history.tt | 52 +++++++++++++++++----- 1 file changed, 42 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt index a971c17726..d16109819b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-search-history.tt @@ -73,8 +73,14 @@ [% FOREACH s IN current_biblio_searches %] - - [% s.time |$KohaDates with_hours => 1 %] + + + + + + @@ -90,7 +96,7 @@ [% END # IF ( current_biblio_searches ) %] - +
[% IF ( previous_biblio_searches ) %]

Previous sessions

@@ -110,8 +116,14 @@ [% FOREACH s IN previous_biblio_searches %] - - [% s.time |$KohaDates with_hours => 1 %] + + + + + +
@@ -154,8 +166,14 @@ [% FOREACH s IN current_authority_searches %] - - [% s.time |$KohaDates with_hours => 1 %] + + + + + + [% s.query_desc | html %] [% s.total | html %] @@ -183,8 +201,14 @@ [% FOREACH s IN previous_authority_searches %] - - [% s.time |$KohaDates with_hours => 1 %] + + + + + + [% s.query_desc | html %] [% s.total | html %] @@ -233,10 +257,15 @@ // (so that the more recent query is shown first) $(".historyt").dataTable($.extend(true, {}, dataTablesDefaults, { "order": [[ 1, "desc" ]], + "dom": '<"top"<"table_entries"><"table_controls"fB>>t', "columnDefs": [ { "targets": [ 0 ], "sortable": false, "searchable": false }, { "targets": [ 1 ], "type": "title-string" }, - ] + ], + "language": { + "search": "_INPUT_", + "searchPlaceholder": _("Search") + } })); [% IF Koha.Preference( 'OpacAuthorities' ) == 1 %]$('#tabs').tabs();[% END %] @@ -271,6 +300,7 @@ } return false; }); + $(".remove-selected").addClass("disabled"); }); function enableCheckboxActions(form){ @@ -279,9 +309,11 @@ if ($(checkedBoxes).size()) { $(form).find(".selections").html(_("With selected searches: ")); $(form).find(".selections-toolbar .links a").removeClass("disabled"); + $(form).find(".remove-selected").removeClass("disabled"); } else { $(form).find(".selections").html(_("Select searches to: ")); $(form).find(".selections-toolbar .links a").addClass("disabled"); + $(form).find(".remove-selected").addClass("disabled"); } } -- 2.11.0