[open-ils-commits] r100 - in servres/trunk/conifer: . templates

svn at svn.open-ils.org svn at svn.open-ils.org
Sat Jan 10 21:11:41 EST 2009


Author: gfawcett
Date: 2009-01-10 21:11:40 -0500 (Sat, 10 Jan 2009)
New Revision: 100

Modified:
   servres/trunk/conifer/genshi_namespace.py
   servres/trunk/conifer/templates/browse_courses.xhtml
   servres/trunk/conifer/templates/item_heading_detail.xhtml
   servres/trunk/conifer/templates/item_metadata.xhtml
Log:
added function to derive URLs for courses


Modified: servres/trunk/conifer/genshi_namespace.py
===================================================================
--- servres/trunk/conifer/genshi_namespace.py	2009-01-10 21:02:08 UTC (rev 99)
+++ servres/trunk/conifer/genshi_namespace.py	2009-01-11 02:11:40 UTC (rev 100)
@@ -4,8 +4,14 @@
 # rendering a Genshi template.
 
 from itertools import cycle
-
 from conifer.syrup import models
 
+# Root-relative URLs Django has its own way of doing this, by doing
+# reverse lookups in urlpatterns. Is there a benefit to their
+# approach?
+
 def item_url(item, suffix=''):
     return '/syrup/course/%d/item/%d/%s' % (item.course_id, item.id, suffix)
+
+def course_url(course, suffix=''):
+    return '/syrup/course/%d/%s' % (course.id, suffix)

Modified: servres/trunk/conifer/templates/browse_courses.xhtml
===================================================================
--- servres/trunk/conifer/templates/browse_courses.xhtml	2009-01-10 21:02:08 UTC (rev 99)
+++ servres/trunk/conifer/templates/browse_courses.xhtml	2009-01-11 02:11:40 UTC (rev 100)
@@ -19,7 +19,7 @@
     <tbody>
       <tr py:for="c in models.Course.objects.all().order_by('code')">
 	<td>${c.code}</td>
-	<td>${c.title}</td>
+	<td><a href="${course_url(c)}">${c.title}</a></td>
 	<td>${c.term}</td>
       </tr>
     </tbody>

Modified: servres/trunk/conifer/templates/item_heading_detail.xhtml
===================================================================
--- servres/trunk/conifer/templates/item_heading_detail.xhtml	2009-01-10 21:02:08 UTC (rev 99)
+++ servres/trunk/conifer/templates/item_heading_detail.xhtml	2009-01-11 02:11:40 UTC (rev 100)
@@ -14,7 +14,7 @@
   </head>
   <body>
     <h1>${title}</h1>
-    <p><a href="../../">${course_title}</a></p>
+    <p><a href="${course_url(course)}">${course_title}</a></p>
     <p>${course.department}</p>
     <p py:if="not item_tree">
       There are no items associated in this subheading.

Modified: servres/trunk/conifer/templates/item_metadata.xhtml
===================================================================
--- servres/trunk/conifer/templates/item_metadata.xhtml	2009-01-10 21:02:08 UTC (rev 99)
+++ servres/trunk/conifer/templates/item_metadata.xhtml	2009-01-11 02:11:40 UTC (rev 100)
@@ -11,7 +11,7 @@
   </head>
   <body>
     <h1>${title}</h1>
-    <p><a href="../../">${course_title}</a></p>
+    <p><a href="${course_url(course)}">${course_title}</a></p>
     <p>${course.department}</p>
 
     <p>Title: ${item.title}</p>



More information about the open-ils-commits mailing list