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
1cfed46d
Commit
1cfed46d
authored
Aug 21, 2012
by
Arjun Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a syllabus page (accessible via course navigation)
parent
b29e547d
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
133 additions
and
0 deletions
+133
-0
lms/djangoapps/courseware/courses.py
+26
-0
lms/djangoapps/courseware/views.py
+12
-0
lms/envs/common.py
+1
-0
lms/static/sass/course.scss
+1
-0
lms/static/sass/course/_syllabus.scss
+64
-0
lms/templates/courseware/course_navigation.html
+3
-0
lms/templates/courseware/syllabus.html
+24
-0
lms/urls.py
+2
-0
No files found.
lms/djangoapps/courseware/courses.py
View file @
1cfed46d
...
@@ -142,6 +142,32 @@ def get_course_info_section(course, section_key):
...
@@ -142,6 +142,32 @@ def get_course_info_section(course, section_key):
raise
KeyError
(
"Invalid about key "
+
str
(
section_key
))
raise
KeyError
(
"Invalid about key "
+
str
(
section_key
))
def
get_course_syllabus_section
(
course
,
section_key
):
"""
This returns the snippet of html to be rendered on the syllabus page,
given the key for the section.
Valid keys:
- syllabus
- guest_syllabus
"""
# Many of these are stored as html files instead of some semantic
# markup. This can change without effecting this interface when we find a
# good format for defining so many snippets of text/html.
if
section_key
in
[
'syllabus'
,
'guest_syllabus'
]:
try
:
with
course
.
system
.
resources_fs
.
open
(
path
(
"syllabus"
)
/
section_key
+
".html"
)
as
htmlFile
:
return
replace_urls
(
htmlFile
.
read
()
.
decode
(
'utf-8'
),
course
.
metadata
[
'data_dir'
])
except
ResourceNotFoundError
:
log
.
exception
(
"Missing syllabus section {key} in course {url}"
.
format
(
key
=
section_key
,
url
=
course
.
location
.
url
()))
return
"! Syllabus missing !"
raise
KeyError
(
"Invalid about key "
+
str
(
section_key
))
def
get_courses_by_university
(
user
,
domain
=
None
):
def
get_courses_by_university
(
user
,
domain
=
None
):
'''
'''
...
...
lms/djangoapps/courseware/views.py
View file @
1cfed46d
...
@@ -219,6 +219,18 @@ def course_info(request, course_id):
...
@@ -219,6 +219,18 @@ def course_info(request, course_id):
return
render_to_response
(
'courseware/info.html'
,
{
'course'
:
course
,
return
render_to_response
(
'courseware/info.html'
,
{
'course'
:
course
,
'staff_access'
:
staff_access
,})
'staff_access'
:
staff_access
,})
@ensure_csrf_cookie
def
syllabus
(
request
,
course_id
):
"""
Display the course's syllabus.html, or 404 if there is no such course.
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'
)
return
render_to_response
(
'courseware/syllabus.html'
,
{
'course'
:
course
,
'staff_access'
:
staff_access
,})
def
registered_for_course
(
course
,
user
):
def
registered_for_course
(
course
,
user
):
'''Return CourseEnrollment if user is registered for course, else False'''
'''Return CourseEnrollment if user is registered for course, else False'''
...
...
lms/envs/common.py
View file @
1cfed46d
...
@@ -56,6 +56,7 @@ MITX_FEATURES = {
...
@@ -56,6 +56,7 @@ MITX_FEATURES = {
'ENABLE_TEXTBOOK'
:
True
,
'ENABLE_TEXTBOOK'
:
True
,
'ENABLE_DISCUSSION'
:
True
,
'ENABLE_DISCUSSION'
:
True
,
'ENABLE_SYLLABUS'
:
True
,
'ENABLE_SQL_TRACKING_LOGS'
:
False
,
'ENABLE_SQL_TRACKING_LOGS'
:
False
,
'ENABLE_LMS_MIGRATION'
:
False
,
'ENABLE_LMS_MIGRATION'
:
False
,
...
...
lms/static/sass/course.scss
View file @
1cfed46d
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
// pages
// pages
@import
"course/info"
;
@import
"course/info"
;
@import
"course/syllabus"
;
@import
"course/textbook"
;
@import
"course/textbook"
;
@import
"course/profile"
;
@import
"course/profile"
;
@import
"course/gradebook"
;
@import
"course/gradebook"
;
...
...
lms/static/sass/course/_syllabus.scss
0 → 100644
View file @
1cfed46d
div
.syllabus
{
padding
:
0px
10px
;
text-align
:
center
;
h1
{
@extend
.top-header
}
.notes
{
width
:
740px
;
margin
:
0px
auto
10px
;
}
table
{
text-align
:
left
;
margin
:
10px
auto
;
thead
{
font-weight
:
bold
;
border-bottom
:
1px
solid
black
;
}
tr
.first
{
td
{
padding-top
:
15px
;
}
}
td
{
vertical-align
:
middle
;
padding
:
5px
10px
;
&
.day
,
&
.due
{
white-space
:
nowrap
;
}
&
.no_class
{
text-align
:
center
;
}
&
.important
{
color
:
red
;
}
&
.week_separator
{
padding
:
0px
;
hr
{
margin
:
10px
;
}
}
}
}
}
lms/templates/courseware/course_navigation.html
View file @
1cfed46d
...
@@ -19,6 +19,9 @@ def url_class(url):
...
@@ -19,6 +19,9 @@ def url_class(url):
<ol
class=
"course-tabs"
>
<ol
class=
"course-tabs"
>
<li
class=
"courseware"
><a
href=
"${reverse('courseware', args=[course.id])}"
class=
"${url_class('courseware')}"
>
Courseware
</a></li>
<li
class=
"courseware"
><a
href=
"${reverse('courseware', args=[course.id])}"
class=
"${url_class('courseware')}"
>
Courseware
</a></li>
<li
class=
"info"
><a
href=
"${reverse('info', args=[course.id])}"
class=
"${url_class('info')}"
>
Course Info
</a></li>
<li
class=
"info"
><a
href=
"${reverse('info', args=[course.id])}"
class=
"${url_class('info')}"
>
Course Info
</a></li>
% if settings.MITX_FEATURES.get('ENABLE_SYLLABUS'):
<li
class=
"syllabus"
><a
href=
"${reverse('syllabus', args=[course.id])}"
class=
"${url_class('syllabus')}"
>
Syllabus
</a></li>
% endif
% if user.is_authenticated():
% if user.is_authenticated():
% if settings.MITX_FEATURES.get('ENABLE_TEXTBOOK'):
% if settings.MITX_FEATURES.get('ENABLE_TEXTBOOK'):
% for index, textbook in enumerate(course.textbooks):
% for index, textbook in enumerate(course.textbooks):
...
...
lms/templates/courseware/syllabus.html
0 → 100644
View file @
1cfed46d
<
%
inherit
file=
"/main.html"
/>
<
%
namespace
name=
'static'
file=
'/static_content.html'
/>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
</
%
block>
<
%
block
name=
"title"
><title>
${course.number} Course Info
</title></
%
block>
<
%
include
file=
"/courseware/course_navigation.html"
args=
"active_page='syllabus'"
/>
<
%!
from
courseware
.
courses
import
get_course_syllabus_section
%
>
<section
class=
"container"
>
<div
class=
"syllabus"
>
<h1>
Syllabus
</h1>
% if user.is_authenticated():
${get_course_syllabus_section(course, 'syllabus')}
% else:
${get_course_syllabus_section(course, 'guest_syllabus')}
% endif
</div>
</section>
lms/urls.py
View file @
1cfed46d
...
@@ -126,6 +126,8 @@ if settings.COURSEWARE_ENABLED:
...
@@ -126,6 +126,8 @@ if settings.COURSEWARE_ENABLED:
#Inside the course
#Inside the course
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/info$'
,
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/info$'
,
'courseware.views.course_info'
,
name
=
"info"
),
'courseware.views.course_info'
,
name
=
"info"
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/syllabus$'
,
'courseware.views.syllabus'
,
name
=
"syllabus"
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/book/(?P<book_index>[^/]*)/$'
,
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/book/(?P<book_index>[^/]*)/$'
,
'staticbook.views.index'
,
name
=
"book"
),
'staticbook.views.index'
,
name
=
"book"
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/book/(?P<book_index>[^/]*)/(?P<page>[^/]*)$'
,
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/book/(?P<book_index>[^/]*)/(?P<page>[^/]*)$'
,
...
...
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