You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2013/05/10 10:16:51 UTC

svn commit: r1480923 - /myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Author: weber
Date: Fri May 10 08:16:51 2013
New Revision: 1480923

URL: http://svn.apache.org/r1480923
Log:
TOBAGO-1265 - Problem with nestet Tabgroups

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js?rev=1480923&r1=1480922&r2=1480923&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago.js Fri May 10 08:16:51 2013
@@ -2556,7 +2556,9 @@ Tobago.TabGroup.init = function(elements
 
   // initialize the tab header elements
   // client case
-  tabGroups.filter("[switchType='client']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
+  tabGroups.filter("[switchType='client']").each(function() {
+    jQuery(this).find(".tobago-tabGroup-headerInner").first()
+      .children(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
           var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
           jQuery(this).siblings(".tobago-tab-markup-selected").removeClass("tobago-tab-markup-selected");
           jQuery(this).addClass("tobago-tab-markup-selected");
@@ -2567,24 +2569,31 @@ Tobago.TabGroup.init = function(elements
           // scroll the tabs, if necessary
           var header = jQuery(this).parents(".tobago-tabGroup-header:first");
           Tobago.TabGroup.ensureScrollPosition(header);
+        })
   });
 
   // initialize the tab header elements
   // reload tab case
-  tabGroups.filter("[switchType='reloadTab']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
+  tabGroups.filter("[switchType='reloadTab']").each(function() {
+    jQuery(this).find(".tobago-tabGroup-headerInner").first()
+        .children(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
           var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
           LOG.debug("todo: ajax reload, activeIndex=" + activeIndex); // @DEV_ONLY
           var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
           Tobago.Updater.update(tabGroup, tabGroup.attr("id"), tabGroup.attr("id"), {});
+        })
   });
 
   // initialize the tab header elements
   // reload page case
-  tabGroups.filter("[switchType='reloadPage']").find(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
+  tabGroups.filter("[switchType='reloadPage']").each(function() {
+    jQuery(this).find(".tobago-tabGroup-headerInner").first()
+      .children(".tobago-tab").not(".tobago-tab-markup-disabled").click(function() {
           var activeIndex = Tobago.TabGroup.updateHidden(jQuery(this));
           LOG.debug("todo: full reload, activeIndex=" + activeIndex); // @DEV_ONLY
           var tabGroup = jQuery(this).parents(".tobago-tabGroup:first");
           Tobago.submitAction(tabGroup.eq(0), tabGroup.attr("id"));
+        })
   });
 
   // initialize previous button
@@ -2649,6 +2658,7 @@ Tobago.TabGroup.updateHidden = function(
 
 Tobago.TabGroup.ensureScrollPosition = function (header) {
   var tab = header.find(".tobago-tab-markup-selected");
+  if (tab.length > 0) {
     var tabRight = tab.position().left + tab.outerWidth() - header.outerWidth();
     if (tabRight > 0) {
       header.scrollLeft(header.scrollLeft() + tabRight + 1); // +1 to avoid rounding problems
@@ -2656,6 +2666,7 @@ Tobago.TabGroup.ensureScrollPosition = f
     var tabLeft = tab.position().left;
     if (tabLeft < 0) {
       header.scrollLeft(header.scrollLeft() + tabLeft);
+    }
   }
 };