From 09d814f7fdb72df3e8bc7e4f9ba15dafa21a8bfc Mon Sep 17 00:00:00 2001 From: Thomas Tracy Date: Mon, 6 Apr 2020 10:35:45 -0400 Subject: [PATCH] Add link to coaching interstitial for MB students who have not signed up for coaching (#23492) --- lms/envs/devstack.py | 1 + .../dashboard/_dashboard_course_listing.html | 28 +---------- .../dashboard/_dashboard_course_resume.html | 34 +++++++++++++ .../dashboard/_dashboard_course_resume.html | 50 +++++++++++++++++++ 4 files changed, 86 insertions(+), 27 deletions(-) create mode 100644 lms/templates/dashboard/_dashboard_course_resume.html create mode 100644 themes/edx.org/lms/templates/dashboard/_dashboard_course_resume.html diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index 865aca330a..f1d4e15e5c 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -293,3 +293,4 @@ EDXNOTES_CLIENT_NAME = 'edx_notes_api-backend-service' ############## Settings for Microfrontends ######################### LEARNING_MICROFRONTEND_URL = 'http://localhost:2000' +ACCOUNT_MICROFRONTEND_URL = 'http://localhost:1997' diff --git a/lms/templates/dashboard/_dashboard_course_listing.html b/lms/templates/dashboard/_dashboard_course_listing.html index b74d30035d..8ac9d1ced6 100644 --- a/lms/templates/dashboard/_dashboard_course_listing.html +++ b/lms/templates/dashboard/_dashboard_course_listing.html @@ -184,33 +184,7 @@ from util.course import get_link_for_about_page, get_encoded_course_sharing_utm_ % endif % else: - % if resume_button_url != '': - - ${_('Resume Course')} - -  ${course_overview.display_name_with_default} - - - % elif not is_course_blocked: - - ${_('View Course')} - -  ${course_overview.display_name_with_default} - - - % else: - - ${_('View Course')} - -  ${course_overview.display_name_with_default} - - - % endif + <%include file="_dashboard_course_resume.html" args="resume_button_url=resume_button_url, course_overview=course_overview, enrollment=enrollment, is_unfulfilled_entitlement=is_unfulfilled_entitlement, is_course_blocked=is_course_blocked, course_target=course_target, related_programs=related_programs"/> % endif % endif diff --git a/lms/templates/dashboard/_dashboard_course_resume.html b/lms/templates/dashboard/_dashboard_course_resume.html new file mode 100644 index 0000000000..4478376fa0 --- /dev/null +++ b/lms/templates/dashboard/_dashboard_course_resume.html @@ -0,0 +1,34 @@ +<%page args="resume_button_url, course_overview, enrollment, is_unfulfilled_entitlement, is_course_blocked, course_target, related_programs" expression_filter="h"/> + +<%! +import six +from django.utils.translation import ugettext as _ +%> + +% if resume_button_url != '': + + ${_('Resume Course')} + +  ${course_overview.display_name_with_default} + + +% elif not is_course_blocked: + + ${_('View Course')} + +  ${course_overview.display_name_with_default} + + +% else: + + ${_('View Course')} + +  ${course_overview.display_name_with_default} + + +% endif diff --git a/themes/edx.org/lms/templates/dashboard/_dashboard_course_resume.html b/themes/edx.org/lms/templates/dashboard/_dashboard_course_resume.html new file mode 100644 index 0000000000..5329d60b26 --- /dev/null +++ b/themes/edx.org/lms/templates/dashboard/_dashboard_course_resume.html @@ -0,0 +1,50 @@ +<%page args="resume_button_url, course_overview, enrollment, is_unfulfilled_entitlement, is_course_blocked, course_target, related_programs" expression_filter="h"/> + +<%! +import six +from django.utils.translation import ugettext as _ +%> + +% if resume_button_url != '': + <% + account_mfe_url = getattr(settings, 'ACCOUNT_MICROFRONTEND_URL', '') or '' + show_coaching_consent_form = plugins.get("coaching", {}).get("show_coaching_consent_form") + if related_programs and account_mfe_url != '' and show_coaching_consent_form: + for program in related_programs: + if program.get('type') == 'MicroBachelors': + resume_button_url = "%s/coaching_consent?next=%s" % (account_mfe_url, getattr(settings, 'LMS_ROOT_URL', '') + resume_button_url) + %> + + ${_('Resume Course')} + +  ${course_overview.display_name_with_default} + + +% elif not is_course_blocked: + <% + account_mfe_url = getattr(settings, 'ACCOUNT_MICROFRONTEND_URL', '') or '' + show_coaching_consent_form = plugins.get("coaching", {}).get("show_coaching_consent_form") + if related_programs and account_mfe_url != '' and show_coaching_consent_form: + for program in related_programs: + if program.get('type') == 'MicroBachelors': + course_target = "%s/coaching_consent?next=%s" % (account_mfe_url, getattr(settings, 'LMS_ROOT_URL', '') + course_target) + %> + + ${_('View Course')} + +  ${course_overview.display_name_with_default} + + +% else: + + ${_('View Course')} + +  ${course_overview.display_name_with_default} + + +% endif