Commit 43e6bbb2 by Matthew Mongeau

Added info page content

parent c47cdc7f
......@@ -61,3 +61,25 @@ class CourseDescriptor(SequenceDescriptor):
return self.number
raise KeyError("Invalid about key " + str(section_key))
def get_info_section(self, section_key):
"""
This returns the snippet of html to be rendered on the course info page, given the key for the section.
Valid keys:
- handouts
- guest_handouts
- updates
- guest_updates
"""
# 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 ['handouts', 'guest_handouts', 'updates', 'guest_updates']:
try:
with self.system.resources_fs.open(path("info") / section_key + ".html") as htmlFile:
return htmlFile.read()
except IOError:
return "! About section missing !"
raise KeyError("Invalid about key " + str(section_key))
......@@ -7,17 +7,17 @@
<div class="info-wrapper">
% if user.is_authenticated():
<section class="updates">
${updates}
${course.get_info_section('updates')}
</section>
<section aria-label="Handout Navigation" class="handouts">
${handouts}
${course.get_info_section('handouts')}
</section>
% else:
<section class="updates">
${guest_updates}
${course.get_info_section('guest_updates')}
</section>
<section aria-label="Handout Navigation" class="handouts">
${guest_handouts}
${course.get_info_section('guest_handouts')}
</section>
% endif
</div>
......
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