Author: jmorliaguet
Date: Mon Feb 13 16:57:46 2006
New Revision: 2377

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

- panels now have a model, the url and the resources (css/ script) are part
  of the model.



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 Mon Feb 13 
16:57:46 2006
@@ -1257,30 +1257,26 @@
 
   setup: function() {
     this.visible = false;
-    this.url = this.def.widget.url;
-    this.css_id = null;
-    this.script_id = null;
-
-    this.update();
   },
 
   inspect: function() {
-    return '[CPSSkins Panel:' + this.url + ']';
-  },
-
-  // TODO: use a model instead of returning data directly
-  getData: function() {
-    return this.url;
+    return '[CPSSkins Panel]';
   },
 
   render: function(data) {
-    var url = data;
-    var script = this.def.widget.script;
+    var url = data.url;
+    var script = data.script;
     if (script) {
       this.script_id = this.id;
       Canvas.addScript(this.script_id, script);
     }
 
+    var css = data.css;
+    if (css) {
+      this.css_id = "cpsskins-panel-css" + this.id;
+      Canvas.addStyleSheet(this.css_id, css);
+    }
+
     if (url) {
       var widget = this.widget;
       var options = {
@@ -1299,11 +1295,7 @@
   },
 
   prepare: function() {
-    var css = this.def.widget.css;
-    if (css) {
-      this.css_id = "cpsskins-panel-css" + this.id;
-      Canvas.addStyleSheet(this.css_id, css);
-    }
+    this.update();
   },
 
   teardown: function() {

Modified: 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html
==============================================================================
--- 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html
   (original)
+++ 
cpsskins/branches/jmo-perspectives/ui/framework/tests/functional/cpsskins_panel_test.html
   Mon Feb 13 16:57:46 2006
@@ -40,22 +40,75 @@
     <tr style="vertical-align: top">
       <td colspan="3">
 
-        <ins class="view">
-        {"widget": {
-           "type": "panel",
+        <ins class="model">
+        {"id": "panel1",
+         "data": {
            "url": "panel1.html",
            "css": "style1.css"
          },
+         "storage": {
+           "type": "ram"
+        }}
+        </ins>
+
+        <ins class="model">
+        {"id": "panel2",
+         "data": {
+           "url": "panel2.html",
+           "css": "style2.css"
+         },
+         "storage": {
+           "type": "ram"
+        }}
+        </ins>
+
+        <ins class="model">
+        {"id": "panel3",
+         "data": {
+           "url": "panel3.html",
+           "css": "style3.css"
+         },
+         "storage": {
+           "type": "ram"
+        }}
+        </ins>
+
+        <ins class="model">
+        {"id": "panel4",
+         "data": {
+           "url": "panel4.html",
+           "css": "style4.css"
+         },
+         "storage": {
+           "type": "ram"
+        }}
+        </ins>
+
+        <ins class="model">
+        {"id": "panel5",
+         "data": {
+           "url": "panel5.html",
+           "css": "popup.css"
+         },
+         "storage": {
+           "type": "ram"
+        }}
+        </ins>
+
+        <ins class="view">
+        {"widget": {
+           "type": "panel"
+         },
+         "model": "panel1",
          "perspectives": ["page-designer", "layout-designer"]
         }
         </ins>
 
         <ins class="view">
         {"widget": {
-           "type": "panel",
-           "url": "panel2.html",
-           "css": "style2.css"
+           "type": "panel"
          },
+         "model": "panel2",
          "perspectives": ["site-designer"]
         }
         </ins>
@@ -68,18 +121,18 @@
 
         <ins class="view">
         {"widget": {
-           "type": "panel",
-           "url": "panel2.html"
+           "type": "panel"
          },
+         "model": "panel2",
          "perspectives": ["page-designer"]
         }
         </ins>
 
         <ins class="view">
         {"widget": {
-           "type": "panel",
-           "url": "panel3.html"
+           "type": "panel"
          },
+         "model": "panel3",
          "perspectives": ["site-designer", "layout-designer"]
         }
         </ins>
@@ -89,18 +142,18 @@
 
         <ins class="view">
         {"widget": {
-           "type": "panel",
-           "url": "panel3.html"
+           "type": "panel"
          },
+         "model": "panel3",
          "perspectives": ["page-designer"]
         }
         </ins>
 
         <ins class="view">
         {"widget": {
-           "type": "panel",
-           "url": "panel4.html"
+           "type": "panel"
          },
+         "model": "panel4",
          "perspectives": ["page-designer"]
         }
         </ins>
@@ -110,18 +163,18 @@
 
         <ins class="view">
         {"widget": {
-           "type": "panel",
-           "url":"panel4.html"
+           "type": "panel"
          },
+         "model": "panel4",
          "perspectives": ["site-designer", "layout-designer"]
         }
         </ins>
 
         <ins class="view">
         {"widget": {
-           "type": "panel",
-           "url":"panel2.html"
+           "type": "panel"
          },
+         "model": "panel2",
          "perspectives": ["site-designer"]
         }
         </ins>
@@ -133,10 +186,9 @@
 
   <ins class="view">
   {"widget": {
-     "type": "panel",
-     "url": "panel5.html",
-     "css": "popup.css"
+     "type": "panel"
    },
+   "model": "panel5",
    "perspectives": ["element-editor"]
   }
   </ins>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to