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 394-400 Link Here
394
                                                    [% ELSE %]
394
                                                    [% ELSE %]
395
                                                        [% check_title = itemsloo.biblionumber %]
395
                                                        [% check_title = itemsloo.biblionumber %]
396
                                                    [% END %]
396
                                                    [% END %]
397
                                                    <td class="selectcol"><input type="checkbox" class="cb" name="biblionumber" value="[% itemsloo.biblionumber | html %]" aria-label="[% check_title | html %]"/></td>
397
                                                    <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>
398
                                                    [% UNLESS ( item_level_itypes ) %]
398
                                                    [% UNLESS ( item_level_itypes ) %]
399
                                                        <td>
399
                                                        <td>
400
                                                            [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
400
                                                            [% UNLESS ( Koha.Preference('OpacNoItemTypeImages') ) %]
Lines 533-539 Link Here
533
                                    <input type="hidden" name="op" value="remove_biblios" />
533
                                    <input type="hidden" name="op" value="remove_biblios" />
534
                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
534
                                    <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" />
535
                                    <input type="hidden" name="modifyshelfcontents" value="1" />
535
                                    <input type="hidden" name="modifyshelfcontents" value="1" />
536
                                    <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger"/>
536
                                    <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger removeitems"/>
537
                                [% END %]
537
                                [% END %]
538
                            </form> <!-- /myform -->
538
                            </form> <!-- /myform -->
539
                        [% ELSE %]
539
                        [% ELSE %]
Lines 972-1000 $(function() { Link Here
972
    [% END %]
972
    [% END %]
973
973
974
    [% IF loggedinusername && can_remove_biblios %]
974
    [% IF loggedinusername && can_remove_biblios %]
975
        $(".removefromlist").on("click", function(e){
975
        $("body").on("click", ".removeitems", function(e){
976
            return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
976
            e.preventDefault();
977
        });
977
            var href;
978
978
            var title;
979
        $("#myform").submit(function(){
979
            var yes_label;
980
            var checkedBoxes = $(".cb:checked");
980
            var no_label;
981
            var numchecked = $(checkedBoxes).size();
981
            var message = "";
982
            if (numchecked) {
982
            /* Single "Remove from list" link has a biblionumber data-attribute */
983
                if( numchecked > 1 ){
983
            if( $(this).data("biblionumber") ){
984
                    return confirmDelete(MSG_REMOVE_FROM_LIST);
984
                /* Use the checkbox with that value to preview the title in the confirmation */
985
                } else {
985
                var selected_titles = $(".cb[value='" + $(this).data("biblionumber") + "'");
986
                    return confirmDelete(MSG_REMOVE_ONE_FROM_LIST);
986
                var href = $(this).attr("href");
987
                }
988
            } else {
987
            } else {
988
                var selected_titles = $(".cb:checked");
989
            }
990
            if ( selected_titles.size() < 1 ) {
989
                alert( _("No item was selected") );
991
                alert( _("No item was selected") );
990
                return false;
992
            } else {
993
                if( selected_titles.size() > 1 ){
994
                    message = $("<ul></ul>");
995
                    title = _("Are you sure you want to remove these items from the list?");
996
                    yes_label = _("Yes, delete from list");
997
                    no_label = _("No, do not delete from list");
998
                    selected_titles.each(function(){
999
                        message.append( "<li>" +  $(this).data("title") + "</li>" );
1000
                    });
1001
                } else {
1002
                    title = _("Are you sure you want to remove this item from the list?");
1003
                    yes_label = _("Yes, delete from list");
1004
                    no_label = _("No, do not delete from list");
1005
                    selected_titles.each(function(){
1006
                        message += $(this).data("title");
1007
                    });
1008
                }
1009
                confirmModal( message, title, yes_label, no_label, function( result ){
1010
                    if( result ){
1011
                        if( href ){
1012
                            location.href= href;
1013
                        } else {
1014
                            $("#myform").submit();
1015
                        }
1016
                    }
1017
                });
991
            }
1018
            }
992
        });
1019
        });
993
        $("#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>")
1020
994
        .click(function(){
1021
        $("#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>");
995
            $("#myform").submit();
996
            return false;
997
        });
998
    [% END %]
1022
    [% END %]
999
    [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
1023
    [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %]
1000
    [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
1024
    [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %]
1001
- 

Return to bug 26824