Updated Help Center Url

Updated the generated url in the navigation
and footer based on the selected language of
the page.
This commit is contained in:
usama sadiq
2019-07-31 13:03:55 +05:00
parent b793c5e791
commit d83ec0f607
2 changed files with 25 additions and 5 deletions

View File

@@ -109,7 +109,10 @@ def get_footer(is_secure=True, language=settings.LANGUAGE_CODE):
"navigation_links": _footer_navigation_links(language),
"legal_links": _footer_legal_links(language),
"edx_org_link": {
"url": "https://www.edx.org/?utm_medium=affiliate_partner&utm_source=opensource-partner&utm_content=open-edx-partner-footer-link&utm_campaign=open-edx-footer",
"url": "https://www.edx.org/?utm_medium=affiliate_partner"
"&utm_source=opensource-partner"
"&utm_content=open-edx-partner-footer-link"
"&utm_campaign=open-edx-footer",
"text": _("Take free online courses at edX.org"),
},
}
@@ -218,12 +221,29 @@ def _build_support_form_url(full_path=False):
return contact_us_page
def _build_help_center_url(language=settings.LANGUAGE_CODE):
"""
Return the help-center URL based on the
language selected on the homepage.
:param language: selected language
:return: help-center URL
"""
support_url = settings.SUPPORT_SITE_LINK
enabled_languages = {
'en': 'hc/en-us',
'es': 'hc/es-419'
}
if language in enabled_languages:
support_url += '/' + enabled_languages[language]
return support_url
def _footer_connect_links(language=settings.LANGUAGE_CODE):
"""Return the connect links to display in the footer. """
links = [
("blog", (marketing_link("BLOG"), _("Blog"))),
("contact", (_build_support_form_url(full_path=True), _("Contact Us"))),
("help-center", (settings.SUPPORT_SITE_LINK, _("Help Center"))),
("help-center", (_build_help_center_url(settings.LANGUAGE_CODE), _("Help Center"))),
]
if language == settings.LANGUAGE_CODE:
@@ -258,7 +278,7 @@ def _footer_navigation_links(language=settings.LANGUAGE_CODE):
_(u"{platform_name} for Business").format(platform_name=platform_name)
)),
("blog", (marketing_link("BLOG"), _("Blog"))),
("help-center", (settings.SUPPORT_SITE_LINK, _("Help Center"))),
("help-center", (_build_help_center_url(settings.LANGUAGE_CODE), _("Help Center"))),
("contact", (_build_support_form_url(), _("Contact"))),
("careers", (marketing_link("CAREERS"), _("Careers"))),
("donate", (marketing_link("DONATE"), _("Donate"))),

View File

@@ -95,7 +95,7 @@ class TestFooter(TestCase):
{'url': 'https://business.edx.org', 'name': 'enterprise', 'title': '\xe9dX for Business'},
{'url': 'https://edx.org/edx-blog', 'name': 'blog', 'title': 'Blog'},
{'url': 'https://edx.org/news-announcements', 'name': 'news', 'title': 'News'},
{'url': 'https://support.example.com', 'name': 'help-center', 'title': 'Help Center'},
{'url': 'https://support.example.com/hc/en-us', 'name': 'help-center', 'title': 'Help Center'},
{'url': '/support/contact_us', 'name': 'contact', 'title': 'Contact'},
{'url': 'https://edx.org/careers', 'name': 'careers', 'title': 'Careers'},
{'url': 'https://edx.org/donate', 'name': 'donate', 'title': 'Donate'}
@@ -125,7 +125,7 @@ class TestFooter(TestCase):
{'url': 'https://edx.org/edx-blog', 'name': 'blog', 'title': 'Blog'},
# pylint: disable=line-too-long
{'url': '{base_url}/support/contact_us'.format(base_url=settings.LMS_ROOT_URL), 'name': 'contact', 'title': 'Contact Us'},
{'url': 'https://support.example.com', 'name': 'help-center', 'title': 'Help Center'},
{'url': 'https://support.example.com/hc/en-us', 'name': 'help-center', 'title': 'Help Center'},
{'url': 'https://edx.org/media-kit', 'name': 'media_kit', 'title': 'Media Kit'},
{'url': 'https://edx.org/donate', 'name': 'donate', 'title': 'Donate'}
],