From e66b9e7fff8631e5db00340ba9e59676b3969f16 Mon Sep 17 00:00:00 2001 From: Sid Verma <sid@opencraft.com> Date: Tue, 19 Jan 2021 15:44:36 +0530 Subject: [PATCH] Add option to disable the help link --- cms/templates/widgets/header.html | 8 +++++--- lms/envs/common.py | 11 +++++++++++ lms/templates/header/navbar-authenticated.html | 9 ++++++--- .../bootstrap/navbar-authenticated.html | 14 ++++++++------ .../navigation/navbar-authenticated.html | 10 ++++++---- .../templates/header/navbar-authenticated.html | 17 ++++++++++------- 6 files changed, 46 insertions(+), 23 deletions(-) diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html index 36665df0ff5..4594f113b11 100644 --- a/cms/templates/widgets/header.html +++ b/cms/templates/widgets/header.html @@ -236,9 +236,11 @@ <nav class="nav-account nav-is-signedin nav-dd ui-right" aria-label="${_('Account')}"> <h2 class="sr-only">${_("Account Navigation")}</h2> <ol> - <li class="nav-item nav-account-help"> - <h3 class="title"><span class="label"><a href="${get_online_help_info(online_help_token)['doc_url']}" title="${_('Contextual Online Help')}" rel="noopener" target="_blank">${_("Help")}</a></span></h3> - </li> + % if settings.FEATURES.get('ENABLE_HELP_LINK'): + <li class="nav-item nav-account-help"> + <h3 class="title"><span class="label"><a href="${get_online_help_info(online_help_token)['doc_url']}" title="${_('Contextual Online Help')}" rel="noopener" target="_blank">${_("Help")}</a></span></h3> + </li> + % endif <li class="nav-item nav-account-user"> <%include file="user_dropdown.html" args="online_help_token=online_help_token" /> </li> diff --git a/lms/envs/common.py b/lms/envs/common.py index 01f5e55c118..d9c5b58ebca 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -263,6 +263,17 @@ FEATURES = { # .. toggle_tickets: https://github.com/edx/edx-platform/pull/1073 'COURSES_ARE_BROWSABLE': True, + # Can be turned off to disable the help link in the navbar + # .. toggle_name: FEATURES['ENABLE_HELP_LINK'] + # .. toggle_implementation: DjangoSetting + # .. toggle_default: True + # .. toggle_description: When True, a help link is displayed on the main navbar. Set False to hide it. + # .. toggle_use_cases: open_edx + # .. toggle_creation_date: 2021-03-05 + # .. toggle_tickets: https://github.com/edx/edx-platform/pull/26106 + 'ENABLE_HELP_LINK': True, + + # .. toggle_name: FEATURES['HIDE_DASHBOARD_COURSES_UNTIL_ACTIVATED'] # .. toggle_implementation: DjangoSetting # .. toggle_default: False diff --git a/lms/templates/header/navbar-authenticated.html b/lms/templates/header/navbar-authenticated.html index 24c7cfc219a..4c522824412 100644 --- a/lms/templates/header/navbar-authenticated.html +++ b/lms/templates/header/navbar-authenticated.html @@ -14,6 +14,7 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_ show_explore_courses = settings.FEATURES.get('COURSES_ARE_BROWSABLE') show_sysadmin_dashboard = settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD','') and user.is_staff self.real_user = getattr(user, 'real_user', user) + enable_help_link = settings.FEATURES.get('ENABLE_HELP_LINK') support_link = configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK) doc_link = get_online_help_info(online_help_token)['doc_url'] @@ -60,9 +61,11 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_ % endif </div> <div class="secondary"> - <div class="mobile-nav-item hidden-mobile nav-item"> - <a class="help-link" href="${help_link}" rel="noopener" target="_blank">${_("Help")}</a> - </div> + % if enable_help_link: + <div class="mobile-nav-item hidden-mobile nav-item"> + <a class="help-link" href="${help_link}" rel="noopener" target="_blank">${_("Help")}</a> + </div> + % endif <%include file="user_dropdown.html"/> </div> </div> diff --git a/lms/templates/navigation/bootstrap/navbar-authenticated.html b/lms/templates/navigation/bootstrap/navbar-authenticated.html index 529f7984e25..d895f4d9a89 100644 --- a/lms/templates/navigation/bootstrap/navbar-authenticated.html +++ b/lms/templates/navigation/bootstrap/navbar-authenticated.html @@ -57,12 +57,14 @@ from django.utils.translation import ugettext as _ </ul> <ul class="navbar-nav navbar-right"> - <li class="nav-item mt-2 nav-item-open-collapsed"> - <a href="${get_online_help_info(online_help_token)['doc_url']}" - rel="noopener" - target="_blank" - class="nav-link">${_("Help")}</a> - </li> + % if settings.FEATURES.get('ENABLE_HELP_LINK'): + <li class="nav-item mt-2 nav-item-open-collapsed"> + <a href="${get_online_help_info(online_help_token)['doc_url']}" + rel="noopener" + target="_blank" + class="nav-link">${_("Help")}</a> + </li> + % endif <%include file="../../user_dropdown.html"/> </ul> diff --git a/lms/templates/navigation/navbar-authenticated.html b/lms/templates/navigation/navbar-authenticated.html index b27f17bd428..1873805ec9d 100644 --- a/lms/templates/navigation/navbar-authenticated.html +++ b/lms/templates/navigation/navbar-authenticated.html @@ -41,7 +41,9 @@ from django.utils.translation import ugettext as _ <%include file="../user_dropdown.html"/> -<a href="${get_online_help_info(online_help_token)['doc_url']}" - rel="noopener" - target="_blank" - class="doc-link">${_("Help")}</a> +% if settings.FEATURES.get('ENABLE_HELP_LINK'): + <a href="${get_online_help_info(online_help_token)['doc_url']}" + rel="noopener" + target="_blank" + class="doc-link">${_("Help")}</a> +% endif diff --git a/themes/edx.org/lms/templates/header/navbar-authenticated.html b/themes/edx.org/lms/templates/header/navbar-authenticated.html index 5d595aadb75..1e54026ca94 100644 --- a/themes/edx.org/lms/templates/header/navbar-authenticated.html +++ b/themes/edx.org/lms/templates/header/navbar-authenticated.html @@ -14,6 +14,7 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_ show_explore_courses = settings.FEATURES.get('COURSES_ARE_BROWSABLE') show_sysadmin_dashboard = settings.FEATURES.get('ENABLE_SYSADMIN_DASHBOARD','') and user.is_staff self.real_user = getattr(user, 'real_user', user) + enable_help_link = settings.FEATURES.get('ENABLE_HELP_LINK') %> <div class="nav-links"> @@ -58,13 +59,15 @@ from openedx.core.djangoapps.site_configuration import helpers as configuration_ </div> <div class="secondary"> - <div class="mobile-nav-item hidden-mobile nav-item"> - % if online_help_token == "instructor": - <a class="help-link" href="${get_online_help_info(online_help_token)['doc_url']}" rel="noopener" target="_blank">${_("Help")}</a> - % else: - <a class="help-link" href="${configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK)}" rel="noopener" target="_blank">${_("Help")}</a> - % endif - </div> + % if enable_help_link: + <div class="mobile-nav-item hidden-mobile nav-item"> + % if online_help_token == "instructor": + <a class="help-link" href="${get_online_help_info(online_help_token)['doc_url']}" rel="noopener" target="_blank">${_("Help")}</a> + % else: + <a class="help-link" href="${configuration_helpers.get_value('SUPPORT_SITE_LINK', settings.SUPPORT_SITE_LINK)}" rel="noopener" target="_blank">${_("Help")}</a> + % endif + </div> + % endif <%include file="user_dropdown.html"/> </div> </div> -- GitLab