diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 42071b90e4..6ac6764963 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -556,7 +556,10 @@
[% INCLUDE 'page-numbers.inc' %] [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %] - + [% END %]
[% IF ( searchdesc ) %] @@ -986,7 +989,12 @@ } }); $('#toggleitems').click( function() { - $('#toggleitems').text() === 'Show local items only' ? $('#toggleitems').text("Show items in all libraries") : $('#toggleitems').text("Show local items only"); + let this_toggle = $(this); + let show_all = this_toggle.data('mode') === 'all'; + + this_toggle.find('.when-local, .when-all').toggle(); + this_toggle.data('mode', show_all ? 'local' : 'all'); + $('.branch_specific').toggle(); $('.all').toggle(); $('ul[class*="_loop_items"] li').each( function() { @@ -994,11 +1002,11 @@ $(this).toggle(); } }); - $(this).toggleClass('show-local-items show-all-items'); - if ($(this).hasClass('show-local-items')) { - localStorage.setItem("show_local_items", 'all'); - } else { + + if (show_all) { localStorage.setItem("show_local_items", 'local'); + } else { + localStorage.setItem("show_local_items", 'all'); } }); [% END %]