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.
This commit is contained in:
Adam Butterworth
2020-02-10 13:32:08 -05:00
committed by GitHub
parent 59768e7498
commit 53c1d2a0da
3 changed files with 6 additions and 3 deletions

View File

@@ -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

View File

@@ -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')

View File

@@ -1,11 +1,12 @@
<%page expression_filter="h"/>
<%! from openedx.core.djangolib.markup import HTML %>
%if unit_title:
%if unit_title and show_title:
<h2 class="hd hd-2 unit-title">${unit_title}</h2>
% 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
<div class="vert-mod">