Bug 35110: Authorities editor with JS error when only one tab

Exactly like Bug 34251 for biblios :
When using the an authorities framework with all fields in the same tab, there is thrown a JS error in selectTab( "#tab0XX_panel" );
This is because no nav tabs are build in authorities/authorities.tt as BIG_LOOP has a length(size) of 1

Test plan :
1) Edit an authority framework, for example 'Meeting Name', to set all sufields in tab 0
   You may use SQL : UPDATE auth_subfield_structure SET tab=0 WHERE authtypecode='MEETI_NAME'
   Don't forget to restart memcached
2) Go to 'Authorities'
3) Click on 'New authority' then 'Meeting Name'
4) Check you don't see any JavaScript error
5) Check you can save

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Bug 35110: (follow-up) Fix comment in addbiblio.tt

Change comment in addbiblio.tt since any biblio framework may use only
one tab.
Also fixes indenting using 4 spaces.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Edit: squashed because follow-up fixes code introduced by the same
author.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Fridolin Somers 2023-10-19 09:17:57 -10:00 committed by Tomas Cohen Arazi
parent cd7a8840d5
commit 32e301df15
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
2 changed files with 6 additions and 2 deletions

View File

@ -129,6 +129,10 @@
});
function selectTab( tablink ){
/* return if no tabs displayed (BIG_LOOP.size <= 1) */
if ($(".toolbar-tabs-container .nav-tabs li").length === 0){
return;
}
let a = $("a[href='" + tablink + "']");
$(".toolbar-tabs-container .nav-tabs li").removeClass("selected");
a.tab("show").parent().addClass("selected");

View File

@ -204,9 +204,9 @@
});
function selectTab( tablink ){
/* return if no tabs displayed (fast add framework) */
/* return if no tabs displayed (BIG_LOOP.size <= 1) */
if ($(".toolbar-tabs-container .nav-tabs li").length === 0){
return;
return;
}
let a = $("a[href='" + tablink + "']");
$(".toolbar-tabs-container .nav-tabs li").removeClass("selected");