[Checkins] SVN: z3c.table/trunk/ Build nicer batch CSS, still a more flexible implementation is needed

Roger Ineichen roger at projekt01.ch
Sun Mar 2 08:40:28 EST 2008


Log message for revision 84396:
  Build nicer batch CSS, still a more flexible implementation is needed
  Added some notes about that

Changed:
  A   z3c.table/trunk/TODO.txt
  U   z3c.table/trunk/src/z3c/table/batch.py

-=-
Added: z3c.table/trunk/TODO.txt
===================================================================
--- z3c.table/trunk/TODO.txt	                        (rev 0)
+++ z3c.table/trunk/TODO.txt	2008-03-02 13:40:27 UTC (rev 84396)
@@ -0,0 +1,9 @@
+====
+TODO
+====
+
+- implement nicer batch representation. Use div wrapper around batch links and
+  give them the class rahter then set the CSS class in href tags.
+
+- implement render methods for each batch status, e.g. renderFirstBatch,
+  renderLastBatch.


Property changes on: z3c.table/trunk/TODO.txt
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: z3c.table/trunk/src/z3c/table/batch.py
===================================================================
--- z3c.table/trunk/src/z3c/table/batch.py	2008-03-02 11:25:19 UTC (rev 84395)
+++ z3c.table/trunk/src/z3c/table/batch.py	2008-03-02 13:40:27 UTC (rev 84396)
@@ -137,18 +137,32 @@
         lastIdx = len(self.batchItems)
         for batch in self.batchItems:
             idx += 1
+            # build css class
+            cssClasses = []
+            if batch and batch == self.batch:
+                cssClasses.append('current')
+            if idx == 1:
+                cssClasses.append('first')
+            if idx == lastIdx:
+                cssClasses.append('last')
+            
+            if cssClasses:
+                css = ' '.join(cssClasses)
+            else:
+                css = None
+
             # render spaces
             if batch is None:
                 append(self.batchSpacer)
             elif idx == 1:
                 # render first
-                append(self.renderBatchLink(batch, 'first'))
+                append(self.renderBatchLink(batch, css))
             elif batch == self.batch:
                 # render current
-                append(self.renderBatchLink(batch, 'current'))
+                append(self.renderBatchLink(batch, css))
             elif idx == lastIdx:
                 # render last
-                append(self.renderBatchLink(batch, 'last'))
+                append(self.renderBatchLink(batch, css))
             else:
                 append(self.renderBatchLink(batch))
         return u'\n'.join(res)



More information about the Checkins mailing list