Bugzilla – Attachment 167965 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), 4.29 KB, created by
Owen Leonard
on 2024-06-21 14:33:51 UTC
(
hide
)
Description:
Bug 37150: Can't delete single title from a list using the "Remove from list" link
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2024-06-21 14:33:51 UTC
Size:
4.29 KB
patch
obsolete
>From edf1440ccf53af3cf8cdacd949bfe71f80facd96 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 21 Jun 2024 12:32:41 +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 achieves >this by using the existing form, automatically checking the checkbox >corresponding to the "Remove" link which has been clicked. > >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. > - Cancelling should close the modal and uncheck the title's checkbox > * I include automatic un-checking of the checkbox because the user > didn't "deliberately" check the box, and I want to avoid having > that title included with "deliberately" checked items. > - 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. > - Cancelling should hide the modal, and your checked checkboxes > should remain the same. > >Sponsored-by: Athens County Public Libraries >--- > .../bootstrap/en/modules/opac-shelves.tt | 25 +++++++++++-------- > 1 file changed, 15 insertions(+), 10 deletions(-) > >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 0686b5d506..6deb5a5af4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -983,20 +983,23 @@ $(function() { > [% END %] > > [% IF loggedinusername && can_remove_biblios %] >+ let single_bib; >+ let selected_titles; > $("body").on("click", ".removeitems", function(e){ > e.preventDefault(); >- var href; >+ single_bib = $(this).data("biblionumber"); > var title; > var yes_label; > var no_label; > var message = ""; > /* Single "Remove from list" link has a biblionumber data-attribute */ >- if( $(this).data("biblionumber") ){ >+ if( single_bib ){ > /* 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"); >+ selected_titles = $(".cb[value='" + single_bib + "'"); >+ /* Check the box automatically so we can submit the form from the modal */ >+ selected_titles.prop("checked", true ); > } else { >- var selected_titles = $(".cb:checked"); >+ selected_titles = $(".cb:checked"); > } > if ( selected_titles.size() < 1 ) { > alert( _("No item was selected") ); >@@ -1019,15 +1022,17 @@ $(function() { > } > confirmModal( message, title, yes_label, no_label, function( result ){ > if( result ){ >- if( href ){ >- location.href= href; >- } else { >- $("#myform").submit(); >- } >+ $("#myform").submit(); > } > }); > } > }); >+ $("body").on("hidden.bs.modal", "#bootstrap-confirm-box-modal", function(){ >+ /* If the user clicked a single "Remove from list" link, uncheck the checkbox */ >+ if( single_bib ){ >+ selected_titles.prop("checked", false ); >+ } >+ }); > > $("#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 %] >-- >2.39.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