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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-3 / +14 lines)
Lines 448-454 Link Here
448
                        <div id="searchresults">
448
                        <div id="searchresults">
449
                            [% INCLUDE 'page-numbers.inc' %]
449
                            [% INCLUDE 'page-numbers.inc' %]
450
                            [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %]
450
                            [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %]
451
                                <button href="#" id="toggleitems" class="btn btn-primary btn-xs" style="float: right;">Show local items only</button>
451
                                <button href="#" id="toggleitems" class="btn btn-primary btn-xs show-local-items" style="float: right;">Show local items only</button>
452
                            [% END %]
452
                            [% END %]
453
                            <form action="/cgi-bin/koha/catalogue/search.pl" method="get" name="bookbag_form" id="bookbag_form">
453
                            <form action="/cgi-bin/koha/catalogue/search.pl" method="get" name="bookbag_form" id="bookbag_form">
454
                                [% IF ( searchdesc ) %]
454
                                [% IF ( searchdesc ) %]
Lines 806-813 Link Here
806
        var userbranch = "[% userbranch | html %]";
806
        var userbranch = "[% userbranch | html %]";
807
807
808
        [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %]
808
        [% IF Koha.Preference('FilterSearchResultsByLoggedInBranch') %]
809
            $(document).ready( function() {
810
                if ( Cookies.get("show_local_items") == 'local' )  {
811
                    $('#toggleitems').click();
812
                }
813
            });
809
            $('#toggleitems').click( function() {
814
            $('#toggleitems').click( function() {
810
                $('#toggleitems').text() === 'Show local items only' ? $('#toggleitems').text("Show items in all libraries") : $('#toggleitems').text("Show local items only");
815
                $('#toggleitems').text($('#toggleitems').text() === 'Show local items only' ? 'Show items in all libraries' : 'Show local items only');
811
                $('.branch_specific').toggle();
816
                $('.branch_specific').toggle();
812
                $('.all').toggle();
817
                $('.all').toggle();
813
                $('ul[class*="_loop_items"] li').each( function() {
818
                $('ul[class*="_loop_items"] li').each( function() {
Lines 815-820 Link Here
815
                        $(this).toggle();
820
                        $(this).toggle();
816
                    }
821
                    }
817
                });
822
                });
823
824
                $(this).toggleClass('show-local-items show-all-items');
825
                if ($(this).hasClass('show-local-items')) {
826
                    Cookies.set("show_local_items", 'all', { path: '/', sameSite: 'Lax' });
827
                } else {
828
                    Cookies.set("show_local_items", 'local', { path: '/', sameSite: 'Lax' });
829
                }
818
            });
830
            });
819
        [% END %]
831
        [% END %]
820
        [% IF SEARCH_RESULTS %]
832
        [% IF SEARCH_RESULTS %]
821
- 

Return to bug 37883