Bugzilla – Attachment 173435 Details for
Bug 38251
"Remove selected items" button not removing single item in OPAC lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38251: Make 'Remove selected items' button work when there is one item
Bug-38251-Make-Remove-selected-items-button-work-w.patch (text/plain), 4.01 KB, created by
Martin Renvoize (ashimema)
on 2024-10-28 08:32:33 UTC
(
hide
)
Description:
Bug 38251: Make 'Remove selected items' button work when there is one item
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-10-28 08:32:33 UTC
Size:
4.01 KB
patch
obsolete
>From 094bb131fb622811be02ccbe797d34981545985a Mon Sep 17 00:00:00 2001 >From: Phil Ringnalda <phil@chetcolibrary.org> >Date: Thu, 24 Oct 2024 14:16:45 -0700 >Subject: [PATCH] Bug 38251: Make 'Remove selected items' button work when > there is one item > >There are two ways to remove items from a list: you can remove a single item >by clicking a 'Remove from this list' button below the item, or you can >remove one or more items by checking the checkboxes for them and clicking the >'Remove selected items' button. > >Bug 37150 needed to fix 'Remove from this list' for CSRF, because in the wild >old days it just triggered a GET to delete, and instead it needed to POST. >The first patch to do that defined the JS var single_bib, checked the >checkbox for that bib and submitted the form, as though you had used the >checkbox yourself. But if you cancelled the confirmation prompt, it would >need to uncheck the checkbox it checked, so it added a function to do that >if (single_bib). That patch didn't land. > >What landed instead was a patch with a separate hidden form that could be >populated with the single biblionumber from 'Remove from this list', but >without single_bib to define that state, it used selected_titles.size() == 1 >as the condition to use the hidden form, forgetting that when the user checks >a single checkbox, selected_titles.size() is also 1. The right condition is >the same one used to tell where to get the titles for the confirmation dialog: >if the click event passed along a biblionumber, it's 'Remove from this list.' >Since checking that sets var biblionumber, we can just use that being truthy >as the condition. > >Test plan: > 1. Without the patch, open the OPAC and log in > 2. Add any two biblios to a new list > 3. Lists - {your list name} > 4. Click the checkbox for one of the items, click 'Remove selected items' > and click 'Yes, remove from list' in the confirmation dialog > 5. Note that it wasn't removed > 6. Click the checkboxes for both items, click 'Remove selected items' and > click 'Yes, remove from list' in the confirmation dialog > 7. Note that both were removed > 8. Apply patch, restart_all > 9. Add any four items to your list >10. Lists - {your list name} >11. For the first item, click the 'Remove from this list' button below the > details for the item, confirm, make sure it was deleted >12. Click the checkbox for what's now the first item, click 'Remove from > this list,' confirm, make sure it was deleted >13. Click the checkboxes for what are now the first two items, click 'Remove > from this list,' confirm, make sure both were deleted > >Sponsored-by: Chetco Community Public Library >Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt | 8 +------- > 1 file changed, 1 insertion(+), 7 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 d012228a31f..143491b555c 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt >@@ -952,7 +952,7 @@ $(function() { > } > confirmModal( message, title, yes_label, no_label, function( result ){ > if( result ){ >- if( selected_titles.size() == 1 ){ >+ if( biblionumber ){ > $("#shelf_delete_biblionumber").val( biblionumber ); > $("#shelf_delete_title").submit(); > } else { >@@ -962,12 +962,6 @@ $(function() { > }); > } > }); >- $("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 ); >- } >- }); > [% END %] > > [% IF OpenLibraryCovers %]KOHA.OpenLibrary.GetCoverFromIsbn();[% END %] >-- >2.47.0
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 38251
:
173308
|
173411
| 173435