Author: jmorliaguet
Date: Sat May 13 12:36:37 2006
New Revision: 3117

Added:
   z3ecm/trunk/src/ecm/cpsskins/example7/alertbox.pt   (contents, props changed)
Modified:
   z3ecm/trunk/src/ecm/cpsskins/example7/configure.zcml
   z3ecm/trunk/src/ecm/cpsskins/example7/newsbox.pt
   z3ecm/trunk/src/ecm/cpsskins/example7/widgets.py

Log:

- added an alert box widget for the same data type (INewsData)



Added: z3ecm/trunk/src/ecm/cpsskins/example7/alertbox.pt
==============================================================================
--- (empty file)
+++ z3ecm/trunk/src/ecm/cpsskins/example7/alertbox.pt   Sat May 13 12:36:37 2006
@@ -0,0 +1,14 @@
+<table tal:define="data options/info/data;
+                   latest python: data['items'][0]">
+  <tr>
+    <th class="header">
+      <div class="title">News alert</div>
+      <div class="date" tal:content="latest/date" />
+    </th>
+  </tr>
+  <tr class="item">
+    <td>
+      <a tal:attributes="href latest/url" tal:content="latest/title" />
+    </td>
+  </tr>
+</table>

Modified: z3ecm/trunk/src/ecm/cpsskins/example7/configure.zcml
==============================================================================
--- z3ecm/trunk/src/ecm/cpsskins/example7/configure.zcml        (original)
+++ z3ecm/trunk/src/ecm/cpsskins/example7/configure.zcml        Sat May 13 
12:36:37 2006
@@ -22,6 +22,13 @@
       basic="True"
   />
 
+  <cpsskins:widget
+      name="ecm.cpsskins.alertbox"
+      title="Example7: Alert Box Widget"
+      view=".widgets.AlertBox"
+      for=".ds.INewsData"
+  />
+
   <cpsskins:presentation
       for=".portlet.INewsPortlet">
 

Modified: z3ecm/trunk/src/ecm/cpsskins/example7/newsbox.pt
==============================================================================
--- z3ecm/trunk/src/ecm/cpsskins/example7/newsbox.pt    (original)
+++ z3ecm/trunk/src/ecm/cpsskins/example7/newsbox.pt    Sat May 13 12:36:37 2006
@@ -1,10 +1,7 @@
-<tal:block define="data options/info/data">
-
-<table>
+<table tal:define="data options/info/data">
   <tr>
     <th class="header" tal:content="data/header" />
   </tr>
-
   <tr class="item" tal:repeat="item data/items">
     <td>
       <a tal:attributes="href item/url; alt item/description"
@@ -13,5 +10,3 @@
     </td>
   </tr>
 </table>
-
-</tal:block>

Modified: z3ecm/trunk/src/ecm/cpsskins/example7/widgets.py
==============================================================================
--- z3ecm/trunk/src/ecm/cpsskins/example7/widgets.py    (original)
+++ z3ecm/trunk/src/ecm/cpsskins/example7/widgets.py    Sat May 13 12:36:37 2006
@@ -23,13 +23,15 @@
 from cpsskins import WidgetView
 
 class INewsBox(Interface):
-    """Typing interface for news boxes"""
+    """News box interface"""
+
+class IAlertBox(Interface):
+    """Alert box interface"""
 
 class NewsBox(WidgetView):
     """News box widget view
     """
     template = pagetemplate.ViewPageTemplateFile('newsbox.pt')
-
     preview = """
     <table>
       <tr>
@@ -49,9 +51,30 @@
       </tr>
     </table>
     """
-
     implements(INewsBox)
+    def __call__(self, markup, info, **kw):
+        return self.template(markup=markup, info=info, **kw)
 
+class AlertBox(WidgetView):
+    """Alert box widget view
+    """
+    template = pagetemplate.ViewPageTemplateFile('alertbox.pt')
+    preview = """
+    <table label="Alert box">
+      <tr>
+        <th class="header" label="Alert box channel">
+          <div class="title">News alert</div>
+          <div class="date">publication date</div>
+        </th>
+      </tr>
+      <tr class="item" label="Latest news item">
+        <td>
+          <a href="http://some.url";>Item title</a>
+        </td>
+      </tr>
+    </table>
+    """
+    implements(IAlertBox)
     def __call__(self, markup, info, **kw):
         return self.template(markup=markup, info=info, **kw)
 
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to