From: gfawcett Date: Thu, 20 Nov 2008 03:26:01 +0000 (+0000) Subject: following Art's lead with a open_courses template X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=7428d3f190fa91668f66e152a66f249f2c1f8427;p=syrup%2Fmasslnc.git following Art's lead with a open_courses template git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@33 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/static/main.css b/conifer/static/main.css index c26a6aa..beeaf9a 100644 --- a/conifer/static/main.css +++ b/conifer/static/main.css @@ -46,4 +46,17 @@ a:hover { text-decoration: underline; } #tabbar li { display: inline; } #tabbar li a { padding: 18 18 4 18; background-color: #ddf; color: black; text-decoration: none; } #tabbar li a:hover { background-color: #fc8; } +/* #tabbar li.active a { background-color: #fa6; font-weight: bold; } +*/ + +.pagination_controls { + text-align: center; +} + +.pagination_controls .nums { + padding: 0 24; +} + +.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 diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index a432b27..eb6ea75 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -34,17 +34,21 @@ def welcome(request): return g.render('welcome.xhtml') def open_courses(request): - pgstart = request.GET.get('start') - if not pgstart: - pgstart = 1 - paginator = Paginator(models.Course.objects.filter(moderated=False), 5) - return g.render('open_courses.xhtml', paginator=paginator, pgstart=pgstart) + page_num = int(request.GET.get('page', 1)) + count = int(request.GET.get('count', 5)) + paginator = Paginator(models.Course.objects.filter(moderated=False), count) + return g.render('open_courses.xhtml', paginator=paginator, + page_num=page_num, + count=count) @login_required def my_courses(request): return g.render('my_courses.xhtml') -@login_required def course_detail(request, course_id): course = get_object_or_404(models.Course, pk=course_id) + if course.moderated and request.user.is_anonymous(): + #fixme, don't stop access just if anonymous, but rather if not + #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) diff --git a/conifer/templates/course_detail.xhtml b/conifer/templates/course_detail.xhtml index f76a969..abfc640 100644 --- a/conifer/templates/course_detail.xhtml +++ b/conifer/templates/course_detail.xhtml @@ -10,5 +10,8 @@ title = '%s: %s (%s)' % (course.code, course.title, course.term)

${title}

+

${course.department}

+

Reserve Items

+ (not implemented yet) diff --git a/conifer/templates/open_courses.xhtml b/conifer/templates/open_courses.xhtml new file mode 100644 index 0000000..2385172 --- /dev/null +++ b/conifer/templates/open_courses.xhtml @@ -0,0 +1,24 @@ + + + + + + ${title} + + +

${title}

+ + TermCodeTitle + + + ${item.term} + ${item.code} + ${item.title} + + ${pagetable(paginator, start, count, pagerow, pageheader)} + + diff --git a/conifer/templates/paginate.xhtml b/conifer/templates/paginate.xhtml new file mode 100644 index 0000000..b04dde3 --- /dev/null +++ b/conifer/templates/paginate.xhtml @@ -0,0 +1,32 @@ + +
+ + + ${pagehead()} + + + + ${pagerow(item)} + + +
+
+ + Previous + + + + ${pp} + + + + Next + +
+
+ \ No newline at end of file diff --git a/conifer/templates/welcome.xhtml b/conifer/templates/welcome.xhtml index 7486f43..3726961 100644 --- a/conifer/templates/welcome.xhtml +++ b/conifer/templates/welcome.xhtml @@ -10,7 +10,7 @@ title = 'Welcome!'
-

Log in

+

Log in

Browse Open Courses

Search the Reserves