Bug 21174: Open the OPAC cart with one click by default

Feedback from the Koha mailing list in Aug 2018 showed there was
widespread concensus for making the default behaviour of the OPAC cart
to be to open with one click, rather than clicking on the cart icon then
on the dropdown box to load the cart popup.

This commit is a combination of Owen Leonard's alternative patch
(slightly changing the markup in masthead.inc) and my
work to remove the dropdown elements from the template and basket.js

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, and plack

6. 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.

7. Confirm the items in your cart are displayed by the cart popup

8. Confirm you can remove items from/empty the cart, and that as you do
   this the number of cart items shown by the number to the right of the
   cart icon changes accordingly

Sponsored-By: Toi Ohomai Institute of Technology, New Zealand

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Alex Buckley 2018-09-29 05:24:22 +00:00 committed by Nick Clemens
parent 62285d2de4
commit da604a9006
2 changed files with 5 additions and 11 deletions

View File

@ -21,15 +21,10 @@
[% END %]
<ul class="nav">
[% IF ( Koha.Preference( 'opacbookbag' ) == 1 ) %]
<li class="dropdown">
<a href="#" title="Collect items you are interested in" class="dropdown-toggle" id="cartmenulink" data-toggle="dropdown" role="button">
<i id="carticon" class="fa fa-shopping-cart fa-icon-white"></i> <span class="cartlabel">Cart</span> <span id="basketcount"></span> <b class="caret"></b>
<li>
<a href="#" title="Collect items you are interested in" id="cartmenulink" role="button">
<i id="carticon" class="fa fa-shopping-cart fa-icon-white"></i> <span class="cartlabel">Cart</span> <span id="basketcount"></span>
</a>
<ul aria-labelledby="cartmenulink" role="menu" class="dropdown-menu">
<li role="presentation">
<a href="#" id="cartmenuitem" class="cart-message" tabindex="-1" role="menuitem">Your cart is empty.</a>
</li>
</ul>
</li>
[% END %]
[% IF ( Koha.Preference( 'virtualshelves' ) == 1 ) && ( Koha.Preference( 'opacbookbag' ) == 1 ) %]

View File

@ -209,7 +209,6 @@ function addSelRecords(valSel) { // function for adding a selection of biblios t
function showCartUpdate(msg){
// set body of popup window
$("#cartDetails").html(msg);
$("#cartmenuitem").html(MSG_IN_YOUR_CART + " " + basketCount());
showCart();
setTimeout("hideCart()",2000);
}
@ -507,8 +506,8 @@ function updateAllLinks(target){
}
$("#cartDetails").ready(function(){
$("#cartDetails,#cartmenuitem,#cartmenulink").on("click",function(){ hideCart(); });
$("#cartmenuitem").click(function(e){
$("#cartDetails,#cartmenulink").on("click",function(){ hideCart(); });
$("#cartmenulink").click(function(e){
e.preventDefault();
openBasket();
$("li").closest().removeClass("open");