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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (-11 / +15 lines)
Lines 983-1002 $(function() { Link Here
983
    [% END %]
983
    [% END %]
984
984
985
    [% IF loggedinusername && can_remove_biblios %]
985
    [% IF loggedinusername && can_remove_biblios %]
986
        let single_bib;
987
        let selected_titles;
986
        $("body").on("click", ".removeitems", function(e){
988
        $("body").on("click", ".removeitems", function(e){
987
            e.preventDefault();
989
            e.preventDefault();
988
            var href;
990
            single_bib = $(this).data("biblionumber");
989
            var title;
991
            var title;
990
            var yes_label;
992
            var yes_label;
991
            var no_label;
993
            var no_label;
992
            var message = "";
994
            var message = "";
993
            /* Single "Remove from list" link has a biblionumber data-attribute */
995
            /* Single "Remove from list" link has a biblionumber data-attribute */
994
            if( $(this).data("biblionumber") ){
996
            if( single_bib ){
995
                /* Use the checkbox with that value to preview the title in the confirmation */
997
                /* Use the checkbox with that value to preview the title in the confirmation */
996
                var selected_titles = $(".cb[value='" + $(this).data("biblionumber") + "'");
998
                selected_titles = $(".cb[value='" + single_bib + "'");
997
                var href = $(this).attr("href");
999
                /* Check the box automatically so we can submit the form from the modal */
1000
                selected_titles.prop("checked", true );
998
            } else {
1001
            } else {
999
                var selected_titles = $(".cb:checked");
1002
                selected_titles = $(".cb:checked");
1000
            }
1003
            }
1001
            if ( selected_titles.size() < 1 ) {
1004
            if ( selected_titles.size() < 1 ) {
1002
                alert( _("No item was selected") );
1005
                alert( _("No item was selected") );
Lines 1019-1033 $(function() { Link Here
1019
                }
1022
                }
1020
                confirmModal( message, title, yes_label, no_label, function( result ){
1023
                confirmModal( message, title, yes_label, no_label, function( result ){
1021
                    if( result ){
1024
                    if( result ){
1022
                        if( href ){
1025
                        $("#myform").submit();
1023
                            location.href= href;
1024
                        } else {
1025
                            $("#myform").submit();
1026
                        }
1027
                    }
1026
                    }
1028
                });
1027
                });
1029
            }
1028
            }
1030
        });
1029
        });
1030
        $("body").on("hidden.bs.modal", "#bootstrap-confirm-box-modal", function(){
1031
            /* If the user clicked a single "Remove from list" link, uncheck the checkbox */
1032
            if( single_bib ){
1033
                selected_titles.prop("checked", false );
1034
            }
1035
        });
1031
1036
1032
        $("#removeitems").html("<a href=\"#\" class=\"btn btn-link disabled removeitems tag_hides\"><i class=\"fa fa-fw fa-remove\" aria-hidden=\"true\"></i> "+_("Remove from list")+"</a>");
1037
        $("#removeitems").html("<a href=\"#\" class=\"btn btn-link disabled removeitems tag_hides\"><i class=\"fa fa-fw fa-remove\" aria-hidden=\"true\"></i> "+_("Remove from list")+"</a>");
1033
    [% END %]
1038
    [% END %]
1034
- 

Return to bug 37150