From 9cb7244433cf446232cfcc8a22f333cdcd8db1db Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 6 May 2016 11:40:00 -0400 Subject: [PATCH] Bug 16469 - Remove the use of "onclick" from some catalog pages This patch removes the use of "onclick" attributes from two catalog-related templates: The local cover image viewer and the search results page. Events are now defined in JavaScript. To test: On the search results page: - Perform a catalog search which will return multiple results. - On the search results page, confirm that the "Select all" and "Clear all" links at the top of the results table work correctly. In the local cover image viewer: - The LocalCoverImages and AllowMultipleCovers system preferences must enabled, and at least one catalog record must have at least two local cover images attached. - Locate that record in the catalog and view the detail page for it. - Click the cover image in the "Images" tab to go to the image viewer page. - Clicking each local cover image thumnail should correctly display the larger version of each image. Signed-off-by: Nikos Chatzakis, Afrodite Malliari Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- .../prog/en/modules/catalogue/imageviewer.tt | 7 ++++++- .../prog/en/modules/catalogue/results.tt | 13 ++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt index 60674d040b..7e6fffdc32 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/imageviewer.tt @@ -7,6 +7,11 @@ $(document).ready(function(){ showCover([% imagenumber %]); + $(".show_cover").on("click",function(e){ + e.preventDefault(); + var coverimg = $(this).data("coverimg"); + showCover(coverimg); + }); }); function showCover(img) { @@ -75,7 +80,7 @@ img.thumbnail { [% FOREACH img IN images %] [% IF img %] - + [% IF ( imagenumber == img ) %] Thumbnail [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 6e71a41216..b1ed175238 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -183,7 +183,14 @@ $('#sort_by').change(function() { [% END %] [% IF LocalCoverImages %]KOHA.LocalCover.LoadResultsCovers();[% END %] - + $("#select_all").on("click",function(e){ + e.preventDefault(); + selectAll(); + }); + $("#clear_all").on("click",function(e){ + e.preventDefault(); + clearAll(); + }); }); @@ -338,9 +345,9 @@ var holdForPatron = function () { [% total %] result(s) found [% IF ( query_desc ) %]for '[% query_desc |html %]'[% END %][% IF limit_desc %] with limit(s): '[% limit_desc | html %]'[% END %][% IF ( LibraryName ) %] in [% LibraryName %] Catalog[% END %].