Commit af0494c9 by David Ormsbee

Remove sections from ever getting appended in the first place if hide_from_toc is true

parent 675db277
...@@ -58,11 +58,11 @@ def toc_for_course(user, request, course, active_chapter, active_section): ...@@ -58,11 +58,11 @@ def toc_for_course(user, request, course, active_chapter, active_section):
section.metadata.get('display_name') == active_section) section.metadata.get('display_name') == active_section)
hide_from_toc = section.metadata.get('hide_from_toc', 'false').lower() == 'true' hide_from_toc = section.metadata.get('hide_from_toc', 'false').lower() == 'true'
sections.append({'name': section.metadata.get('display_name'), if not hide_from_toc:
'format': section.metadata.get('format', ''), sections.append({'name': section.metadata.get('display_name'),
'due': section.metadata.get('due', ''), 'format': section.metadata.get('format', ''),
'active': active, 'due': section.metadata.get('due', ''),
'hide_from_toc' : hide_from_toc}) 'active': active})
chapters.append({'name': chapter.metadata.get('display_name'), chapters.append({'name': chapter.metadata.get('display_name'),
'sections': sections, 'sections': sections,
......
...@@ -5,17 +5,15 @@ ...@@ -5,17 +5,15 @@
<ul> <ul>
% for section in chapter['sections']: % for section in chapter['sections']:
% if not section['hide_from_toc']: <li${' class="active"' if 'active' in section and section['active'] else ''}>
<li${' class="active"' if 'active' in section and section['active'] else ''}> <a href="${reverse('courseware_section', args=[course_id] + format_url_params([chapter['name'], section['name']]))}">
<a href="${reverse('courseware_section', args=[course_id] + format_url_params([chapter['name'], section['name']]))}"> <p>${section['name']}
<p>${section['name']} <span class="subtitle">
<span class="subtitle"> ${section['format']} ${"due " + section['due'] if 'due' in section and section['due'] != '' else ''}
${section['format']} ${"due " + section['due'] if 'due' in section and section['due'] != '' else ''} </span>
</span> </p>
</p> </a>
</a> </li>
</li>
% endif
% endfor % endfor
</ul> </ul>
</%def> </%def>
......
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