Bugzilla – Attachment 78009 Details for
Bug 21174
Change default behavior to open OPAC cart in one click
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21174 - Syspref for choosing to load cart popup upon one click on the cart icon.
Bug-21174---Syspref-for-choosing-to-load-cart-popu.patch (text/plain), 5.41 KB, created by
Alex Buckley
on 2018-08-19 22:43:18 UTC
(
hide
)
Description:
Bug 21174 - Syspref for choosing to load cart popup upon one click on the cart icon.
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2018-08-19 22:43:18 UTC
Size:
5.41 KB
patch
obsolete
>From fe5237ba6ae9136562a016b97af85c330739b752 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Mon, 20 Aug 2018 09:38:49 +1200 >Subject: [PATCH] Bug 21174 - Syspref for choosing to load cart popup upon one > click on the cart icon. > >Instead of OPAC users having to click on the cart icon, then having to >click on the dropdown box 'Items in your cart:..' to load the cart popup >with this syspref enabled OPAC users only need to click once on theOPAC >cart icon and the cart popup loads. > >Test plan: >1. In Koha OPAC click on the cart icon (making sure to have items in the >cart and the dropdown box 'Items in your cart:..' appears. > >2. Click this dropdown and the cart popup appears. > >3. Confirm you can successfully remove items from and empty the >cart > >4. Apply patch > >5. Restart memcached, plack and in koha-shell run >./updatedatabase.pl > >6. By default the new syspref in this patch is turned off. >Therefore repeat steps: 1,2,3 and confirm they work the same as before you >applied the commit > >7. In Koha staff client go to Administration->Global system >preferences and enable the 'EnableOneClickToOpenCartPopup' preference > >8. Back in the OPAC click on the cart icon (making sure to have items in >the cart) and notice no 'Items in your: ..' dropdown appears >instead the cart popup loads straight away. > >9. Confirm the items in your cart is displayed by the cart popup > >10. Confirm you can remove items from/empty the cart > >Sponsored-By: Toi Ohomai Institute of Technology, New Zealand >--- > ...ref_enabling_loading_of_cart_popup_on_one_click.sql | 1 + > koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc | 8 ++++++-- > koha-tmpl/opac-tmpl/bootstrap/js/basket.js | 18 +++++++++++++----- > 3 files changed, 20 insertions(+), 7 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_21174_syspref_enabling_loading_of_cart_popup_on_one_click.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_21174_syspref_enabling_loading_of_cart_popup_on_one_click.sql b/installer/data/mysql/atomicupdate/bug_21174_syspref_enabling_loading_of_cart_popup_on_one_click.sql >new file mode 100644 >index 0000000..cbe42de >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_21174_syspref_enabling_loading_of_cart_popup_on_one_click.sql >@@ -0,0 +1 @@ >+INSERT INTO systempreferences (variable, value, explanation) values ('EnableOneClickToOpenCartPopup' 0, 'Enable to load the cart popup immediately upon clicking on the OPAC cart icon'); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index b65af43..7b94a86 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -2,6 +2,7 @@ > [% USE Koha %] > [% USE Branches %] > [% SET OpacLangSelectorMode = Koha.Preference('OpacLangSelectorMode') %] >+[% SET CartOneClick = Koha.Preference('EnableOneClickToOpenCartPopup') %] > <div id="wrap"> > <div id="header-region" class="noprint"> > <div class="navbar navbar-inverse navbar-static-top"> >@@ -18,13 +19,16 @@ > </h1> > [% IF ( Koha.Preference( 'opacbookbag' ) == 1 ) %] > <div id="cartDetails" class="cart-message">Your cart is empty.</div> >+ [% IF ( Koha.Preference('EnableOneClickToOpenCartPopup') == 1 ) %] >+ <input type="hidden" value="1" id="CartOneClick"> >+ [% END %] > [% END %] > <ul class="nav"> > [% IF ( Koha.Preference( 'opacbookbag' ) == 1 ) %] > [% IF ( Koha.Preference('EnableOneClickToOpenCartPopup') == 1 ) %] > <li> >- <a href="#" title="Collect items you are interested in" id="cartmenuitem" role="button"> >- <i id="carticon" class="icon-shopping-cart icon-white"></i> <span class="cartlabel">Cart</span> <span id="basketcount"></span> >+ <a href="#" title="Collect items you are interested" id="cartmenulink" role="button"> >+ <i id="carticon" class="icon-shopping-cart icon-white"></i> <span class="cartlabel">Cart</span> <span id="basketcount"></span><b class="caret"></b> > </a> > </li> > [% ELSE %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js >index 9eb6630..5355fc2 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js >@@ -505,10 +505,18 @@ function updateAllLinks(target){ > > $("#cartDetails").ready(function(){ > $("#cartDetails,#cartmenuitem,#cartmenulink").on("click",function(){ hideCart(); }); >- $("#cartmenuitem").click(function(e){ >- e.preventDefault(); >- openBasket(); >- $("li").closest().removeClass("open"); >- }); >+ if (document.getElementById("CartOneClick")) { >+ $("#cartmenulink").click(function(e){ >+ e.preventDefault(); >+ openBasket(); >+ $("li").closest().removeClass("open"); >+ }); >+ } else { >+ $("#cartmenuitem").click(function(e){ >+ e.preventDefault(); >+ openBasket(); >+ $("li").closest().removeClass("open"); >+ }); >+ } > updateBasket(basketCount()); > }); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 21174
:
77550
|
77642
|
77684
|
78006
|
78007
|
78008
|
78009
|
78010
|
79647
|
79714
|
79856
|
80293
|
80294
|
80295
|
80373
|
80374
|
80375