Commit 615f11e2 by Bridger Maxwell

Merge remote-tracking branch 'origin/master' into template_caching

parents d38903ac 02a30ef0
......@@ -24,7 +24,11 @@ class CourseDescriptor(SequenceDescriptor):
@property
def title(self):
self.metadata['display_name']
return self.metadata['display_name']
@property
def number(self):
return self.location.course
@property
def instructors(self):
......@@ -38,6 +42,7 @@ class CourseDescriptor(SequenceDescriptor):
"""
This returns the snippet of html to be rendered on the course about page, given the key for the section.
Valid keys:
- overview
- title
- university
- number
......@@ -59,10 +64,10 @@ class CourseDescriptor(SequenceDescriptor):
# TODO: Remove number, instructors from this list
if section_key in ['short_description', 'description', 'key_dates', 'video', 'course_staff_short', 'course_staff_extended',
'requirements', 'syllabus', 'textbook', 'faq', 'more_info', 'number', 'instructors']:
'requirements', 'syllabus', 'textbook', 'faq', 'more_info', 'number', 'instructors', 'overview']:
try:
with self.system.resources_fs.open(path("about") / section_key + ".html") as htmlFile:
return htmlFile.read()
return htmlFile.read().decode('utf-8')
except ResourceNotFoundError:
log.exception("Missing about section {key} in course {url}".format(key=section_key, url=self.location.url()))
return "! About section missing !"
......@@ -91,7 +96,7 @@ class CourseDescriptor(SequenceDescriptor):
if section_key in ['handouts', 'guest_handouts', 'updates', 'guest_updates']:
try:
with self.system.resources_fs.open(path("info") / section_key + ".html") as htmlFile:
return htmlFile.read()
return htmlFile.read().decode('utf-8')
except ResourceNotFoundError:
log.exception("Missing info section {key} in course {url}".format(key=section_key, url=self.location.url()))
return "! Info section missing !"
......
# Running the CMS
One can start the CMS by running `rake cms`. This will run the server on localhost
port 8001.
However, the server also needs data to work from.
## Installing Mongodb
Please see http://www.mongodb.org/downloads for more detailed instructions.
### Ubuntu
sudo apt-get install mongodb
### OSX
Use the MacPorts package `mongodb` or the Homebrew formula `mongodb`
## Initializing Mongodb
Check out the course data directories that you want to work with into the
`GITHUB_REPO_ROOT` (by default, `../data`). Then run the following command:
rake django-admin[import,cms,dev,../data]
Replace `../data` with your `GITHUB_REPO_ROOT` if it's not the default value.
This will import all courses in your data directory into mongodb
......@@ -9,7 +9,7 @@
<header class="course-preview">
<a href="${reverse('about_course', args=[course.id])}">
<hgroup>
<h2>${course.get_about_section('title')}</h2>
<h2>${course.number} ${course.get_about_section('title')}</h2>
</hgroup>
<div class="info-link">&#x2794;</div>
</a>
......@@ -19,35 +19,7 @@
<img src="${static.url('images/courses/history.png')}">
</div>
<div class="desc">
<p>An advanced introduction to analog circuits. An advanced introduction to analog circuits.</p>
</div>
<div class="bottom">
<a href="#" class="university">${course.get_about_section('university')}</a>
<span class="start-date">7/23/12</span>
</div>
</section>
</div>
<div class="meta-info">
<p class="university">${course.get_about_section('university')}</p>
</div>
</article>
<article id="${course.id}"class="course">
<div class="inner-wrapper">
<header class="course-preview">
<a href="${reverse('about_course', args=[course.id])}">
<hgroup>
<h2>${course.get_about_section('title')}</h2>
</hgroup>
<div class="info-link">&#x2794;</div>
</a>
</header>
<section class="info">
<div class="cover-image">
<img src="${static.url('images/courses/history.png')}">
</div>
<div class="desc">
<p>An advanced introduction to analog circuits. An advanced introduction to analog circuits.</p>
${course.get_about_section('short_description')}
</div>
<div class="bottom">
<a href="#" class="university">${course.get_about_section('university')}</a>
......
......@@ -11,7 +11,7 @@
<div class="intro-inner-wrapper">
<section class="intro">
<hgroup>
<h1>${course.get_about_section("title")}</h1><h2><a href="#">${course.get_about_section("university")}</a></h2>
<h1>${course.number}: ${course.get_about_section("title")}</h1><h2><a href="#">${course.get_about_section("university")}</a></h2>
</hgroup>
<div class="main-cta">
......@@ -32,66 +32,15 @@
<section class="details">
<nav>
<a href="#" class="active">Overview</a>
<a href="#">FAQ</a>
<a href="#">Requirements</a>
<a href="#">Text-book</a>
<a href="#">Syllabus</a>
<a href="#">Reviews</a>
## <a href="#">FAQ</a>
## <a href="#">Requirements</a>
## <a href="#">Text-book</a>
## <a href="#">Syllabus</a>
## <a href="#">Reviews</a>
</nav>
<div class="inner-wrapper">
<section class="about">
<h2>About this course</h2>
<p>${course.get_about_section("description")}</p>
</section>
<section class="course-staff">
<h2>Course staff</h3>
<article class="teacher">
<div class="teacher-image">
<img src="${static.url('images/anant.jpg')}" />
</div>
<h3>Anant Agarwal</h3>
<p>Director of MIT’s Computer Science and Artificial Intelligence Laboratory (CSAIL) and a professor of the Electrical Engineering and Computer Science department at MIT. His research focus is in parallel computer architectures and cloud software systems, and he is a founder of several successful startups, including Tilera, a company that produces scalable multicore processors. Prof. Agarwal won MIT’s Smullin and Jamieson prizes for teaching and co-authored the course textbook “Foundations of Analog and Digital Electronic Circuits.”</p>
</article>
<article class="teacher">
<div class="teacher-image">
<img src="${static.url('images/gerald.jpg')}" />
</div>
<h3>Gerald Sussman</h3>
<p>Professor of Electrical Engineering at MIT. He is a well known educator in the computer science community, perhaps best known as the author of Structure and Interpretation of Computer Programs, which is universally acknowledged as one of the top ten textbooks in computer science, and as the creator of Scheme, a popular teaching language. His research spans a range of topics, from artificial intelligence, to physics and chaotic systems, to supercomputer design.</p>
</article>
<article class="teacher">
<div class="teacher-image">
<img src="${static.url('images/piotr.jpg')}" />
</div>
<h3>Piotr Mitros</h3>
<p>Research Scientist at MIT. His research focus is in finding ways to apply techniques from control systems to optimizing the learning process. Dr. Mitros has worked as an analog designer at Texas Instruments, Talking Lights, and most recently, designed the analog front end for a novel medical imaging modality for Rhythmia Medical.</p>
</article>
</section>
<section class="requirements">
<h2>Requirements</h2>
<p>${course.get_about_section("requirements")}</p>
</section>
<section class="syllabus">
<h2>Syllabus</h2>
<p>${course.get_about_section("syllabus")}</p>
</section>
<section class="text-book">
<h2>Textbook</h2>
${course.get_about_section("textbook")}
</section>
<section class="course-faq">
<h2>Frequently Asked Questions</h2>
<p>${course.get_about_section("faq")}</p>
</section>
${course.get_about_section("overview")}
</div>
</section>
......@@ -114,9 +63,9 @@
<ol class="important-dates">
<li><div class="icon start-icon"></div><p>Classes Start</p><span class="start-date">7/12/12</span></li>
<li><div class="icon final-icon"></div><p>Final Exam</p><span class="final-date">12/09/12</span></li>
<li><div class="icon length-icon"></div><p>Course Length</p><span class="course-length">15 weeks</span></li>
<li><div class="icon number-icon"></div><p>Course Number</p><span class="course-number">${course.get_about_section("number")}</span></li>
##<li><div class="icon final-icon"></div><p>Final Exam</p><span class="final-date">12/09/12</span></li>
##<li><div class="icon length-icon"></div><p>Course Length</p><span class="course-length">15 weeks</span></li>
<li><div class="icon number-icon"></div><p>Course Number</p><span class="course-number">${course.number}</span></li>
</ol>
</section>
</section>
......
......@@ -127,7 +127,7 @@ if settings.COURSEWARE_ENABLED:
# TODO (vshnayder): there is no student.views.course_info.
# Where should this point instead? same as the info view?
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/about$',
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)$',
'student.views.course_info', name="about_course"),
)
......
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