From 309656daf66faad7bb6e6704c3d1d7434b315605 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia <aleishaamohia@hotmail.com> Date: Fri, 5 May 2017 03:58:49 +0000 Subject: [PATCH] Bug 18545: Remove use of onclick from OPAC cart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To test: 1) Apply patch and add one or more items to your cart 2) Confirm that clicking the following things still works as expected: - more details - brief display - send - download - print - select all - clear all - selecting by clicking checkbox - remove title - add title to list - place hold - add tag - empty and close Sponsored-by: Catalyst IT Followed test plan, works as expected. Resolves issue with two print dialogues from Bug 18544. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> --- .../opac-tmpl/bootstrap/en/modules/opac-basket.tt | 96 ++++++++++++++++++---- 1 file changed, 80 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt index fa7e496..d1b137b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -18,16 +18,16 @@ [% UNLESS ( print_basket ) %] <div id="toolbar" class="toolbar"> [% IF ( verbose ) %] - <a href="opac-basket.pl" class="brief" onclick="showLess(); return false;">Brief display</a> + <a href="opac-basket.pl" class="brief">Brief display</a> [% ELSE %] - <a href="opac-basket.pl" class="detail" onclick="showMore(); return false;">More details</a> + <a href="opac-basket.pl" class="detail">More details</a> [% END %] [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] - <a class="send" href="opac-basket.pl" onclick="sendBasket(); return false;">Send</a> + <a class="send" href="opac-basket.pl">Send</a> [% END %] - <a class="download" href="opac-basket.pl" onclick="downloadBasket(); return false;">Download</a> - <a class="print-large" href="opac-basket.pl" onclick="printBasket(); return false;">Print</a> - <a class="empty" href="opac-basket.pl" onclick="delBasket(); return false;">Empty and close</a> + <a class="download" href="opac-basket.pl">Download</a> + <a class="print-large" href="opac-basket.pl">Print</a> + <a class="empty" href="opac-basket.pl">Empty and close</a> <a class="hide close" href="opac-basket.pl">Hide window</a> </div> @@ -37,16 +37,16 @@ <span class="sep">|</span> <span class="links" id="tag_hides"> <span id="selections">Select titles to: </span> - <a href="#" class="deleteshelf disabled" onclick="delSelRecords(); return false;">Remove</a> + <a href="#" class="deleteshelf disabled">Remove</a> [% IF ( Koha.Preference( 'opacuserlogin' ) == 1 ) %] [% IF ( ( Koha.Preference( 'virtualshelves' ) == 1 ) && loggedinusername ) %] - <a href="#" class="newshelf disabled" onclick="addSelToShelf(); return false;">Add to a list</a> + <a href="#" class="newshelf disabled">Add to a list</a> [% END %] [% IF ( Koha.Preference( 'RequestOnOpac' ) == 1 ) %] - <a href="#" class="hold disabled" onclick="holdSel(); return false;">Place hold</a> + <a href="#" class="hold disabled">Place hold</a> [% END %] [% IF ( TagsInputEnabled && loggedinusername ) %] - <a href="#" id="tagsel_tag" class="disabled" onclick="tagSelected(); return false;">Tag</a> + <a href="#" id="tagsel_tag" class="disabled">Tag</a> [% END %] [% END # / IF opacuserlogin %] </span> @@ -54,8 +54,8 @@ <span id="tagsel_form" style="display:none"> <label for="tagsel_new">New tag:</label> <input name="tagsel_new" id="tagsel_new" maxlength="100" /> - <input id="tagsel_button" name="tagsel_button" class="input tagsel_button" title="Add" type="submit" value="Add" onclick="tagAdded(); return false;" /> - <a href="#" id="tagsel_cancel" onclick="tagCanceled(); return false;">Cancel</a> + <input id="tagsel_button" name="tagsel_button" class="input tagsel_button" title="Add" type="submit" value="Add"> + <a href="#" id="tagsel_cancel">Cancel</a> </span> [% END %] </div> @@ -70,7 +70,7 @@ [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield |html %] [% END %][% END %] [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %] [% ELSE %] - <input type="checkbox" class="cb" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked)" /> + <input type="checkbox" class="cb" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]"> [% BIBLIO_RESULT.title |html %] [% IF ( BIBLIO_RESULT.subtitle ) %] [% FOREACH subtitl IN BIBLIO_RESULT.subtitle %] [% subtitl.subfield |html %] [% END %][% END %] [% IF ( BIBLIO_RESULT.author ) %] [% BIBLIO_RESULT.author |html %][% END %] @@ -259,7 +259,7 @@ <tr> [% UNLESS ( print_basket ) %] <td> - <input type="checkbox" class="cb" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]" onclick="selRecord(value,checked);" /> + <input type="checkbox" class="cb" value="[% BIBLIO_RESULT.biblionumber %]" name="bib[% BIBLIO_RESULT.biblionumber %]" id="bib[% BIBLIO_RESULT.biblionumber %]"> </td> [% END %] <td> @@ -370,6 +370,67 @@ [% END # / TagsInputEnabled && loggedinusername %] $(document).ready(function(){ + $(".brief").click(function(){ + showLess(); + return false; + }); + + $(".detail").click(function(){ + showMore(); + return false; + }); + + $(".send").click(function(){ + sendBasket(); + return false; + }); + + $(".download").click(function(){ + downloadBasket(); + return false; + }); + + $(".print-large").click(function(){ + e.preventDefault(); + printBasket(); + return false; + }); + + $(".empty").click(function(){ + delBasket(); + return false; + }); + + $(".deleteshelf").click(function(){ + delSelRecords(); + return false; + }); + + $(".newshelf").click(function(){ + addSelToShelf(); + return false; + }); + + $(".hold").click(function(){ + holdSel(); + return false; + }); + + $("#tagsel_tag").click(function(){ + tagSelected(); + return false; + }); + + $("#tagsel_button").click(function(){ + tagAdded(); + return false; + }); + + $("#tagsel_cancel").click(function(){ + tagCanceled(); + return false; + }); + $("#CheckAll").click(function(){ var checked = []; $(".checkboxed").checkCheckboxes("*", true).each( @@ -406,10 +467,13 @@ ] })); - $(".cb").click(function(){ + $(".cb").change(function(){ + if ($(this).prop("checked")){ + selRecord($(this).val(), true); + } enableCheckboxActions(); + return false; }); - enableCheckboxActions(); }); function enableCheckboxActions(){ -- 2.1.4