From 0a5084eba4db21984b5797f137d2c725dbd01c86 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 29 Jan 2021 11:48:24 +0000 Subject: [PATCH] Bug 34227: Add persistent selections and batch operations to item search This patch modifies the item search results page so that user selections are stored in local storage. This allows the user to make selections on one page of search results, move to another, and continue to make selections. The patch also adds the option to send selected items to batch item modification or batch item deletion. Changes to the patron search results template have been made to make some CSS classes more generic so they can be used by both pages. To test, apply the patch and rebuild the staff interface CSS. - Log in to the staff interface as a user with permission to perform batch item modification and batch item deletion. - Go to item search and perform a search which will return at least two pages of results. - On the search results page you should see a new search header toolbar with some controls: "Select visible rows," "Clear selection," "Export all results to" and "Batch operations" (disabled). - Without making any selections, confirm that the "Export all results to" menu items work correctly to export all results to a CSV or a barcode file. - Confirm that the "Select visible rows" control works as expected, selecting all checkboxes on the current page (and on no other pages) - After selecting all checkboxes the search header controls should be updated: - The "Export all..." button should now show the number of selections: "Export selected results (X) to..." - The batch operations button should be enabled. - There should be a new element labeled "Items selected: X" with a "Clear" link. - If you uncheck any checkboxes the controls should be updated, showing the new count of selected records. - Move to the next page of results and confirm that making selections on this page works to increment all counters - Confirm that the "Export selected.." options work and that your CSV and barcode files now contain only the items you selected. - Test the batch operations menu: - Test that the controls correctly reflect the logged-in user's permissions: - With permission to batch modify items - With permission to batch delete items - With both; with neither - Both menu options should take you to the correct page and the list of submitted items should match your selections. - Test that clicking the "Clear" button next to "Items selected" hides the items selected box and reverts the "Export all" and "Batch operations" buttons to their original state. - Page through the search results to confirm that no checkboxes are checked. - Test that your search selections are really persistent: - Navigate away from the page, return to item search, and perform another search. - The "Item selected" box should still show your previous selections. - Any items you previously selected which are also in this result set should have a checked checkbox. - Click the "Edit search" button from the item search results page and new search with different parameters. - The "Items selected" should still show your previous selections. - Log out of Koha and back in. When you perform an item search now, there should be no "Item selected" - Go to Patrons and test patron searching. As you make selections the "Patrons selected" box should be updated correctly and look correct, matching the one on the item search page. Signed-off-by: Sam Lau Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../prog/css/src/staff-global.scss | 7 +- .../prog/en/modules/catalogue/itemsearch.tt | 338 +++++++++++------- .../prog/en/modules/members/member.tt | 12 +- .../intranet-tmpl/prog/js/staff-global.js | 1 + 4 files changed, 223 insertions(+), 135 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 199c0bdc84..08b42df106 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -2039,22 +2039,23 @@ li { } } -#patron_search_selected { +#table_search_selections { background-color: lighten( $background-color-primary, 60 ); border: 1px solid $background-color-primary; border-color: lighten( $background-color-primary, 30 ) lighten( $background-color-primary, 50 ) lighten( $background-color-primary, 50 ) lighten( $background-color-primary, 30 ); - border-radius: 3px; + border-radius: 4px; color: #333; display: inline-block; font-size: 11px; line-height: 1.5; + margin-left: .7em; padding: 5px 10px; text-align: center; vertical-align: middle; white-space: nowrap; } -#clear-patron-selection { +#clear-row-selection { display: inline-block; margin-left: 1em; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt index 67d7fd0552..c39e1ee669 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/itemsearch.tt @@ -270,10 +270,17 @@
-
+
+ +
+
+ + +
+ [% MACRO jsinclude BLOCK %] [% INCLUDE 'datatables.inc' %] [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %] @@ -281,6 +288,20 @@ [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index 5d7928b172..e65241207e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -98,9 +98,9 @@ [% END %] - @@ -169,7 +169,7 @@ [% INCLUDE 'select2.inc' %]