From 98a334460d3b0010dca23e46e13a0d4fe839f3ff Mon Sep 17 00:00:00 2001 From: gfawcett Date: Thu, 27 Nov 2008 00:59:44 +0000 Subject: [PATCH] improved item display; added item-metadata page git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@59 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/static/main.css | 4 ++++ conifer/syrup/urls.py | 2 ++ conifer/syrup/views.py | 17 +++++++++++++++++ conifer/templates/course_detail.xhtml | 27 ++++++++++----------------- conifer/templates/item_metadata.xhtml | 22 ++++++++++++++++++++++ 5 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 conifer/templates/item_metadata.xhtml diff --git a/conifer/static/main.css b/conifer/static/main.css index 235c02a..e23b7f8 100644 --- a/conifer/static/main.css +++ b/conifer/static/main.css @@ -63,3 +63,7 @@ a:hover { text-decoration: underline; } 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 diff --git a/conifer/syrup/urls.py b/conifer/syrup/urls.py index 912a58d..255e67a 100644 --- a/conifer/syrup/urls.py +++ b/conifer/syrup/urls.py @@ -7,4 +7,6 @@ urlpatterns = patterns('conifer.syrup.views', (r'^join/$', 'join_course'), (r'^instructors/$', 'instructors'), (r'^course/(?P\d+)/$', 'course_detail'), + (r'^course/(?P\d+)/item/(?P\d+)/$', 'item_detail'), + (r'^course/(?P\d+)/item/(?P\d+)/meta$', 'item_metadata'), ) diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index a43d4af..aeecf22 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -73,3 +73,20 @@ def course_detail(request, course_id): #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) + diff --git a/conifer/templates/course_detail.xhtml b/conifer/templates/course_detail.xhtml index 79c4415..a367880 100644 --- a/conifer/templates/course_detail.xhtml +++ b/conifer/templates/course_detail.xhtml @@ -17,28 +17,21 @@ items = course.items() There are no items associated with this course yet.

- - - - - - - - - - - -
TitleType
${item.title}${item.item_type}${item.parent_heading}
-

Show-as-tree test

- -
    +
+ ${show_tree(course.item_tree())} + +
diff --git a/conifer/templates/item_metadata.xhtml b/conifer/templates/item_metadata.xhtml new file mode 100644 index 0000000..327f46d --- /dev/null +++ b/conifer/templates/item_metadata.xhtml @@ -0,0 +1,22 @@ + + + + + ${title} + + +

${title}

+

${course_title}

+

${course.department}

+ +

Title: ${item.title}

+

Type: ${item.item_type}

+

Author: ${item.author}

+

URL: ${item.url}

+ + -- 2.11.0