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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt (-6 / +23 lines)
Lines 195-200 Link Here
195
    [% Asset.js("lib/hc-sticky.js") | $raw %]
195
    [% Asset.js("lib/hc-sticky.js") | $raw %]
196
    [% Asset.js("js/members-menu.js") | $raw %]
196
    [% Asset.js("js/members-menu.js") | $raw %]
197
    <script>
197
    <script>
198
        var dtMemberResults;
199
        var search = 1;
200
        /* popstate event triggered by forward and back button. Need to refresh search */
201
        window.addEventListener('popstate', (event) => {
202
            getSearchByLocation();
203
        });
204
198
        $(document).ready(function() {
205
        $(document).ready(function() {
199
            $('#merge-patrons').prop('disabled', true);
206
            $('#merge-patrons').prop('disabled', true);
200
            $('#memberresultst').on('change', 'input.selection', function() {
207
            $('#memberresultst').on('change', 'input.selection', function() {
Lines 312-322 Link Here
312
            });
319
            });
313
            $("#searchform").on("submit", filter);
320
            $("#searchform").on("submit", filter);
314
321
315
        });
316
317
        var dtMemberResults;
318
        var search = 1;
319
        $(document).ready(function() {
320
            [% IF searchmember %]
322
            [% IF searchmember %]
321
                $("#searchmember_filter").val("[% searchmember | html %]");
323
                $("#searchmember_filter").val("[% searchmember | html %]");
322
            [% END %]
324
            [% END %]
Lines 461-468 Link Here
461
                }
463
                }
462
            }, columns_settings);
464
            }, columns_settings);
463
            update_searched();
465
            update_searched();
466
            /* Initial page load doesn't trigger the popstate event, so we explicitly call this */
467
            getSearchByLocation();
468
464
        });
469
        });
465
470
471
        function getSearchByLocation(){
472
            if( location.search != ""){
473
                var params = new URLSearchParams( location.search );
474
                var firstletter = params.get("firstletter");
475
                if( firstletter ){
476
                    filterByFirstLetterSurname( firstletter );
477
                }
478
            }
479
        }
480
466
        // Update the string "Results found ..."
481
        // Update the string "Results found ..."
467
        function update_searched(){
482
        function update_searched(){
468
            var searched = $("#searchfieldstype_filter").find("option:selected").text();
483
            var searched = $("#searchfieldstype_filter").find("option:selected").text();
Lines 502-507 Link Here
502
            $("#firstletter_filter").val('');
517
            $("#firstletter_filter").val('');
503
            $("#searchmember_filter").val('');
518
            $("#searchmember_filter").val('');
504
            if(redraw) {
519
            if(redraw) {
520
                /* remove any search string added by firstletter search */
521
                history.pushState( {}, null, window.location.href.split("?" )[0]);
505
                search = 1;
522
                search = 1;
506
                $("#searchresults").show();
523
                $("#searchresults").show();
507
                dtMemberResults.fnDraw();
524
                dtMemberResults.fnDraw();
Lines 512-517 Link Here
512
        function filterByFirstLetterSurname(letter) {
529
        function filterByFirstLetterSurname(letter) {
513
            clearFilters(false);
530
            clearFilters(false);
514
            $("#firstletter_filter").val(letter);
531
            $("#firstletter_filter").val(letter);
532
            history.pushState( null, null, "?firstletter=" + letter );
515
            update_searched();
533
            update_searched();
516
            search = 1;
534
            search = 1;
517
            $("#searchresults").show();
535
            $("#searchresults").show();
518
- 

Return to bug 27725