From 403a555e2240d93372a6402be64e51471ebf3855 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 11 Jul 2013 20:07:31 +0200 Subject: [PATCH] feature #2166: If parent tab does not exists and sub tab in the first level --- src/sunstone/public/js/sunstone.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index dd4f2630cf..b2513403ea 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -550,21 +550,16 @@ function insertTab(tab_name){ var li_item = '
  • '+tab_info.title+'
  • '; + $('div#menu ul#navigation').append(li_item); + //if this is a submenu... if (parent.length) { - var children = $('div#menu ul#navigation li.'+parent); + var children = $('div#menu ul#navigation #li_'+parent); //if there are other submenus, insert after last of them - if (children.length) - $(children[children.length-1]).after(li_item); - else //instert after parent menu - $('div#menu ul#navigation li#li_'+parent).after(li_item); - } else { //not a submenu, instert in the end - $('div#menu ul#navigation').append(li_item); - }; - - if (parent){ //this is a subtab - $('div#menu li#li_'+tab_name).hide();//hide by default - $('div#menu li#li_'+parent+' span').css("display","inline-block"); + if (children.length) { + $('div#menu li#li_'+tab_name).hide();//hide by default + $('div#menu li#li_'+parent+' span').css("display","inline-block"); + } }; if (showOnTop){