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