Commit 7f759b72 by Victor Shnayder

moving computers--adding custom tabs

parent a242ac54
......@@ -343,6 +343,28 @@ def course_info(request, course_id):
return render_to_response('courseware/info.html', {'course': course,
'staff_access': staff_access,})
@ensure_csrf_cookie
def static_tab(request, course_id, tab_name):
"""
Display the courses tab with the given name.
Assumes the course_id is in a valid format.
"""
course = get_course_with_access(request.user, course_id, 'load')
staff_access = has_access(request.user, course, 'staff')
tab = course.get_static_tab_by_name(tab_name)
contents = tabs.get_static_tab_contents(course, tab)
if contents is None:
raise Http404
return render_to_response('courseware/static_tab.html',
{'course': course,
'tab': tab,
'active_page': tab['name'],
'tab_contents': contents,
'staff_access': staff_access,})
# TODO arjun: remove when custom tabs in place, see courseware/syllabus.py
@ensure_csrf_cookie
def syllabus(request, course_id):
......@@ -357,6 +379,7 @@ def syllabus(request, course_id):
return render_to_response('courseware/syllabus.html', {'course': course,
'staff_access': staff_access,})
def registered_for_course(course, user):
'''Return CourseEnrollment if user is registered for course, else False'''
if user is None:
......
<%inherit file="/main.html" />
<%namespace name='static' file='/static_content.html'/>
<%block name="title"><title>${course.number} ${tab['name']}</title></%block>
<%include file="/courseware/course_navigation.html" args="active_page=tab['name']" />
<section class="container">
<div class="static_tab_wrapper">
${tab_contents}
</div>
</section>
......@@ -132,6 +132,8 @@ if settings.COURSEWARE_ENABLED:
'courseware.views.course_info', name="course_root"),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/info$',
'courseware.views.course_info', name="info"),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/tab/(?P<tab_name>.*)$',
'courseware.views.static_tab', name="static_tab"),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/syllabus$',
'courseware.views.syllabus', name="syllabus"), # TODO arjun remove when custom tabs in place, see courseware/courses.py
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/book/(?P<book_index>[^/]*)/$',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment