From 62d9f73e9e3bfe7fbca1340c753b75c951aceaf1 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 15 Feb 2024 09:13:15 +0000 Subject: [PATCH] Bug 34478: Changes for authorities/searchresultlist (new delete form) Replaces a delete with GET. FIXME: Trouble with closing dropdown. Signed-off-by: Jonathan Druart --- .../prog/en/includes/authorities_js.inc | 31 ++++++------------- .../modules/authorities/searchresultlist.tt | 19 +++++++++++- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc index b363ba106c..9b2ca85c9b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc @@ -32,30 +32,17 @@ function showMergingInProgress() { } } -function confirm_deletion(id) { - var is_confirmed = confirm(_("Are you sure you want to delete this authority?")); - if( !id ){ - id = "[% authid | html %]"; - } - if (is_confirmed) { - window.location="authorities-home.pl?op=delete" - + "&authid=" + id - + "&type=intranet" - + "&authtypecode=[% authtypecode | html %]" - + "&marclist=[% marclist | html %]" - + "&and_or=[% and_or | html %]" - + "&excluding=[% excluding | html %]" - + "&operator=[% operator | html %]" - + "&orderby=[% orderby | html %]" - + "&value=[% value |uri %]" - + "&startfrom=[% startfrom | html %]" - + "&resultsperpage=[% resultsperpage | html %]" - + "&csrf_token=[% csrf_token | html %]"; - } -} - $(document).ready(function () { showMergingInProgress(); + + $('.form_delete').submit(function() { + if ( confirm(_("Are you sure you want to delete this authority?")) ) { + return true; + } + // FIXME Close the dropdown $(this).closest('ul.dropdown-menu').dropdown('toggle'); + return false; + }); + $('.merge_auth').click(function (event) { event.preventDefault(); mergeAuth($(this).parents('tr').attr('data-authid'), $(this).parents('tr').find('div.authorizedheading').text()); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt index 4862e5e81c..28e9d1d0d6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt @@ -110,7 +110,24 @@
  • Edit
  • Merge
  • [% UNLESS ( resul.used ) %] -
  • Delete
  • +
  • + [% INCLUDE 'csrf-token.inc' %] + + + + + + + + + + + + +
    + +
    +
  • [% END %]
  • MARC preview -- 2.39.5