From e155dd70a6f5593679ef38145e6bad18a8690500 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 18 Feb 2022 17:15:07 +0000 Subject: [PATCH] Bug 29965: (follow-up) Move repeated JS to its own file Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer Signed-off-by: Fridolin Somers --- .../authorities/searchresultlist-auth.tt | 20 +---------------- .../modules/authorities/searchresultlist.tt | 22 +------------------ .../prog/js/authorities-detail-modal.js | 19 ++++++++++++++++ 3 files changed, 21 insertions(+), 40 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/authorities-detail-modal.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt index 2fa5990fc7..f50e578a84 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist-auth.tt @@ -97,26 +97,8 @@ var authtypecode = "[% authtypecode | html %]"; [% Asset.js("js/auth-finder-search.js") | $raw %] + [% Asset.js("js/authorities-detail-modal.js") | $raw %] + [% Asset.js("js/authorities-detail-modal.js") | $raw %] [% END %] [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/authorities-detail-modal.js b/koha-tmpl/intranet-tmpl/prog/js/authorities-detail-modal.js new file mode 100644 index 0000000000..26a314d00d --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/authorities-detail-modal.js @@ -0,0 +1,19 @@ +$(document).ready(function(){ + $(".authorizedheading a").on("click", function(e){ + e.preventDefault(); + var authid = $(this).data("authid"); + + $.get("/cgi-bin/koha/authorities/detail.pl", { authid : authid }, function( data ){ + var auth_detail = $(data).find("#authoritiestabs"); + auth_detail.find("ul").remove(); + $("#authorityDetail .modal-title").html(_("Authority") + " " + authid ); + $("#authorityDetail .modal-body").html( auth_detail ); + }); + + $("#authorityDetail").modal("show"); + }); + $("#authorityDetail").on("hidden.bs.modal", function(){ + $("#authorityDetail .modal-body, #authorityDetail .modal-title").html(""); + $("#authorityDetail .modal-body").html("
\"\"
"); + }); +}); -- 2.39.5