From 84b4ce0214dbae312a6971308c11ea2c49ff327d Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 20 Oct 2020 13:40:04 +0000 Subject: [PATCH] Bug 26752: Convert OPAC list download modal to dropdown This patch modifies the OPAC list page so that download options are shown in a dropdown menu instead of a modal dialog. This solves a bug introduced by the Bootstrap 4 upgrade and makes it consistent with the cart interface. To test, apply the patch and view the contents of a list in the OPAC which has multiple items on it. - In the toolbar at the top of the list contents table the "Download" button should now be a dropdown menu. - Selecting any of the download options should trigger a download prompt. - Test with and without some CSV profiles which have been configured for use in the OPAC --- .../opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 33 +++++++++++++++------- opac/opac-shelves.pl | 6 ++++ 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt index bf42a7072f..9328ac4857 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt @@ -208,7 +208,18 @@
New list | - Download list + [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] Send list @@ -782,15 +793,10 @@
- +
+ + +
@@ -1044,6 +1050,13 @@ $(function() { ); }); + $(".download-list").on("click", function(e){ + e.preventDefault(); + var format = $(this).data("format"); + $("#download_format").val( format ); + $("#download_list").submit(); + }); + }); // document.ready function sortMenu( sorting_form ){ diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index 0bcd273798..b94b4126ea 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -33,6 +33,7 @@ use C4::XSLT; use Koha::Biblios; use Koha::Biblioitems; use Koha::CirculationRules; +use Koha::CsvProfiles; use Koha::Items; use Koha::ItemTypes; use Koha::Patrons; @@ -385,6 +386,11 @@ if ( $op eq 'view' ) { itemsloop => \@items, sortfield => $sortfield, direction => $direction, + csv_profiles => [ + Koha::CsvProfiles->search( + { type => 'marc', used_for => 'export_records', staff_only => 0 } + ) + ], ); if ( $page ) { my $pager = $contents->pager; -- 2.11.0