Bug 34075: Improve JS code

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-07-19 09:32:15 +02:00 committed by Tomas Cohen Arazi
parent 6247cd9b5e
commit 4f9fa72828
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -136,18 +136,18 @@
<script>
$(document).ready(function() {
if( $("#authoritiestabs .tab-pane.active").length < 1 ){
let tab_object;
[% SET DefaultAuthorityTab = Koha.Preference('DefaultAuthorityTab') %]
[% IF DefaultAuthorityTab %]
let default_tab = "#tab" + [% DefaultAuthorityTab | html %] + "XX-tab";
let tab_object = $("#authoritiestabs "+default_tab)
if( tab_object.length > 0 ){
tab_object.tab("show");
} else {
$("#authoritiestabs a:first").tab("show");
}
[% ELSE %]
$("#authoritiestabs a:first").tab("show");
tab_object = $("#authoritiestabs #tab[% DefaultAuthorityTab | html %]XX-tab");
[% END %]
if( tab_object.length > 0 ){
tab_object.tab("show");
} else {
$("#authoritiestabs a:first").tab("show");
}
}
var editAuth = $("#editAuth");