Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
7f759b72
Commit
7f759b72
authored
Sep 19, 2012
by
Victor Shnayder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving computers--adding custom tabs
parent
a242ac54
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
0 deletions
+37
-0
lms/djangoapps/courseware/views.py
+23
-0
lms/templates/courseware/static_tab.html
+12
-0
lms/urls.py
+2
-0
No files found.
lms/djangoapps/courseware/views.py
View file @
7f759b72
...
...
@@ -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
:
...
...
lms/templates/courseware/static_tab.html
0 → 100644
View file @
7f759b72
<
%
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>
lms/urls.py
View file @
7f759b72
...
...
@@ -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>[^/]*)/$'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment