Bug 17210: Remove use of onclick from biblio detail sidebar in OPAC
authorAleisha Amohia <aleishaamohia@hotmail.com>
Mon, 29 Aug 2016 06:07:53 +0000 (06:07 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 9 Sep 2016 10:50:16 +0000 (10:50 +0000)
Four instances of onclick here:
1) Print
2) Save to your lists
3) Add to your cart
4) Remove from cart

To test:
Find a biblio detail page in OPAC and confirm all four events above work
as expected before and after the patch.

Sponsored-by: Catalyst IT
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-detail-sidebar.inc

index 3348c21..fec6114 100644 (file)
@@ -149,6 +149,22 @@ $.widget.bridge('uitooltip', $.ui.tooltip);
             verify_images();
          });
     [% END %]
+
+    $(".print-large").on("click",function(){
+        window.print();
+    });
+    $(".addtoshelf").on("click",function(){
+        Dopop('opac-addbybiblionumber.pl?biblionumber=[% biblionumber %]');
+        return false;
+    });
+    $(".addrecord").on("click",function(){
+        addRecord('[% biblionumber %]');
+        return false;
+    });
+    $(".cartRemove").on("click",function(){
+        delSingleRecord('[% biblionumber %]');
+        return false;
+    });
     //]]>
 </script>
 
index d02b4c2..3c14bea 100644 (file)
@@ -8,19 +8,17 @@
             [% END %]
         [% END %]
     [% END %]
-    <li><a class="print-large" href="#" onclick="window.print();">Print</a></li>
+    <li><a class="print-large" href="#">Print</a></li>
     [% IF Koha.Preference( 'virtualshelves' ) == 1 %]
         [% IF ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && loggedinusername ) %]
-            <li><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% biblionumber %]" onclick="Dopop('opac-addbybiblionumber.pl?biblionumber=[% biblionumber %]'); return false;">
-                Save to your lists
-            </a></li>
+            <li><a class="addtoshelf" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% biblionumber %]">Save to your lists</a></li>
         [% END %]
     [% END %]
     [% IF Koha.Preference( 'opacbookbag' ) == 1 %]
         [% IF ( incart ) %]
-            <li><a class="incart cart[% biblionumber %]" href="#" onclick="addRecord('[% biblionumber %]'); return false;">In your cart</a> <a class="cartRemove cartR[% biblionumber %]" href="#" onclick="delSingleRecord('[% biblionumber %]'); return false;">(remove)</a></li>
+            <li><a class="incart cart[% biblionumber %] addrecord" href="#">In your cart</a> <a class="cartRemove cartR[% biblionumber %]" href="#">(remove)</a></li>
         [% ELSE %]
-            <li><a class="addtocart cart[% biblionumber %]" href="#" onclick="addRecord('[% biblionumber %]'); return false;">Add to your cart</a>  <a style="display:none;" class="cartRemove cartR[% biblionumber %]" href="#" onclick="delSingleRecord('[% biblionumber %]'); return false;">(remove)</a></li>
+            <li><a class="addtocart cart[% biblionumber %] addrecord" href="#">Add to your cart</a>  <a style="display:none;" class="cartRemove cartR[% biblionumber %]" href="#">(remove)</a></li>
         [% END %]
     [% END %]
     [% IF ( OpacHighlightedWords && query_desc ) %]