Bug 34725: Remove use of onclick for OPAC cart

This patch moves the click handler in the OPAC cart from the inline HTML
and out to an existing <script> element.

Test plan:
0. Apply the patch
1. Go to http://localhost:8080/cgi-bin/koha/opac-search.pl?idx=&q=test&weight_search=1
2. Add the results to the cart
3. Click on the "Cart"
4. One by one click on the title of each row
5. Notice how the parent window changes to the detail record for that title

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
David Cook 2023-09-06 06:57:15 +00:00 committed by Tomas Cohen Arazi
parent f636a041a6
commit 9e39d2d671
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -303,7 +303,7 @@
<input type="checkbox" class="cb" value="[% BIBLIO_RESULT.biblionumber | html %]" name="bib[% BIBLIO_RESULT.biblionumber | html %]" id="bib[% BIBLIO_RESULT.biblionumber | html %]">
</td>
<td>
<a href="#" onclick="openBiblio('[% PROCESS biblio_a_href biblionumber => BIBLIO_RESULT.biblionumber %]',[% BIBLIO_RESULT.biblionumber | html %])">[% INCLUDE 'biblio-title.inc' biblio=BIBLIO_RESULT %]</a>
<a href="#" class="bib_opener" data-link="[% PROCESS biblio_a_href biblionumber => BIBLIO_RESULT.biblionumber %]" data-biblionumber="[% BIBLIO_RESULT.biblionumber | html %]">[% INCLUDE 'biblio-title.inc' biblio=BIBLIO_RESULT %]</a>
<!-- COinS / Openurl -->
<span class="Z3988" title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.au=[% BIBLIO_RESULT.author | html %]&amp;rft.btitle=[% BIBLIO_RESULT.title |url %]&amp;rft.date=[% BIBLIO_RESULT.publicationyear | html %]&amp;rft.tpages=[% BIBLIO_RESULT.item('size') | html %]&amp;rft.isbn=[% BIBLIO_RESULT.isbn |url %]&amp;rft.aucorp=&amp;rft.place=[% BIBLIO_RESULT.place | html %]&amp;rft.pub=[% BIBLIO_RESULT.publisher |url %]&amp;rft.edition=[% BIBLIO_RESULT.edition | html %]&amp;rft.series=[% BIBLIO_RESULT.series | html %]&amp;rft.genre="></span>
[% IF ( TagsInputEnabled && loggedinusername ) %]
@ -411,6 +411,12 @@
[% END # / TagsInputEnabled && loggedinusername %]
$(document).ready(function(){
$("a.bib_opener").on('click',function(){
let link = this.dataset.link;
let biblionumber = this.dataset.biblionumber;
openBiblio(link,biblionumber)
});
$(".brief").click(function(e){
e.preventDefault();
showLess();