Koha/koha-tmpl/intranet-tmpl/prog/js/authorities-detail-modal.js
Nick Clemens 0492b19938 Bug 29965: (follow-up) Use a new class for the preview
With previous patches everythign worked, however, clicking the heading in
authority search results now launched the preview instead of taking you to the
authority details

This patch uses a new class to launch the modal and conditionally applies it to
authority results as we expect different behaviours when searching from the popup
vs authority module

To test:
1 - Repeate previous tests, confirm they pass
2 - Search for authorities in the authority module
3 - COnfirm clicking on heading takes you to detail page for authority

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>
2022-02-23 22:05:33 -10:00

19 lines
899 B
JavaScript

$(document).ready(function(){
$(".authority_preview 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>");
});
});