Author: jmorliaguet
Date: Wed Apr 12 23:42:27 2006
New Revision: 2828

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html
   
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html
Log:

- command controller: removed one level of indirection



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 Wed Apr 12 
23:42:27 2006
@@ -513,11 +513,9 @@
       event.model = view.model;
 
       var action = event.options.action;
-      // TODO: to refactor
       /* the event handler calls the controller's registered handler */
-      var action_id = controller.def.actions[action];
-      if (action_id) {
-        var action_handler = CPSSkins.getAction(action_id);
+      if (action) {
+        var action_handler = CPSSkins.getAction(action);
         if (action_handler) action_handler(event);
       }
     });

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html
       (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualactions_test.html
       Wed Apr 12 23:42:27 2006
@@ -22,14 +22,8 @@
 
   <ins class="controller">
   {"id": "do-action",
-   "type": "command",
-   "actions": {
-     "edit": "displayChoice",
-     "copy": "displayChoice",
-     "paste": "displayChoice",
-     "delete": "displayChoice"
-   }
-  }
+   "type": "command"
+  }}
   </ins>
 
   <h1>CPSSkins: Contextual actions</h1>
@@ -124,7 +118,14 @@
         context.getAttribute('id') + ' =&gt; ' + options.choice + '\n';
     }
 
-    CPSSkins.addActions({'displayChoice': displayChoice});
+    CPSSkins.addActions({
+      'edit': displayChoice,
+      'copy': displayChoice,
+      'paste': displayChoice,
+      'format': displayChoice,
+      'size': displayChoice,
+      'delete': displayChoice
+      });
   </script>
 
   <pre id="message"></pre>

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html
  (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_contextualmenu_test.html
  Wed Apr 12 23:42:27 2006
@@ -24,16 +24,8 @@
 
   <ins class="controller">
   {"id": "do-action",
-   "type": "command",
-   "actions": {
-     "edit": "displayChoice",
-     "copy": "displayChoice",
-     "paste": "displayChoice",
-     "format": "displayChoice",
-     "delete": "displayChoice",
-     "size": "displayChoice"
-   }
-  }
+   "type": "command"
+  }}
   </ins>
 
   <div style="float: left; margin: 1em">
@@ -187,7 +179,14 @@
         context.getAttribute('id') + ' =&gt; ' + options.choice + '\n';
     }
 
-    CPSSkins.addActions({'displayChoice': displayChoice});
+    CPSSkins.addActions({
+      'edit': displayChoice,
+      'copy': displayChoice,
+      'paste': displayChoice,
+      'format': displayChoice,
+      'size': displayChoice,
+      'delete': displayChoice
+      });
   </script>
 
   <pre id="message"></pre>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to