From 62391d310517e10eabcd6bf44ea9e3527335e722 Mon Sep 17 00:00:00 2001 From: gfawcett Date: Sun, 11 Jan 2009 02:11:40 +0000 Subject: [PATCH] added function to derive URLs for courses git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@100 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/genshi_namespace.py | 8 +++++++- conifer/templates/browse_courses.xhtml | 2 +- conifer/templates/item_heading_detail.xhtml | 2 +- conifer/templates/item_metadata.xhtml | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/conifer/genshi_namespace.py b/conifer/genshi_namespace.py index 8ce3c09..71dc9a8 100644 --- a/conifer/genshi_namespace.py +++ b/conifer/genshi_namespace.py @@ -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) diff --git a/conifer/templates/browse_courses.xhtml b/conifer/templates/browse_courses.xhtml index 2dbd483..a128fca 100644 --- a/conifer/templates/browse_courses.xhtml +++ b/conifer/templates/browse_courses.xhtml @@ -19,7 +19,7 @@ title = 'Browse Courses' ${c.code} - ${c.title} + ${c.title} ${c.term} diff --git a/conifer/templates/item_heading_detail.xhtml b/conifer/templates/item_heading_detail.xhtml index cb29b0f..73d3549 100644 --- a/conifer/templates/item_heading_detail.xhtml +++ b/conifer/templates/item_heading_detail.xhtml @@ -14,7 +14,7 @@ item_tree = course.item_tree(subtree=item)

${title}

-

${course_title}

+

${course_title}

${course.department}

There are no items associated in this subheading. diff --git a/conifer/templates/item_metadata.xhtml b/conifer/templates/item_metadata.xhtml index 327f46d..d65da40 100644 --- a/conifer/templates/item_metadata.xhtml +++ b/conifer/templates/item_metadata.xhtml @@ -11,7 +11,7 @@ title = item.title

${title}

-

${course_title}

+

${course_title}

${course.department}

Title: ${item.title}

-- 2.11.0