Merge pull request #187 from MITx/dormsbee/portal_display_tweaks

Dormsbee/portal display tweaks
This commit is contained in:
Calen Pennington
2012-07-17 06:26:03 -07:00
4 changed files with 15 additions and 34 deletions

View File

@@ -24,7 +24,11 @@ class CourseDescriptor(SequenceDescriptor):
@property @property
def title(self): def title(self):
self.metadata['display_name'] return self.metadata['display_name']
@property
def number(self):
return self.location.course
@property @property
def instructors(self): def instructors(self):
@@ -62,7 +66,7 @@ class CourseDescriptor(SequenceDescriptor):
'requirements', 'syllabus', 'textbook', 'faq', 'more_info', 'number', 'instructors']: 'requirements', 'syllabus', 'textbook', 'faq', 'more_info', 'number', 'instructors']:
try: try:
with self.system.resources_fs.open(path("about") / section_key + ".html") as htmlFile: with self.system.resources_fs.open(path("about") / section_key + ".html") as htmlFile:
return htmlFile.read() return htmlFile.read().decode('utf-8')
except ResourceNotFoundError: except ResourceNotFoundError:
log.exception("Missing about section {key} in course {url}".format(key=section_key, url=self.location.url())) log.exception("Missing about section {key} in course {url}".format(key=section_key, url=self.location.url()))
return "! About section missing !" return "! About section missing !"
@@ -91,7 +95,7 @@ class CourseDescriptor(SequenceDescriptor):
if section_key in ['handouts', 'guest_handouts', 'updates', 'guest_updates']: if section_key in ['handouts', 'guest_handouts', 'updates', 'guest_updates']:
try: try:
with self.system.resources_fs.open(path("info") / section_key + ".html") as htmlFile: with self.system.resources_fs.open(path("info") / section_key + ".html") as htmlFile:
return htmlFile.read() return htmlFile.read().decode('utf-8')
except ResourceNotFoundError: except ResourceNotFoundError:
log.exception("Missing info section {key} in course {url}".format(key=section_key, url=self.location.url())) log.exception("Missing info section {key} in course {url}".format(key=section_key, url=self.location.url()))
return "! Info section missing !" return "! Info section missing !"

View File

@@ -9,35 +9,7 @@
<header class="course-preview"> <header class="course-preview">
<a href="${reverse('about_course', args=[course.id])}"> <a href="${reverse('about_course', args=[course.id])}">
<hgroup> <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>
</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>
</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> </hgroup>
<div class="info-link">&#x2794;</div> <div class="info-link">&#x2794;</div>
</a> </a>

View File

@@ -11,7 +11,7 @@
<div class="intro-inner-wrapper"> <div class="intro-inner-wrapper">
<section class="intro"> <section class="intro">
<hgroup> <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> </hgroup>
<div class="main-cta"> <div class="main-cta">
@@ -47,6 +47,10 @@
<section class="course-staff"> <section class="course-staff">
<h2>Course staff</h3> <h2>Course staff</h3>
${course.get_about_section("instructors")}
<!--
<article class="teacher"> <article class="teacher">
<div class="teacher-image"> <div class="teacher-image">
<img src="${static.url('images/anant.jpg')}" /> <img src="${static.url('images/anant.jpg')}" />
@@ -70,6 +74,7 @@
<h3>Piotr Mitros</h3> <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> <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> </article>
-->
</section> </section>
<section class="requirements"> <section class="requirements">

View File

@@ -90,7 +90,7 @@ if settings.COURSEWARE_ENABLED:
# TODO (vshnayder): there is no student.views.course_info. # TODO (vshnayder): there is no student.views.course_info.
# Where should this point instead? same as the info view? # 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"), 'student.views.course_info', name="about_course"),
) )