Merge pull request #23048 from edx/dcs/mfe-switcher

Add button to switch to courseware MFE
This commit is contained in:
Dave St.Germain
2020-02-21 11:31:54 -05:00
committed by GitHub
2 changed files with 17 additions and 1 deletions

View File

@@ -482,7 +482,7 @@ class CoursewareIndex(View):
table_of_contents['previous_of_active_section'],
table_of_contents['next_of_active_section'],
)
courseware_context['unit'] = section_context.get('activate_block_id', '')
courseware_context['fragment'] = self.section.render(self.view, section_context)
if self.section.position and self.section.has_children:

View File

@@ -19,6 +19,16 @@ show_preview_menu = course and can_masquerade and supports_preview_menu
def selected(is_selected):
return "selected" if is_selected else ""
def get_mfe_link():
if section:
mfe_link = '{}course/{}/{}'.format(settings.LEARNING_MICROFRONTEND_URL, course.id, section.location)
if unit:
mfe_link += '/' + unit
else:
mfe_link = None
return mfe_link
mfe_link = get_mfe_link()
course_partitions = get_all_partitions_for_course(course)
masquerade_user_name = masquerade.user_name if masquerade else None
masquerade_group_id = masquerade.group_id if masquerade else None
@@ -66,6 +76,12 @@ show_preview_menu = course and can_masquerade and supports_preview_menu
</p>
</div>
% endif
% if user.is_staff and mfe_link:
<div style="text-align: right;float:right;padding-bottom:5px">
<p style="color: white; display: inline-block; margin-right: 10px;">We're working on a new learning sequence experience</p>
<a class="btn btn-primary" style="border: solid 1px white;" href="${mfe_link}">View this unit in the new experience</a>
</div>
% endif
</div>
</nav>