Bugzilla – Attachment 168240 Details for
Bug 37150
Can't delete single title from a list using the "Remove from list" link
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37150: Can't delete single title from a list using the "Remove from list" link
Bug-37150-Cant-delete-single-title-from-a-list-usi.patch (text/plain), 8.21 KB, created by
Martin Renvoize (ashimema)
on 2024-06-28 13:53:28 UTC
(
hide
)
Description:
Bug 37150: Can't delete single title from a list using the "Remove from list" link
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-28 13:53:28 UTC
Size:
8.21 KB
patch
obsolete
>From 6d9ed2ab5b1b48732a7ea31e484fc81fed060b46 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Mon, 24 Jun 2024 14:46:36 +0000 >Subject: [PATCH] Bug 37150: Can't delete single title from a list using the > "Remove from list" link > >In the OPAC display of titles on a list, the "Remove from list" control >needs to trigger a POST operation instead of GET. This patch >appends a form for handling single entry deletions, populating >the hidden input upon confirmation. > >To test, apply the patch and create a list if necessary, adding multiple >titles to it. > >- View the contents of your list. >- Each title on your list should have a "Remove from this list" link. > - Click one of these. You should see a modal confirmation, "Are you > sure you want to remove this item from the list?" > - Confirming should delete the title form the list. > - Check multiple checkboxes in the list of titles and click "Remove > from list" at the top of the list. > - You should see a modal confirmation, "Are you sure you want to > remove these items from the list?" > - Confirming should result in all checked titles being removed > from the list. > - Check one or more checkboxes and then click a single "Remove from > list" link. After confirming, you should find that only the one > title was removed from the list. > >Sponsored-by: Athens County Public Libraries >Signed-off-by: Eric Garcia <cubingguy714@gmail.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../en/includes/title-actions-menu.inc | 2 +- > .../bootstrap/en/modules/opac-shelves.tt | 29 ++++++++++++------- > 2 files changed, 20 insertions(+), 11 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc >index d2b050cd4fb..56edfd17955 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/title-actions-menu.inc >@@ -52,7 +52,7 @@ > [% IF ( shelf AND op == 'view' ) %] > <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> > [% IF can_remove_biblios %] >- <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&shelfnumber=[% shelf.shelfnumber | html %]&biblionumber=[% items.biblionumber | html %]"><i class="fa fa-remove" aria-hidden="true"></i> Remove from this list</a></span> >+ <span class="actions"><a class="btn btn-link btn-sm removeitems" data-biblionumber="[% items.biblionumber | html %]" href="#"><i class="fa fa-remove" aria-hidden="true"></i> Remove from this list</a></span> > [% END %] > [% ELSE %] > <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> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >index 0686b5d506b..0990eedd83f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -383,7 +383,7 @@ > </span> > [% END %] > [% IF loggedinusername && can_remove_biblios %] >- <span id="removeitems"></span> >+ <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> > [% END %] > </div> <!-- / .links --> > </div> <!-- / .selections-toolbar --> >@@ -547,6 +547,15 @@ > <input type="submit" value="Remove selected items" id="remove-selected" class="btn btn-danger removeitems"/> > [% END %] > </form> <!-- /myform --> >+ [% IF can_manage_shelf %] >+ <form action="/cgi-bin/koha/opac-shelves.pl" method="post" id="shelf_delete_title"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input type="hidden" name="op" value="cud-remove_biblios" /> >+ <input type="hidden" name="shelfnumber" value="[% shelf.shelfnumber | html %]" /> >+ <input type="hidden" name="biblionumber" id="shelf_delete_biblionumber" value="" /> >+ <input type="hidden" name="modifyshelfcontents" value="1" /> >+ </form> >+ [% END %] > [% ELSE %] > <div id="toolbar" class="toolbar clearfix"> > <div class="list-actions"> >@@ -985,16 +994,16 @@ $(function() { > [% IF loggedinusername && can_remove_biblios %] > $("body").on("click", ".removeitems", function(e){ > e.preventDefault(); >- var href; > var title; > var yes_label; > var no_label; > var message = ""; >+ var biblionumber; > /* Single "Remove from list" link has a biblionumber data-attribute */ > if( $(this).data("biblionumber") ){ > /* Use the checkbox with that value to preview the title in the confirmation */ > var selected_titles = $(".cb[value='" + $(this).data("biblionumber") + "'"); >- var href = $(this).attr("href"); >+ biblionumber = $(this).data("biblionumber"); > } else { > var selected_titles = $(".cb:checked"); > } >@@ -1004,23 +1013,24 @@ $(function() { > if( selected_titles.size() > 1 ){ > message = $("<ul></ul>"); > title = _("Are you sure you want to remove these items from the list?"); >- yes_label = _("Yes, delete from list"); >- no_label = _("No, do not delete from list"); >+ yes_label = _("Yes, remove from list"); >+ no_label = _("No, do not remove from list"); > selected_titles.each(function(){ > message.append( "<li>" + $(this).data("title") + "</li>" ); > }); > } else { > title = _("Are you sure you want to remove this item from the list?"); >- yes_label = _("Yes, delete from list"); >- no_label = _("No, do not delete from list"); >+ yes_label = _("Yes, remove from list"); >+ no_label = _("No, do not remove from list"); > selected_titles.each(function(){ > message += $(this).data("title"); > }); > } > confirmModal( message, title, yes_label, no_label, function( result ){ > if( result ){ >- if( href ){ >- location.href= href; >+ if( selected_titles.size() == 1 ){ >+ $("#shelf_delete_biblionumber").val( biblionumber ); >+ $("#shelf_delete_title").submit(); > } else { > $("#myform").submit(); > } >@@ -1029,7 +1039,6 @@ $(function() { > } > }); > >- $("#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>"); > [% END %] > [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %] > [% IF OPACLocalCoverImages %]KOHA.LocalCover.GetCoverFromBibnumber(false);[% END %] >-- >2.45.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 37150
:
167965
|
168015
|
168022
| 168240