You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2013/04/10 18:31:59 UTC

svn commit: r1466552 - in /myfaces/tobago/trunk/tobago-theme: tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/ tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/st...

Author: lofwyr
Date: Wed Apr 10 16:31:59 2013
New Revision: 1466552

URL: http://svn.apache.org/r1466552
Log:
TOBAGO-1192: buttons and links rendering without javascript fragments
 - also for the tabGroup

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
    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-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java?rev=1466552&r1=1466551&r2=1466552&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java (original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/TabGroupRenderer.java Wed Apr 10 16:31:59 2013
@@ -42,7 +42,6 @@ import org.apache.myfaces.tobago.renderk
 import org.apache.myfaces.tobago.renderkit.html.HtmlElements;
 import org.apache.myfaces.tobago.renderkit.html.HtmlInputTypes;
 import org.apache.myfaces.tobago.renderkit.html.util.HtmlRendererUtils;
-import org.apache.myfaces.tobago.renderkit.util.JQueryUtils;
 import org.apache.myfaces.tobago.renderkit.util.RenderUtils;
 import org.apache.myfaces.tobago.util.ComponentUtils;
 import org.apache.myfaces.tobago.util.CreateComponentUtils;
@@ -278,14 +277,7 @@ public class TabGroupRenderer extends La
           if (tab.isDisabled()) {
             entry.setDisabled(true);
           } else {
-            entry.setOnclick(JQueryUtils.selectId(clientId)
-                + ".find('.tobago-tab[tabgroupindex=" + index + "]')"
-                + ".click();"
-                + "if (event.stopPropagation === undefined) { "
-                + "  event.cancelBubble = true; " // IE
-                + "} else { "
-                + "  event.stopPropagation(); " // other
-                + "}"); // todo: register a onclick handler with jQuery
+            ComponentUtils.putDataAttribute(entry, "tobago-index", index); // XXX todo, define a DataAttribute
           }
           menu.getChildren().add(entry);
         }

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=1466552&r1=1466551&r2=1466552&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 Wed Apr 10 16:31:59 2013
@@ -2440,6 +2440,19 @@ Tobago.ToolBar.init = function(elements)
       });
     });
 
+  Tobago.Utils.selectWidthJQuery(elements, ".tobago-tabGroup-toolBar")
+      .find(".tobago-menu[data-tobago-index]").each(function () {
+        var menu = jQuery(this);
+        menu.data("tobago-tabGroup", menu.closest(".tobago-tabGroup"));
+        menu.click(function (event) {
+          var menu = jQuery(this);
+          var tabGroup = menu.data("tobago-tabGroup");
+          var tab = tabGroup.find(".tobago-tab[tabgroupindex=" + menu.data("tobago-index") + "]");
+          tab.click();
+          event.stopPropagation();
+        })
+      });
+
     Tobago.Utils.selectWidthJQuery(elements, ".tobago-tabGroup-toolBar").find('.tobago-tabGroupToolBar-item')
         .not('.tobago-tabGroupToolBar-item-markup-disabled')
         .hover(function() {