git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@37 6d9bc8c9-1ec2-4278...
authorartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 20 Nov 2008 20:45:10 +0000 (20:45 +0000)
committerartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 20 Nov 2008 20:45:10 +0000 (20:45 +0000)
conifer/genshi_namespace.py [new file with mode: 0644]
conifer/genshi_support.py
conifer/static/main.css
conifer/templates/open_courses.xhtml
conifer/templates/paginate.xhtml

diff --git a/conifer/genshi_namespace.py b/conifer/genshi_namespace.py
new file mode 100644 (file)
index 0000000..eb91cd8
--- /dev/null
@@ -0,0 +1,2 @@
+from itertools import cycle, islice # etc.
+from os.path import isfile        # for example
index 76998f2..e62c2a0 100644 (file)
@@ -1,3 +1,4 @@
+import genshi_namespace
 from django.http import HttpResponse, HttpRequest
 from genshi.template import TemplateLoader
 from genshi.filters import Translator
@@ -36,5 +37,4 @@ def _inject_django_things_into_namespace(request, ns):
     ns['models'] = models
     ns['request'] = request
     ns['user'] = getattr(request, 'user', None)
-
-
+    ns.update(genshi_namespace.__dict__)
index beeaf9a..235c02a 100644 (file)
@@ -59,4 +59,7 @@ a:hover {  text-decoration: underline;  }
 }
 
 .pagetable td { border: #ddd 1px solid; padding: 4 8; }
-.pagetable thead th { font-size: smaller; text-align: left; padding: 2 8; }
\ No newline at end of file
+.pagetable .odd {
+    background-color: #F8F8F8;
+}
+.pagetable thead th { font-size: smaller; text-align: left; padding: 2 8; }
index b2ce51b..27fa00a 100644 (file)
@@ -18,11 +18,14 @@ title = 'Open Courses'
   <tr py:def="pageheader()">
     <th>Term</th><th>Code</th><th>Title</th>
   </tr>
-  <tr py:def="pagerow(item)">
+  <span py:def="pagerow(item)">
     <td>${item.term}</td>
     <td><a href="../course/${item.id}/">${item.code}</a></td>
     <td><a href="../course/${item.id}/">${item.title}</a></td>
-  </tr>
+  </span>
+    <!--
   ${pagetable(paginator, start, count, pagerow, pageheader)}
+    -->
+  ${pagetable(paginator, count, pagerow, pageheader)}
 </body>
 </html>
index b04dde3..4f29a33 100644 (file)
@@ -2,15 +2,17 @@
       xmlns:py="http://genshi.edgewall.org/"
       xmlns:xi="http://www.w3.org/2001/XInclude"
       py:strip="">
-<div py:def="pagetable(paginator, start, count, pagerow, pagehead=None)"
+<div py:def="pagetable(paginator, count, pagerow, pagehead=None)"
      py:with="page = paginator.page(page_num)">
-  <table class="pagetable">
+  <table class="pagetable" py:with="cls = cycle(('odd', 'even'))"> 
     <thead py:if="pagehead">
       ${pagehead()}
     </thead>
     <tbody>
       <tr py:strip="True" py:for="item in page.object_list">
+    <tr class="${cls.next()}">
        ${pagerow(item)}
+    </tr>
       </tr>
     </tbody>
   </table>
@@ -29,4 +31,4 @@
     </span>
   </div>
 </div>
-</html>
\ No newline at end of file
+</html>