[open-ils-commits] r59 - in servres/trunk/conifer: static syrup templates
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Nov 26 19:59:44 EST 2008
Author: gfawcett
Date: 2008-11-26 19:59:44 -0500 (Wed, 26 Nov 2008)
New Revision: 59
Added:
servres/trunk/conifer/templates/item_metadata.xhtml
Modified:
servres/trunk/conifer/static/main.css
servres/trunk/conifer/syrup/urls.py
servres/trunk/conifer/syrup/views.py
servres/trunk/conifer/templates/course_detail.xhtml
Log:
improved item display; added item-metadata page
Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css 2008-11-27 00:59:41 UTC (rev 58)
+++ servres/trunk/conifer/static/main.css 2008-11-27 00:59:44 UTC (rev 59)
@@ -63,3 +63,7 @@
background-color: #F8F8F8;
}
.pagetable thead th { font-size: smaller; text-align: left; padding: 2 8; }
+
+.metalinks { padding-left: 12; color: gray; }
+.metalinks a { color: navy; }
+.metalinks { position: absolute; left: 300; }
\ No newline at end of file
Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py 2008-11-27 00:59:41 UTC (rev 58)
+++ servres/trunk/conifer/syrup/urls.py 2008-11-27 00:59:44 UTC (rev 59)
@@ -7,4 +7,6 @@
(r'^join/$', 'join_course'),
(r'^instructors/$', 'instructors'),
(r'^course/(?P<course_id>\d+)/$', 'course_detail'),
+ (r'^course/(?P<course_id>\d+)/item/(?P<item_id>\d+)/$', 'item_detail'),
+ (r'^course/(?P<course_id>\d+)/item/(?P<item_id>\d+)/meta$', 'item_metadata'),
)
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2008-11-27 00:59:41 UTC (rev 58)
+++ servres/trunk/conifer/syrup/views.py 2008-11-27 00:59:44 UTC (rev 59)
@@ -73,3 +73,20 @@
#allowed to access. We need to set up a permissions model.
return login_required(lambda *args: None)(request)
return g.render('course_detail.xhtml', course=course)
+
+def item_detail(request, course_id, item_id):
+ """Display an item (however that makes sense)."""
+ # really, displaying an item will vary based on what type of item
+ # it is -- e.g. a URL item would redirect to the target URL. I'd
+ # like this URL to be the generic dispatcher, but for now let's
+ # just display some metadata about the item.
+ return item_metadata(request, course_id, item_id)
+
+def item_metadata(request, course_id, item_id):
+ """Display a metadata page for the item."""
+ course = get_object_or_404(models.Course, pk=course_id)
+ item = get_object_or_404(models.Item, pk=item_id)
+ assert item.course == course, 'Item not in course'
+ return g.render('item_metadata.xhtml', course=course,
+ item=item)
+
Modified: servres/trunk/conifer/templates/course_detail.xhtml
===================================================================
--- servres/trunk/conifer/templates/course_detail.xhtml 2008-11-27 00:59:41 UTC (rev 58)
+++ servres/trunk/conifer/templates/course_detail.xhtml 2008-11-27 00:59:44 UTC (rev 59)
@@ -17,28 +17,21 @@
There are no items associated with this course yet.
</p>
<div py:if="items">
- <table class="pagetable">
- <thead>
- <tr><th>Title</th><th>Type</th></tr>
- </thead>
- <tbody>
- <tr py:for="item in items">
- <td><a href="item/${item.id}/">${item.title}</a></td>
- <td>${item.item_type}</td>
- <td>${item.parent_heading}</td>
- </tr>
- </tbody>
- </table>
- <h2>Show-as-tree test</h2>
-
- <ol py:def="show_tree(tree)" py:if="tree">
+ <ul py:def="show_tree(tree)" py:if="tree">
<li py:for="item, subs in tree">
- ${item}
+ <a href="item/${item.id}/">${item}</a>
+ <span class="metalinks">
+ [<a href="item/${item.id}/meta">about</a>
+ • <a href="/admin/syrup/item/${item.id}/">edit</a>
+ ]
+ </span>
${show_tree(subs)}
</li>
- </ol>
+ </ul>
${show_tree(course.item_tree())}
+
+
</div>
</body>
</html>
Added: servres/trunk/conifer/templates/item_metadata.xhtml
===================================================================
--- servres/trunk/conifer/templates/item_metadata.xhtml (rev 0)
+++ servres/trunk/conifer/templates/item_metadata.xhtml 2008-11-27 00:59:44 UTC (rev 59)
@@ -0,0 +1,22 @@
+<?python
+course_title = '%s: %s (%s)' % (course.title, course.title, course.term)
+title = item.title
+?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:py="http://genshi.edgewall.org/">
+ <xi:include href="master.xhtml"/>
+ <head>
+ <title>${title}</title>
+ </head>
+ <body>
+ <h1>${title}</h1>
+ <p><a href="../../">${course_title}</a></p>
+ <p>${course.department}</p>
+
+ <p>Title: ${item.title}</p>
+ <p>Type: ${item.item_type}</p>
+ <p>Author: ${item.author}</p>
+ <p py:if="item.url">URL: <a href="${item.url}">${item.url}</a></p>
+ </body>
+</html>
More information about the open-ils-commits
mailing list