Bug 29965: (follow-up) Move repeated JS to its own file

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Nick Clemens 2022-02-18 17:15:07 +00:00 committed by Fridolin Somers
parent e3f82fe1ce
commit e155dd70a6
3 changed files with 21 additions and 40 deletions

View file

@ -97,26 +97,8 @@
var authtypecode = "[% authtypecode | html %]";
</script>
[% Asset.js("js/auth-finder-search.js") | $raw %]
[% Asset.js("js/authorities-detail-modal.js") | $raw %]
<script>
$(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("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /></div>");
});
});
function jumpfull(page){
window.open(page,'','width=100,height=100,resizable=yes,toolbar=false,scrollbars=yes,top');
}

View file

@ -103,27 +103,7 @@
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'authorities_js.inc' %]
<script>
$(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("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /></div>");
});
});
</script>
[% Asset.js("js/authorities-detail-modal.js") | $raw %]
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]

View file

@ -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("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /></div>");
});
});