Bugzilla – Attachment 102446 Details for
Bug 25027
Result browser should not overload onclick event
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25027: Use localStorage instead of sessionStorage for results browser
Bug-25027-Use-localStorage-instead-of-sessionStora.patch (text/plain), 3.24 KB, created by
Nick Clemens (kidclamp)
on 2020-04-06 13:51:32 UTC
(
hide
)
Description:
Bug 25027: Use localStorage instead of sessionStorage for results browser
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-04-06 13:51:32 UTC
Size:
3.24 KB
patch
obsolete
>From 6fa151416700c0baf465f5f9bae3220e11c3c110 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 31 Mar 2020 16:39:12 +0200 >Subject: [PATCH] Bug 25027: Use localStorage instead of sessionStorage for > results browser > >Staff side, when a search a done and a result clicked, a browser appears >on the left, to navigate between the different results. > >We use sessionStorage to know the list of biblionumber from the result. > >As sessionStorage is only for the current tab, we do some ugly things, >to catch the click events, then open the new tab, attach it to the >current window, and put the focus back on the result list. > >We really should not do that, and let the user decide what they want to >do with their clicks! > >To do so, let use the correct storage, localStorage, and have the >results shared between the windows. > >We may need to clear that at some point, isn't it? > >Test plan: >Launch a search, click result (left or middle), confirm you see the >browser and that the window/tab opened like any other websites >(depending on your web browser settings). > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > koha-tmpl/intranet-tmpl/js/browser.js | 22 ++++------------------ > 1 file changed, 4 insertions(+), 18 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/js/browser.js b/koha-tmpl/intranet-tmpl/js/browser.js >index 5763c7c3e6..120d710a2c 100644 >--- a/koha-tmpl/intranet-tmpl/js/browser.js >+++ b/koha-tmpl/intranet-tmpl/js/browser.js >@@ -11,7 +11,7 @@ KOHA.browser = function (searchid, biblionumber) { > } > me.searchid = searchid; > >- var searches_stored = sessionStorage.getItem('searches'); >+ var searches_stored = localStorage.getItem('searches'); > var current_search; > var searches = {}; > if ( searches_stored ) { >@@ -62,24 +62,10 @@ KOHA.browser = function (searchid, biblionumber) { > }; > } > searches[me.searchid] = current_search; >- sessionStorage.setItem('searches', JSON.stringify(searches)); >+ localStorage.setItem('searches', JSON.stringify(searches)); > $(document).ready(function () { >- //FIXME It's not a good idea to modify the click events >- $('#searchresults table tr a[href*="/detail.pl"]').on('click auxclick', function (ev) { >- ev.preventDefault(); >- }); >- $('#searchresults table tr a[href*="/detail.pl"]').on('mousedown', function (ev) { >- if ( ev.which == 2 || ev.which == 1 && ev.ctrlKey ) { >- // Middle click or ctrl + click >- ev.preventDefault(); >- var newwindow = window.open( $(this).attr('href') + '&searchid=' + me.searchid, '_blank' ); >- newwindow.blur(); >- window.focus(); >- } else if ( ev.which == 1 ) { >- // Left click >- ev.preventDefault(); >- window.location = $(this).attr('href') + '&searchid=' + me.searchid; >- } >+ $('#searchresults table tr a[href*="/detail.pl"]').each(function(){ >+ $(this).attr('href', $(this).attr('href') + '&searchid=' + me.searchid ); > }); > }); > }; >-- >2.11.0
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 25027
:
102144
|
102252
| 102446