Commit 25229a74 by Andy Armstrong

Implement course handouts

LEARNER-607
parent e7e7b3bc
...@@ -278,7 +278,7 @@ def get_course_info_section(request, user, course, section_key): ...@@ -278,7 +278,7 @@ def get_course_info_section(request, user, course, section_key):
html = '' html = ''
if info_module is not None: if info_module is not None:
try: try:
html = info_module.render(STUDENT_VIEW).content html = info_module.render(STUDENT_VIEW).content.strip()
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
html = render_to_string('courseware/error-message.html', None) html = render_to_string('courseware/error-message.html', None)
log.exception( log.exception(
......
...@@ -11,8 +11,6 @@ ...@@ -11,8 +11,6 @@
padding: 0 ($baseline * 2); padding: 0 ($baseline * 2);
&:not(:first-child) { &:not(:first-child) {
border-top: 1px solid $lms-border-color;
.section-name { .section-name {
margin-top: $baseline; margin-top: $baseline;
} }
......
...@@ -149,3 +149,7 @@ ...@@ -149,3 +149,7 @@
} }
} }
} }
.section:not(:first-child) {
margin-top: $baseline;
}
# Unified course experience settings # Unified course experience settings.
# Waffle flag to enable a single unified "Course" tab.
UNIFIED_COURSE_EXPERIENCE_FLAG = 'unified_course_experience' UNIFIED_COURSE_EXPERIENCE_FLAG = 'unified_course_experience'
# Waffle flag to enable the full screen course content view
# along with a unified course home page.
UNIFIED_COURSE_VIEW_FLAG = 'unified_course_view' UNIFIED_COURSE_VIEW_FLAG = 'unified_course_view'
...@@ -65,15 +65,23 @@ from openedx.features.course_experience import UNIFIED_COURSE_EXPERIENCE_FLAG ...@@ -65,15 +65,23 @@ from openedx.features.course_experience import UNIFIED_COURSE_EXPERIENCE_FLAG
${HTML(outline_fragment.body_html())} ${HTML(outline_fragment.body_html())}
</main> </main>
<aside class="layout-col layout-col-a"> <aside class="layout-col layout-col-a">
<h3 class="hd-6">Course Tools</h3> <div class="section section-tools">
<ul class="list-unstyled"> <h3 class="hd-6">${_("Course Tools")}</h3>
<li> <ul class="list-unstyled">
<a class="action-show-bookmarks" href="${reverse('openedx.course_bookmarks.home', args=[course.id])}"> <li>
<span class="icon fa fa-bookmark" aria-hidden="true"></span> <a class="action-show-bookmarks" href="${reverse('openedx.course_bookmarks.home', args=[course.id])}">
${_("Bookmarks")} <span class="icon fa fa-bookmark" aria-hidden="true"></span>
</a> ${_("Bookmarks")}
</li> </a>
</ul> </li>
</ul>
</div>
% if handouts_html:
<div class="section section-handouts">
<h3 class="hd-6">${_("Course Handouts")}</h3>
${HTML(handouts_html)}
</div>
% endif
</aside> </aside>
</div> </div>
% else: % else:
......
...@@ -9,7 +9,7 @@ from django.utils.decorators import method_decorator ...@@ -9,7 +9,7 @@ from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_control from django.views.decorators.cache import cache_control
from django.views.decorators.csrf import ensure_csrf_cookie from django.views.decorators.csrf import ensure_csrf_cookie
from courseware.courses import get_course_with_access, get_last_accessed_courseware from courseware.courses import get_course_info_section, get_course_with_access, get_last_accessed_courseware
from lms.djangoapps.courseware.views.views import CourseTabView from lms.djangoapps.courseware.views.views import CourseTabView
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.plugin_api.views import EdxFragmentView from openedx.core.djangoapps.plugin_api.views import EdxFragmentView
...@@ -56,11 +56,15 @@ class CourseHomeFragmentView(EdxFragmentView): ...@@ -56,11 +56,15 @@ class CourseHomeFragmentView(EdxFragmentView):
# Get the last accessed courseware # Get the last accessed courseware
last_accessed_url, __ = get_last_accessed_courseware(course, request, request.user) last_accessed_url, __ = get_last_accessed_courseware(course, request, request.user)
# Get the handouts
handouts_html = get_course_info_section(request, request.user, course, 'handouts')
# Render the course home fragment # Render the course home fragment
context = { context = {
'csrf': csrf(request)['csrf_token'], 'csrf': csrf(request)['csrf_token'],
'course': course, 'course': course,
'outline_fragment': outline_fragment, 'outline_fragment': outline_fragment,
'handouts_html': handouts_html,
'has_visited_course': last_accessed_url is not None, 'has_visited_course': last_accessed_url is not None,
'disable_courseware_js': True, 'disable_courseware_js': True,
'uses_pattern_library': True, 'uses_pattern_library': True,
......
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