From bf11b68fdac48cbdad38eb9fe4c9cdce9cd1effc Mon Sep 17 00:00:00 2001 From: Jeff LaJoie Date: Tue, 30 Jun 2020 09:53:57 -0400 Subject: [PATCH] ENT-2893: Updates header branding and href for Enterprise learners --- lms/envs/devstack.py | 2 + lms/templates/header/navbar-logo-header.html | 23 ++++++++--- lms/templates/header/user_dropdown.html | 14 ++++++- .../enterprise_support/tests/factories.py | 23 ++++++++++- .../enterprise_support/tests/test_utils.py | 39 ++++++++++++++++++- openedx/features/enterprise_support/utils.py | 35 +++++++++++++++++ 6 files changed, 127 insertions(+), 9 deletions(-) diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index 31d8bb2fe4..88461904d5 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -360,6 +360,8 @@ MKTG_URLS = { 'WHAT_IS_VERIFIED_CERT': '/verified-certificate', } +ENTERPRISE_LEARNER_PORTAL_BASE_URL = 'http://localhost:8734' + ENTERPRISE_MARKETING_FOOTER_QUERY_PARAMS = {} CREDENTIALS_SERVICE_USERNAME = 'credentials_worker' diff --git a/lms/templates/header/navbar-logo-header.html b/lms/templates/header/navbar-logo-header.html index 933e4c2571..bd61dccb40 100644 --- a/lms/templates/header/navbar-logo-header.html +++ b/lms/templates/header/navbar-logo-header.html @@ -8,17 +8,30 @@ from django.urls import reverse from django.utils.translation import ugettext as _ from lms.djangoapps.ccx.overrides import get_current_ccx from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers +from openedx.features.enterprise_support.api import get_enterprise_learner_data +from openedx.features.enterprise_support.utils import get_enterprise_learner_generic_name, get_enterprise_learner_portals # App that handles subdomain specific branding from branding import api as branding_api %> +<% +enterprise_customer_links = get_enterprise_learner_portals(request) +enterprise_customer_link = enterprise_customer_links[0] if enterprise_customer_links else None # Only want to show the first link +%> +

- - <%block name="navigation_logo"> - - - + % if enterprise_customer_link: + + + + % else: + + <%block name="navigation_logo"> + + + + % endif % if course:
${course.display_org_with_default}: diff --git a/lms/templates/header/user_dropdown.html b/lms/templates/header/user_dropdown.html index 29288047c8..79c213f025 100644 --- a/lms/templates/header/user_dropdown.html +++ b/lms/templates/header/user_dropdown.html @@ -3,6 +3,8 @@ <%namespace name='static' file='static_content.html'/> <%! +import json + from django.conf import settings from django.urls import reverse from django.utils.translation import ugettext as _ @@ -10,7 +12,7 @@ from django.utils.translation import ugettext as _ from openedx.core.djangoapps.user_api.accounts.image_helpers import get_profile_image_urls_for_user from openedx.core.djangoapps.user_api.accounts.toggles import should_redirect_to_order_history_microfrontend from openedx.core.djangoapps.user_api.accounts.utils import retrieve_last_sitewide_block_completed -from openedx.features.enterprise_support.utils import get_enterprise_learner_generic_name +from openedx.features.enterprise_support.utils import get_enterprise_learner_generic_name, get_enterprise_learner_portals %> <% @@ -20,6 +22,7 @@ profile_image_url = get_profile_image_urls_for_user(self.real_user)['medium'] username = self.real_user.username resume_block = retrieve_last_sitewide_block_completed(self.real_user) displayname = get_enterprise_learner_generic_name(request) or username +enterprise_customer_portals = get_enterprise_learner_portals(request) %>