myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1452881 - 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...
Date Tue, 05 Mar 2013 16:20:12 GMT
Author: lofwyr
Date: Tue Mar  5 16:20:12 2013
New Revision: 1452881

URL: http://svn.apache.org/r1452881
Log:
TOBAGO-1237: Menu should not need an id

Modified:
    myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
    myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-utils.js

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.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/MenuRenderer.java?rev=1452881&r1=1452880&r2=1452881&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-scarborough/src/main/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/tag/MenuRenderer.java
Tue Mar  5 16:20:12 2013
@@ -63,11 +63,9 @@ public class MenuRenderer extends Layout
     final boolean disabled = menu.isDisabled();
     final boolean firstLevel = !RendererTypes.MENU.equals(menu.getParent().getRendererType());
     final boolean isParentMenu = menu.getChildCount() > 0; // todo: may be not correct
-    final String clientId = menu.getClientId(facesContext);
 
     writer.startElement(HtmlElements.LI, menu);
     writer.writeClassAttribute(Classes.create(menu, firstLevel ? Markup.TOP : null));
-    writer.writeIdAttribute(clientId);
     if (menu.getImage() != null) {
       Style style = new Style();
       style.setBackgroundImage("url(" + menu.getImage() + ")");
@@ -92,7 +90,6 @@ public class MenuRenderer extends Layout
     writer.endElement(HtmlElements.A);
     if (isParentMenu) {
       writer.startElement(HtmlElements.OL, menu);
-      writer.writeIdAttribute(clientId + ComponentUtils.SUB_SEPARATOR + "menu");
     }
   }
 

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.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-menu.js?rev=1452881&r1=1452880&r2=1452881&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-menu.js
Tue Mar  5 16:20:12 2013
@@ -255,6 +255,14 @@ Tobago.Menu.init = function(elements) {
         "<iframe class='tobago-menu-ie6bugfix' src='" + Tobago.blankPage + "'></iframe>");
   }
 
+  // put the sub-menu in the data to find it later
+  menus.each(function() {
+    var superMenu = jQuery(this);
+    var subMenu = superMenu.children("ol");
+    superMenu.data("sub-menu", subMenu);
+    subMenu.data("super-menu", superMenu);
+  });
+
   jQuery(".tobago-page-menuStore").append(menus.children("ol"));
 
   var toolBarMenu = Tobago.Utils.selectWidthJQuery(
@@ -292,7 +300,7 @@ jQuery.tobagoMenuParent = function(eleme
     tobagoMenu_findSubMenu: function() {
       var menu = jQuery(this).children("ol");
       jQuery(this).each(function() {
-        menu = menu.add(Tobago.Utils.findSubComponent(jQuery(this), "menu"));
+        menu = menu.add(jQuery(this).data("sub-menu"));
       });
       return menu;
     }
@@ -307,8 +315,9 @@ jQuery.tobagoMenuParent = function(eleme
   jQuery.fn.extend({
     tobagoMenu_findParentMenu: function() {
       var ol = jQuery(this);
-      if (ol.attr('id').lastIndexOf("::") >= 0) {
-        return Tobago.Utils.findSuperComponent(ol);
+      var superMenu = ol.data("superMenu");
+      if (superMenu != null) {
+        return superMenu;
       }
       return ol;
     }

Modified: myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-utils.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-utils.js?rev=1452881&r1=1452880&r2=1452881&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-utils.js
(original)
+++ myfaces/tobago/trunk/tobago-theme/tobago-theme-standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/standard/script/tobago-utils.js
Tue Mar  5 16:20:12 2013
@@ -50,6 +50,7 @@ Tobago.Utils.getSubComponentId = functio
   }
 };
 
+/** @deprecated */
 Tobago.Utils.findSuperComponent = function(element) {
   return jQuery(Tobago.Utils.getSuperComponentId(element.attr('id')));
 };



Mime
View raw message