Bugzilla – Attachment 77642 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 - Implemented syspref to enable the loading of cart popup on one click
Bug-21174---Implemented-syspref-to-enable-the-load.patch (text/plain), 9.24 KB, created by
Alex Buckley
on 2018-08-10 03:40:50 UTC
(
hide
)
Description:
Bug 21174 - Implemented syspref to enable the loading of cart popup on one click
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2018-08-10 03:40:50 UTC
Size:
9.24 KB
patch
obsolete
>From 528b310908848e3913cec4d4127d652e5fd6b180 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Wed, 8 Aug 2018 17:15:02 +1200 >Subject: [PATCH] Bug 21174 - Implemented syspref to enable the loading of cart > popup on one click > >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 Insitute of Technology, New Zealand >--- > .../prog/en/modules/admin/preferences/opac.pref | 6 ++++ > .../opac-tmpl/bootstrap/en/includes/masthead.inc | 32 +++++++++++++++------- > .../bootstrap/en/includes/opac-bottom.inc | 1 - > .../opac-tmpl/bootstrap/en/modules/opac-basket.tt | 5 +++- > koha-tmpl/opac-tmpl/bootstrap/js/basket.js | 22 +++++++++++---- > 5 files changed, 48 insertions(+), 18 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index f46dda3..74f83b6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -416,6 +416,12 @@ OPAC: > no: "Don't allow" > - patrons to store items in a temporary "Cart" on the OPAC. > - >+ - pref: EnableOneClickToOpenCartPopup >+ choices: >+ yes: Enable >+ no: "Don't enable" >+ - Enable to load the cart popup immediately upon clicking on the OPAC cart icon. >+ - > - pref: OpacTopissue > choices: > yes: Allow >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index 0984563..4d66e22 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -1,6 +1,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"> >@@ -17,19 +18,30 @@ > </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 ) %] >- <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="icon-shopping-cart icon-white"></i> <span class="cartlabel">Cart</span> <span id="basketcount"></span> <b class="caret"></b> >- </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> >+ [% IF ( Koha.Preference('EnableOneClickToOpenCartPopup') == 1 ) %] >+ <li> >+ <a href="#" title="Collect items you are interested in" id="cartmenulink" data-toggle="dropdown" 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 %] >+ <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="icon-shopping-cart icon-white"></i> <span class="cartlabel">Cart</span> <sp an id="basketcount"></span> <b class="caret"></b> >+ </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 e mpty.</a> >+ </li> >+ </ul> >+ </li> >+ [% END %] > [% END %] > [% IF ( Koha.Preference( 'virtualshelves' ) == 1 ) && ( Koha.Preference( 'opacbookbag' ) == 1 ) %] > <li class="divider-vertical"></li> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >index 735cc89..6416c3f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc >@@ -177,7 +177,6 @@ $.widget.bridge('uitooltip', $.ui.tooltip); > }); > //]]> > </script> >- > [% IF Koha.Preference( 'opacbookbag' ) == 1 %] > [% Asset.js("js/basket.js") %] > [% ELSIF ( Koha.Preference( 'virtualshelves' ) == 1 ) %] >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 44a88b9..f5af809 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt >@@ -2,7 +2,7 @@ > [% USE KohaDates %] > [% USE Asset %] > [% SET TagsInputEnabled = ( ( Koha.Preference( 'opacuserlogin' ) == 1 ) && TagsEnabled && TagsInputOnList ) %] >- >+[% SET CartOneClick = Koha.Preference('EnableOneClickToOpenCartPopup') %] > [% INCLUDE 'doc-head-open.inc' %] > <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your cart</title> > [% INCLUDE 'doc-head-close.inc' %] >@@ -24,6 +24,9 @@ > [% IF Koha.Preference( 'opacuserlogin' ) == 1 %] > <a class="send" href="opac-basket.pl">Send</a> > [% END %] >+ [% IF CartOneClick %] >+ <input type="hidden" value="1" id="CartOneClick"> >+ [% END %] > <a class="download" href="opac-basket.pl">Download</a> > <a class="print-large" href="#">Print</a> > <a class="empty" href="opac-basket.pl">Empty and close</a> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js >index 9eb6630..0d24d9e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/basket.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/basket.js >@@ -504,11 +504,21 @@ function updateAllLinks(target){ > } > > $("#cartDetails").ready(function(){ >- $("#cartDetails,#cartmenuitem,#cartmenulink").on("click",function(){ hideCart(); }); >- $("#cartmenuitem").click(function(e){ >- e.preventDefault(); >- openBasket(); >- $("li").closest().removeClass("open"); >- }); >+ var cartprefenabled = document.getElementById("CartOneClick").value; >+ if (cartprefenabled == "1") { >+ $("#cartDetails,#cartmenulink").on("click",function(){ hideCart(); }); >+ $("#cartmenulink").click(function(e){ >+ e.preventDefault(); >+ openBasket(); >+ $("li").closest().removeClass("open"); >+ }); >+ } else { >+ $("#cartDetails,#cartmenuitem,#cartmenulink").on("click",function(){ hideCart(); }); >+ $("#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