From 53c1d2a0da6d0015fe3a3e4af481b5594f41a4b3 Mon Sep 17 00:00:00 2001 From: Adam Butterworth Date: Mon, 10 Feb 2020 13:32:08 -0500 Subject: [PATCH] Hide display titles for vertical blocks embedded in microfrontends (#23006) Relates to TNL-7048. Since bookmarking is handled in the courseware microfrontend, it needs to also manage the display of a unit title. --- common/lib/xmodule/xmodule/vertical_block.py | 1 + lms/djangoapps/courseware/views/views.py | 3 ++- lms/templates/vert_module.html | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/lib/xmodule/xmodule/vertical_block.py b/common/lib/xmodule/xmodule/vertical_block.py index 81dabedded..08cfc2e7ee 100644 --- a/common/lib/xmodule/xmodule/vertical_block.py +++ b/common/lib/xmodule/xmodule/vertical_block.py @@ -98,6 +98,7 @@ class VerticalBlock(SequenceFields, XModuleFields, StudioEditableBlock, XmlParse if view == STUDENT_VIEW: fragment_context.update({ 'show_bookmark_button': child_context.get('show_bookmark_button', not is_child_of_vertical), + 'show_title': child_context.get('show_title', True), 'bookmarked': child_context['bookmarked'], 'bookmark_id': u"{},{}".format( child_context['username'], six.text_type(self.location)), # pylint: disable=no-member diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index 2923216864..0af852d6b5 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -1586,7 +1586,8 @@ def render_xblock(request, usage_key_string, check_if_enrolled=True): ) student_view_context = request.GET.dict() - student_view_context['show_bookmark_button'] = False + student_view_context['show_bookmark_button'] = request.GET.get('show_bookmark_button', '0') == '1' + student_view_context['show_title'] = request.GET.get('show_title', '1') == '1' enable_completion_on_view_service = False completion_service = block.runtime.service(block, 'completion') diff --git a/lms/templates/vert_module.html b/lms/templates/vert_module.html index 8165169a7f..69620585f7 100644 --- a/lms/templates/vert_module.html +++ b/lms/templates/vert_module.html @@ -1,11 +1,12 @@ <%page expression_filter="h"/> <%! from openedx.core.djangolib.markup import HTML %> -%if unit_title: + +%if unit_title and show_title:

${unit_title}

% endif % if show_bookmark_button: - <%include file='bookmark_button.html' args="bookmark_id=bookmark_id, is_bookmarked=bookmarked"/> + <%include file='bookmark_button.html' args="bookmark_id=bookmark_id, is_bookmarked=bookmarked"/> % endif