Author: jmorliaguet
Date: Sun Jan 15 16:24:51 2006
New Revision: 2215

Added:
   cpsskins/branches/jmo-perspectives/ui/framework/noicon.png   (contents, 
props changed)
   cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/noicon.png  
 (contents, props changed)
Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.css
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
Log:

- removed flickering effect on IE using <img> instead of
  background-image for menu items



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.css
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.css        
(original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.css        Sun Jan 
15 16:24:51 2006
@@ -54,12 +54,18 @@
 .contextMenu a {
   cursor: default;
   text-decoration: none;
-  vertical-align: top;
+  vertical-align: middle;
   background-repeat: no-repeat;
   background-position: 6px center;
   color: #000;
-  padding: 4px 15px 4px 29px;
-  width: 96px;
+  padding: 4px 15px 4px 5px;
+  width: 116px;
+}
+
+.contextMenu a img {
+  border: none;
+  padding-right: 5px;
+  vertical-align: bottom;
 }
 
 .contextMenu .separator {
@@ -109,14 +115,19 @@
   cursor: default;
   text-decoration: none;
   vertical-align: top;
-  padding: 4px 15px 4px 26px;
   background-repeat: no-repeat;
   background-position: 6px center;
   color: #000;
   display: block;
   float: left;
+  padding: 5px 10px 5px 4px;
 }
 
+.contextualActions a img {
+  border: none;
+  padding-right: 5px;
+  vertical-align: bottom;
+}
 
 /* Drag-and-drop */
 

Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Sun Jan 15 
16:24:51 2006
@@ -819,8 +819,8 @@
         case "item": {
           var options = {
             tag: "a",
-            content: item.label,
             style: {display: "block"},
+            classes: [],
             attributes: {
               action: item.action,
               href: "javascript:void(0)"
@@ -832,17 +832,23 @@
             options.attributes.confirm = confirm;
           }
 
-          var icon = item.icon;
-          if (icon && !disabled) {
-            options.style.backgroundImage = "url(" + icon + ")";
-          }
-
           if (disabled) {
             options.attributes.disabled = true;
-            options.classes = "disabled";
+            options.classes.push("disabled");
           }
+          var a = Canvas.createNode(options);
+
+          var icon = disabled ? "noicon.png": (item.icon || "noicon.png");
+          a.appendChild(Canvas.createNode({
+            tag: "img",
+            attributes: {
+              "src": icon,
+              "alt": "*"
+            }
+          }));
 
-          container.appendChild(Canvas.createNode(options));
+          container.appendChild(a);
+          a.appendChild(document.createTextNode(item.label));
 
           break;
         };
@@ -853,7 +859,6 @@
           $A(data[choices]).each(function(s) {
             var options = {
               tag: "a",
-              content: s.label,
               style: {display: "block"},
               attributes: {
                 action: item.action,
@@ -861,7 +866,19 @@
                 href: "javascript:void(0)"
               }
             }
-            container.appendChild(Canvas.createNode(options));
+            var a = Canvas.createNode(options);
+
+            var icon = disabled ? "noicon.png": (item.icon || "noicon.png");
+            a.appendChild(Canvas.createNode({
+              tag: "img",
+              attributes: {
+                "src": icon,
+                "alt": "*"
+              }
+            }));
+
+            container.appendChild(a);
+            a.appendChild(document.createTextNode(s.label));
           });
           break;
         };
@@ -879,7 +896,6 @@
           var options = {
             tag: "a",
             classes: "submenuitem",
-            content: item.label,
             style: {display: "block"},
             attributes: {href:"javascript:void(0)"}
           };
@@ -887,7 +903,14 @@
           if (disabled) { options.classes = "disabled"; }
           var submenuitem = container.appendChild(Canvas.createNode(options));
 
-          if (disabled) break;
+          var icon = item.icon || "noicon.png";
+          submenuitem.appendChild(Canvas.createNode({
+            tag: "img",
+            attributes: {
+              "src": icon,
+              "alt": "*"
+            }
+          }));
 
           if (!this.submenuLeft) {
             this.submenuLeft = Element.getDimensions(this.widget).width -2;
@@ -903,6 +926,7 @@
               margin: "-20px 0 0 0"
             }
           });
+          submenuitem.appendChild(document.createTextNode(item.label));
           submenuitem.appendChild(submenu);
 
           this._renderFragment(submenu, item, data);
@@ -1009,25 +1033,35 @@
       var disabled = false;
       if (data && visible) {
         if (!data[visible]) return;
-      }
+     }
       var options = {
         tag: "a",
-        content: item.label,
         style: {display: "block"},
+        classes: [],
         attributes: {
           action: item.action,
           href: "javascript:void(0)"
         }
       }
+
       var confirm = item.confirm;
-      if (confirm) {
+      if (confirm && !disabled) {
         options.attributes.confirm = confirm;
       }
-      var icon = item.icon;
-      if (icon) {
-        options.style.backgroundImage = "url(" + icon + ")";
-      }
-      container.appendChild(Canvas.createNode(options));
+
+      var a = Canvas.createNode(options);
+
+      var icon = disabled ? "noicon.png": (item.icon || "noicon.png");
+      a.appendChild(Canvas.createNode({
+        tag: "img",
+        attributes: {
+          "src": icon,
+          "alt": "*"
+        }
+      }));
+
+      container.appendChild(a);
+      a.appendChild(document.createTextNode(item.label));
     });
   },
 

Added: cpsskins/branches/jmo-perspectives/ui/framework/noicon.png
==============================================================================
Binary file. No diff available.

Added: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/noicon.png
==============================================================================
Binary file. No diff available.
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to