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

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc (-1 / +1 lines)
Lines 52-58 Link Here
52
        [% IF ( shelf AND op == 'view' ) %]
52
        [% IF ( shelf AND op == 'view' ) %]
53
            <span class="actions"><a href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% items.biblionumber | uri %]" class="addtoshelf btn btn-link btn-sm"><i class="fa fa-list" aria-hidden="true"></i> Save to another list</a></span>
53
            <span class="actions"><a href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% items.biblionumber | uri %]" class="addtoshelf btn btn-link btn-sm"><i class="fa fa-list" aria-hidden="true"></i> Save to another list</a></span>
54
            [% IF can_remove_biblios %]
54
            [% IF can_remove_biblios %]
55
                <span class="actions"><a class="btn btn-link btn-sm removefromlist" href="/cgi-bin/koha/opac-shelves.pl?op=remove_biblios&amp;shelfnumber=[% shelf.shelfnumber | html %]&amp;biblionumber=[% items.biblionumber | html %]"><i class="fa fa-times" aria-hidden="true"></i> Remove from this list</a></span>
55
                <span class="actions"><a class="btn btn-link btn-sm removeitems" data-biblionumber="[% items.biblionumber | html %]" href="/cgi-bin/koha/opac-shelves.pl?op=remove_biblios&amp;shelfnumber=[% shelf.shelfnumber | html %]&amp;biblionumber=[% items.biblionumber | html %]"><i class="fa fa-remove" aria-hidden="true"></i> Remove from this list</a></span>
56
            [% END %]
56
            [% END %]
57
        [% ELSE %]
57
        [% ELSE %]
58
            <span class="actions"><a class="addtoshelf btn btn-link btn-sm" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% items.biblionumber | html %]"><i class="fa fa-list" aria-hidden="true"></i> Save to lists</a></span>
58
            <span class="actions"><a class="addtoshelf btn btn-link btn-sm" href="/cgi-bin/koha/opac-addbybiblionumber.pl?biblionumber=[% items.biblionumber | html %]"><i class="fa fa-list" aria-hidden="true"></i> Save to lists</a></span>
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt (-22 / +45 lines)
Lines 402-408 Link Here
402
                                                    [% ELSE %]
402
                                                    [% ELSE %]
403
                                                        [% check_title = itemsloo.biblionumber %]
403
                                                        [% check_title = itemsloo.biblionumber %]
404
                                                    [% END %]
404
                                                    [% END %]
405
                                                    <td class="selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber | html %]" aria-label="[% check_title | html %]"/></td>
405
                                                    <td class="select selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber | html %]" data-title="[% itemsloo.title | html %]" aria-label="[% check_title | html %]"/></td>
406
                                                    [% UNLESS ( item_level_itypes ) %]
406
                                                    [% UNLESS ( item_level_itypes ) %]
407
                                                        <td>
407
                                                        <td>
408
                                                            [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
408
                                                            [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
Lines 541-547 Link Here
541
                                    <input type="hidden" name="op" value="remove_biblios" />
541
                                    <input type="hidden" name="op" value="remove_biblios" />
542
                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
542
                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
543
                                    <input type="hidden" name="modifyshelfcontents" value="1" />
543
                                    <input type="hidden" name="modifyshelfcontents" value="1" />
544
                                    <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
544
                                    <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger removeitems"/>
545
                                [% END %]
545
                                [% END %]
546
                            </form> <!-- /myform -->
546
                            </form> <!-- /myform -->
547
                        [% ELSE %]
547
                        [% ELSE %]
Lines 980-1008 $(function() { Link Here
980
    [% END %]
980
    [% END %]
981
981
982
    [% IF loggedinusername && can_remove_biblios %]
982
    [% IF loggedinusername && can_remove_biblios %]
983
        $(".removefromlist").on("click", function(e){
983
        $("body").on("click", ".removeitems", function(e){
984
            return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
984
            e.preventDefault();
985
        });
985
            var href;
986
986
            var title;
987
        $("#myform").submit(function(){
987
            var yes_label;
988
            var checkedBoxes = $(".cb:checked");
988
            var no_label;
989
            var numchecked = $(checkedBoxes).size();
989
            var message = "";
990
            if (numchecked) {
990
            /* Single "Remove from list" link has a biblionumber data-attribute */
991
                if( numchecked > 1 ){
991
            if( $(this).data("biblionumber") ){
992
                    return confirmDelete(MSG_REMOVE_FROM_LIST);
992
                /* Use the checkbox with that value to preview the title in the confirmation */
993
                } else {
993
                var selected_titles = $(".cb[value='" + $(this).data("biblionumber") + "'");
994
                    return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
994
                var href = $(this).attr("href");
995
                }
996
            } else {
995
            } else {
996
                var selected_titles = $(".cb:checked");
997
            }
998
            if ( selected_titles.size() < 1 ) {
997
                alert( _("No item was selected") );
999
                alert( _("No item was selected") );
998
                return false;
1000
            } else {
1001
                if( selected_titles.size() > 1 ){
1002
                    message = $("<ul></ul>");
1003
                    title = _("Are you sure you want to remove these items from the list?");
1004
                    yes_label = _("Yes, delete from list");
1005
                    no_label = _("No, do not delete from list");
1006
                    selected_titles.each(function(){
1007
                        message.append( "<li>" +  $(this).data("title") + "</li>" );
1008
                    });
1009
                } else {
1010
                    title = _("Are you sure you want to remove this item from the list?");
1011
                    yes_label = _("Yes, delete from list");
1012
                    no_label = _("No, do not delete from list");
1013
                    selected_titles.each(function(){
1014
                        message += $(this).data("title");
1015
                    });
1016
                }
1017
                confirmModal( message, title, yes_label, no_label, function( result ){
1018
                    if( result ){
1019
                        if( href ){
1020
                            location.href= href;
1021
                        } else {
1022
                            $("#myform").submit();
1023
                        }
1024
                    }
1025
                });
999
            }
1026
            }
1000
        });
1027
        });
1001
        $("#removeitems").html("<a href=\"#\" class=\"btn btn-link disabled removeitems tag_hides\"><i class=\"fa fa-fw fa-times\" aria-hidden=\"true\"></i> "+_("Remove from list")+"</a>")
1028
1002
        .click(function(){
1029
        $("#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>");
1003
            $("#myform").submit();
1004
            return false;
1005
        });
1006
    [% END %]
1030
    [% END %]
1007
    [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
1031
    [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
1008
    [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
1032
    [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
1009
- 

Return to bug 26824