From 4d3144310c00398b1f6629c27466bdce04436841 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 14 Feb 2019 19:37:21 +0000 Subject: [PATCH] Bug 22045: (follow-up) Fix tab-switching when some tab numbers are missing This patch changes the way tab-switching is done so that it switching tabs based on tab id rather than tab index. Using tab index doesn't work when the tab number doesn't match the tab index. To test, apply the patch and load a record or blank editor using a MARC framework which doesn't include one or more tabs (for instance, by deleting the entries in the framework for one tab: DELETE FROM marc_subfield_structure WHERE frameworkcode = 'KT' AND tab = 4; ...backup first). In the MARC editor the numbered tabs should exclude that number. Tab-switching should work correctly. Signed-off-by: Maryse Simard Signed-off-by: Josef Moravec Signed-off-by: Nick Clemens --- .../intranet-tmpl/prog/css/addbiblio.css | 7 +++-- .../prog/en/modules/cataloguing/addbiblio.tt | 31 +++++++++++++------ .../intranet-tmpl/prog/js/staff-global.js | 2 +- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/addbiblio.css b/koha-tmpl/intranet-tmpl/prog/css/addbiblio.css index e7b3b143fb..03dd04bb8f 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/addbiblio.css +++ b/koha-tmpl/intranet-tmpl/prog/css/addbiblio.css @@ -208,6 +208,8 @@ tbody tr.active td { border: 1px solid #EDF4F6; border-left: 0; border-right: 1px solid #EDF4F6; + border-bottom-right-radius: 5px; + border-bottom-left-radius: 5px; display: block; font-weight: bold; padding: .3em 1.5em; @@ -217,6 +219,7 @@ tbody tr.active td { .toolbar-tabs li.selected a { background-color: #EDF4F6; border-right: 1px solid #C3D6DB; + border-bottom: 1px solid #C3D6DB; font-weight: bold; } @@ -228,8 +231,8 @@ tbody tr.active td { background-color: #F4F8F9; } -.toolbar-tabs li:last-child a { - +.toolbar-tabs li:first-child a { + border-left: 1px solid #EDF4F6; } .tag_anchors_list { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 20b16a6666..b62328dd43 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -28,7 +28,7 @@ }); [% IF tab %] - $('#addbibliotabs').selectTabByID("#[% tab | html %]"); + $('#addbibliotabs').selectTabByID("tab[% tab | html %]"); [% END %] Sticky = $("#toolbar"); @@ -139,7 +139,7 @@ $(".toolbar-tabs li").removeClass("selected"); $(this).parent().addClass("selected"); var tabid = $(this).data("tabid"); - $("#addbibliotabs").tabs( "option", "active", tabid ); + $('#addbibliotabs').selectTabByID("tab" + tabid + "XX"); $(".tag_anchors").removeClass("tab_selected").hide(); $(".tag_anchors_" + tabid ).addClass("tab_selected").show(); }); @@ -571,15 +571,27 @@ function Changefwk() { [% END %] [% END %]
-
    - [%- FOREACH BIG_LOO IN BIG_LOOP -%][%- SET tabname = BIG_LOO.number -%][% IF loop.first %]
  • [% ELSE %]
  • [% END %][% tabname | html %]
  • [%- END -%] -
+ [% IF ( BIG_LOOP.size > 1 ) %] +
    + [%- FOREACH BIG_LOO IN BIG_LOOP -%] + [% IF loop.first %] +
  • + [% ELSE %] +
  • + [% END %] + [% BIG_LOO.number | html %] +
  • + [%- END -%] +
+ [% END %]
    [% FOREACH BIG_LOO IN BIG_LOOP %] [% IF loop.first %][% SET tab_selected = "tab_selected" %][% ELSE %][% SET tab_selected = "" %][% END %] [% FOREACH innerloo IN BIG_LOO.innerloop %] [% IF ( innerloo.tag ) %] -
  • [% innerloo.tag | uri %]
  • +
  • + [% innerloo.tag | uri %] +
  • [% END %] [% END %] [% END %] @@ -606,15 +618,16 @@ function Changefwk() {
    [% FOREACH BIG_LOO IN BIG_LOOP %] - [% SET tabname = BIG_LOO.number %]
    -

    Section [% tabname | html %]

    + [% IF ( BIG_LOOP.size > 1 ) %] +

    Section [% BIG_LOO.number | html %]

    + [% END %] [% FOREACH innerloo IN BIG_LOO.innerloop %] [% IF ( innerloo.tag ) %]
    diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index b60af5e06d..dc7f32e690 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -31,7 +31,7 @@ $.fn.tabIndex = function () { return $(this).parent().children('div').index(this); }; $.fn.selectTabByID = function (tabID) { - $(this).tabs("option", "active", $(tabID).tabIndex()); + $(this).tabs("option", "active", $( "#" + tabID ).tabIndex()); }; $(document).ready(function() { -- 2.39.5