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
a32aeac0
Commit
a32aeac0
authored
Jun 20, 2012
by
David Ormsbee
Committed by
Matthew Mongeau
Jun 21, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add info page support with multiple courses
parent
7e82f324
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
10 deletions
+31
-10
common/djangoapps/util/views.py
+16
-2
lms/djangoapps/courseware/courses.py
+1
-1
lms/envs/common.py
+2
-1
lms/templates/course.html
+2
-0
lms/templates/info.html
+4
-4
lms/templates/main.html
+1
-1
lms/templates/navigation.html
+3
-0
lms/urls.py
+2
-1
No files found.
common/djangoapps/util/views.py
View file @
a32aeac0
...
...
@@ -57,9 +57,23 @@ def send_feedback(request):
)
return
HttpResponse
(
json
.
dumps
({
'success'
:
True
}))
def
info
(
request
):
def
info
(
request
,
course_id
=
None
):
''' Info page (link from main header) '''
return
render_to_response
(
"info.html"
,
{})
try
:
course
=
settings
.
COURSES_BY_ID
[
course_id
]
except
KeyError
:
raise
Http404
(
"Course not found"
)
# We're bypassing the templating system for this part. We should cache
# this.
sections
=
[
"updates"
,
"handouts"
,
"guest_updates"
,
"guest_handouts"
]
sections_to_content
=
{}
for
section
in
sections
:
filename
=
section
+
".html"
with
open
(
course
.
path
/
"info"
/
filename
)
as
f
:
sections_to_content
[
section
]
=
f
.
read
()
return
render_to_response
(
"info.html"
,
sections_to_content
)
# From http://djangosnippets.org/snippets/1042/
def
parse_accept_header
(
accept
):
...
...
lms/djangoapps/courseware/courses.py
View file @
a32aeac0
...
...
@@ -29,7 +29,7 @@ class Course(namedtuple('Course', _FIELDS)):
"""
@property
def
id
(
self
):
return
"{0.institution},{0.number},{0.run_id}"
.
format
(
self
)
return
"{0.institution},{0.number},{0.run_id}"
.
format
(
self
)
.
replace
(
" "
,
"_"
)
@classmethod
def
load_from_path
(
cls
,
course_path
):
...
...
lms/envs/common.py
View file @
a32aeac0
...
...
@@ -65,8 +65,9 @@ sys.path.append(COMMON_ROOT / 'djangoapps')
sys
.
path
.
append
(
COMMON_ROOT
/
'lib'
)
######### EDX dormsbee/portal changes #################
from
courseware.courses
import
load_courses
from
courseware.courses
import
create_lookup_table
,
load_courses
COURSES
=
load_courses
(
ENV_ROOT
/
"data"
)
COURSES_BY_ID
=
create_lookup_table
(
COURSES
)
#######################################################
################################## MITXWEB #####################################
...
...
lms/templates/course.html
View file @
a32aeac0
...
...
@@ -12,6 +12,7 @@
<hgroup>
<h2>
${course.title}
</h2>
<p>
${",".join(course.instructors)}
—
${course.institution}
</p>
<p>
${course.id}
</p>
</hgroup>
<div
class=
"edit"
>
Register
</div>
<section
class=
"meta"
>
...
...
@@ -22,5 +23,6 @@
</section>
</section>
</a>
<p><a
href=
"courses/${course.id}/info"
>
Hackish temp link to courseware
</a></p>
</article>
%endfor
lms/templates/info.html
View file @
a32aeac0
...
...
@@ -7,17 +7,17 @@
<div
class=
"info-wrapper"
>
% if user.is_authenticated():
<section
class=
"updates"
>
<
%
include
file=
"updates.html"
/>
${updates}
</section>
<section
aria-label=
"Handout Navigation"
class=
"handouts"
>
<
%
include
file=
"handouts.html"
/>
${handouts}
</section>
% else:
<section
class=
"updates"
>
<
%
include
file=
"guest_updates.html"
/>
${guest_updates}
</section>
<section
aria-label=
"Handout Navigation"
class=
"handouts"
>
<
%
include
file=
"guest_handouts.html"
/>
${guest_handouts}
</section>
% endif
</div>
...
...
lms/templates/main.html
View file @
a32aeac0
...
...
@@ -2,7 +2,7 @@
<!DOCTYPE html>
<html>
<head>
<
%
block
name=
"title"
><title>
MITx 6.002x
</title></
%
block>
<
%
block
name=
"title"
><title>
edX
</title></
%
block>
<link
href=
'http://fonts.googleapis.com/css?family=Open+Sans:800italic,400,800'
rel=
'stylesheet'
type=
'text/css'
>
<link
rel=
"stylesheet"
href=
"${static.url('js/jquery.treeview.css')}"
type=
"text/css"
media=
"all"
/>
...
...
lms/templates/navigation.html
View file @
a32aeac0
## TODO: Split this into two files, one for people who are authenticated, and
## one for people who aren't. Assume a Course object is passed to the former,
## instead of using settings.COURSE_TITLE
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
<header
class=
"app"
aria-label=
"Global Navigation"
>
<section
class=
"wrapper"
>
...
...
lms/urls.py
View file @
a32aeac0
...
...
@@ -50,7 +50,6 @@ if settings.PERFSTATS:
if
settings
.
COURSEWARE_ENABLED
:
urlpatterns
+=
(
url
(
r'^courseware/$'
,
'courseware.views.index'
,
name
=
"courseware"
),
url
(
r'^info$'
,
'util.views.info'
),
url
(
r'^wiki/'
,
include
(
'simplewiki.urls'
)),
url
(
r'^masquerade/'
,
include
(
'masquerade.urls'
)),
url
(
r'^courseware/(?P<course>[^/]*)/(?P<chapter>[^/]*)/(?P<section>[^/]*)/(?P<position>[^/]*)$'
,
'courseware.views.index'
),
...
...
@@ -76,6 +75,8 @@ if settings.COURSEWARE_ENABLED:
# Multicourse related:
url
(
r'^courses$'
,
'courseware.views.courses'
),
url
(
r'^courses/(?P<course_id>[^/]*)/info$'
,
'util.views.info'
),
)
if
settings
.
ENABLE_MULTICOURSE
:
...
...
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