Bugzilla – Attachment 168845 Details for
Bug 37309
Improve delete and modify items links on the bibliographic detail page
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37309: Improve Delete and Modify items links on the biblio detail page
Bug-37309-Improve-Delete-and-Modify-items-links-on.patch (text/plain), 5.50 KB, created by
Pedro Amorim
on 2024-07-11 16:43:16 UTC
(
hide
)
Description:
Bug 37309: Improve Delete and Modify items links on the biblio detail page
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-07-11 16:43:16 UTC
Size:
5.50 KB
patch
obsolete
>From 21812e4835896665f5600c42c36dbb0efdff4fb6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 11 Jul 2024 09:50:43 +0200 >Subject: [PATCH] Bug 37309: Improve Delete and Modify items links on the > biblio detail page > >The way the "Delete selected items" and "Modify selected items" links >are build on the bibliographic detail page is not nice. We could do >better, for instance using a proper form element instead of building an >URL. > >Test plan: >Go to the detail page of a bibliographic record which has several items. >In the items table check some checkboxes and play with "select all", >"clear all" and the action buttons. >Notice that everything works as before. > >Minor UI regression that must be fixed: there are CSS rules that cause >problem. When the action links are displayed or hidden the table is >moving up and down. >I think the problematic rules are: > .btn { > padding: 6px 12px; > font-size: 12px; > } >It makes the UI better if I remove them but still get the bumping >issue. > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >--- > .../tables/items/catalogue_detail.inc | 54 ++++++++++--------- > 1 file changed, 29 insertions(+), 25 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >index f7ca251121..2171da8e3a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >@@ -57,10 +57,23 @@ > <span class="itemselection_actions"> > | Actions: > [% IF CAN_user_tools_items_batchdel %] >- <a class="itemselection_action_delete"><i class="fa fa-trash-can"></i> Delete selected items</a> >+ <form id="itemselection_action_delete_form" method="post" action="/cgi-bin/koha/tools/batchMod.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input name='src' type='hidden' value='CATALOGUING' /> >+ <input name='biblionumber' type='hidden' value="[% biblionumber | html %]" /> >+ <input name='op' type='hidden' value='cud-show' /> >+ <input name='del' type='hidden' value='1' /> >+ <button type="submit" class="itemselection_action_delete btn btn-link" /><i class="fa fa-trash-can"></i> Delete selected items</button> >+ </form> > [% END %] > [% IF CAN_user_tools_items_batchmod %] >- <a class="itemselection_action_modify"><i class="fa-solid fa-pencil"></i> Modify selected items</a> >+ <form id="itemselection_action_modify_form" method="post" action="/cgi-bin/koha/tools/batchMod.pl"> >+ [% INCLUDE 'csrf-token.inc' %] >+ <input name='src' type='hidden' value='CATALOGUING' /> >+ <input name='biblionumber' type='hidden' value="[% biblionumber | html %]" /> >+ <input name='op' type='hidden' value='cud-show' /> >+ <button type="submit" class="itemselection_action_modify btn btn-link" /><i class="fa-solid fa-pencil"></i> Modify selected items</button> >+ </form> > [% END %] > [% IF CAN_user_editcatalogue_manage_item_groups && biblio.item_groups.count %] > <a class="itemselection_action_item_group_set" href="#"><i class="fa fa-book"></i> Add/move to item group</a> >@@ -81,32 +94,23 @@ > [% IF StaffDetailItemSelection %] > > let items_selection = {}; >- function itemSelectionBuildDeleteLink(tab_id) { >+ >+ function _itemSelectionBuildLink(tab_id, form) { >+ > var itemnumbers = items_selection[tab_id]; >- if (itemnumbers.length > 0) { >- var url = '/cgi-bin/koha/tools/batchMod.pl?op=show&del=1'; >- url += '&itemnumber=' + itemnumbers.join('&itemnumber='); >- url += '&biblionumber=[% biblionumber | uri %]'; >- url += '&src=CATALOGUING'; >- $('a.itemselection_action_delete').attr('href', url); >- } else { >- return false; >- } >- return true >- } > >+ $(form).find("input[name='itemnumber']").remove(); >+ >+ $(itemnumbers).each(function() { >+ $(form).append("<input name='itemnumber' type='hidden' value='%s'/>".format(this)); >+ }); >+ return !!itemnumbers.length >+ } >+ function itemSelectionBuildDeleteLink(tab_id) { >+ return _itemSelectionBuildLink(tab_id, $('#itemselection_action_delete_form')); >+ } > function itemSelectionBuildModifyLink(tab_id) { >- var itemnumbers = items_selection[tab_id]; >- if (itemnumbers.length > 0) { >- var url = '/cgi-bin/koha/tools/batchMod.pl?op=show'; >- url += '&itemnumber=' + itemnumbers.join('&itemnumber='); >- url += '&biblionumber=[% biblionumber | uri %]'; >- url += '&src=CATALOGUING'; >- $('a.itemselection_action_modify').attr('href', url); >- } else { >- return false; >- } >- return true; >+ return _itemSelectionBuildLink(tab_id, $('#itemselection_action_modify_form')); > } > > function itemSelectionBuildActionLinks(tab_id) { >-- >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 37309
:
168777
|
168797
|
168798
|
168799
|
168802
|
168844
| 168845 |
168846
|
168847
|
168848
|
170307
|
170309
|
170700