View | Details | Raw Unified | Return to bug 41422
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-7 / +14 lines)
Lines 556-562 Link Here
556
            <div id="searchresults">
556
            <div id="searchresults">
557
                [% INCLUDE 'page-numbers.inc' %]
557
                [% INCLUDE 'page-numbers.inc' %]
558
                [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %]
558
                [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %]
559
                    <button href="#" id="toggleitems" class="btn btn-primary btn-xs show-local-items" style="float: right;">Show local items only</button>
559
                    <button id="toggleitems" class="btn btn-primary btn-xs" data-mode="all" style="float: right;">
560
                        <span class="when-all">[% t("Show local items only") | html %]</span>
561
                        <span class="when-local" style="display:none">[% t("Show items in all libraries") | html %]</span>
562
                    </button>
560
                [% END %]
563
                [% END %]
561
                <form action="/cgi-bin/koha/catalogue/search.pl" method="get" name="bookbag_form" id="bookbag_form">
564
                <form action="/cgi-bin/koha/catalogue/search.pl" method="get" name="bookbag_form" id="bookbag_form">
562
                    [% IF ( searchdesc ) %]
565
                    [% IF ( searchdesc ) %]
Lines 986-992 Link Here
986
                }
989
                }
987
            });
990
            });
988
            $('#toggleitems').click( function() {
991
            $('#toggleitems').click( function() {
989
                $('#toggleitems').text() === 'Show local items only' ? $('#toggleitems').text("Show items in all libraries") : $('#toggleitems').text("Show local items only");
992
                let this_toggle = $(this);
993
                let show_all = this_toggle.data('mode') === 'all';
994
995
                this_toggle.find('.when-local, .when-all').toggle();
996
                this_toggle.data('mode', show_all ? 'local' : 'all');
997
990
                $('.branch_specific').toggle();
998
                $('.branch_specific').toggle();
991
                $('.all').toggle();
999
                $('.all').toggle();
992
                $('ul[class*="_loop_items"] li').each( function() {
1000
                $('ul[class*="_loop_items"] li').each( function() {
Lines 994-1004 Link Here
994
                        $(this).toggle();
1002
                        $(this).toggle();
995
                    }
1003
                    }
996
                });
1004
                });
997
                $(this).toggleClass('show-local-items show-all-items');
1005
998
                if ($(this).hasClass('show-local-items')) {
1006
                if (show_all) {
999
                    localStorage.setItem("show_local_items", 'all');
1000
                } else {
1001
                    localStorage.setItem("show_local_items", 'local');
1007
                    localStorage.setItem("show_local_items", 'local');
1008
                } else {
1009
                    localStorage.setItem("show_local_items", 'all');
1002
                }
1010
                }
1003
            });
1011
            });
1004
        [% END %]
1012
        [% END %]
1005
- 

Return to bug 41422