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 <nchatzakis@datascouting.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2016-05-06 11:40:00 -04:00 committed by Kyle M Hall
parent dd867b10b8
commit 9cb7244433
2 changed files with 16 additions and 4 deletions

View file

@ -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 %]
<a href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber %]&amp;imagenumber=[% img %]" onclick="showCover([% img %]); return false;">
<a class="show_cover" data-coverimg="[% img %]" href="/cgi-bin/koha/catalogue/imageviewer.pl?biblionumber=[% biblionumber %]&amp;imagenumber=[% img %]">
[% IF ( imagenumber == img ) %]
<img class="thumbnail selected" id="[% img %]" src="/cgi-bin/koha/catalogue/image.pl?imagenumber=[% img %]&amp;thumbnail=1" alt="Thumbnail" />
[% ELSE %]

View file

@ -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 <span style="font-weight: bold;">'[% query_desc |html %]'</span>[% END %][% IF limit_desc %]&nbsp;with limit(s): <span style="font-weight: bold;">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName %] Catalog[% END %].<br />&nbsp;
</h3>
<div id="selection_ops" class="cartlist" style="display:none">
<a href="#" onclick="selectAll(); return false;">Select all</a>
<a href="#" id="select_all">Select all</a>
|
<a href="#" onclick="clearAll(); return false;">Clear all</a>
<a href="#" id="clear_all">Clear all</a>
|
<a href="#" class="highlight_toggle" id="highlight_toggle_off">Unhighlight</a>
<a href="#" class="highlight_toggle" id="highlight_toggle_on">Highlight</a>