From 0172ff315ae167c5bd943d5d9a413dd4e56ad9e5 Mon Sep 17 00:00:00 2001 From: Anthony Mangano Date: Tue, 16 May 2017 15:06:33 -0400 Subject: [PATCH] add ability to show footer language selector on LMS --- cms/envs/bok_choy.env.json | 2 +- cms/envs/common.py | 4 +- cms/templates/widgets/header.html | 5 ++- .../templates/static_content.html | 9 ---- lms/envs/bok_choy.env.json | 2 +- lms/envs/common.py | 7 +++- lms/envs/devstack_docker.py | 2 +- lms/templates/footer.html | 5 ++- lms/templates/navigation.html | 5 ++- .../widgets/footer-language-selector.html | 7 +++- openedx/core/djangoapps/lang_pref/api.py | 17 ++++++++ .../djangoapps/lang_pref/tests/test_api.py | 42 ++++++++++++++++++- themes/edx.org/lms/templates/footer.html | 5 ++- themes/red-theme/lms/templates/footer.html | 5 ++- .../stanford-style/lms/templates/footer.html | 10 ++--- 15 files changed, 93 insertions(+), 34 deletions(-) diff --git a/cms/envs/bok_choy.env.json b/cms/envs/bok_choy.env.json index b858d70077..eb613edafc 100644 --- a/cms/envs/bok_choy.env.json +++ b/cms/envs/bok_choy.env.json @@ -75,7 +75,7 @@ "PREVIEW_LMS_BASE": "preview.localhost:8003", "ENABLE_CONTENT_LIBRARIES": true, "ENABLE_SPECIAL_EXAMS": true, - "SHOW_LANGUAGE_SELECTOR": true, + "SHOW_HEADER_LANGUAGE_SELECTOR": true, "ENABLE_EXTENDED_COURSE_DETAILS": true, "CUSTOM_COURSES_EDX": true }, diff --git a/cms/envs/common.py b/cms/envs/common.py index e8579c8f3a..cef002da59 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -227,8 +227,8 @@ FEATURES = { 'ORGANIZATIONS_APP': False, - # Show Language selector - 'SHOW_LANGUAGE_SELECTOR': False, + # Show the language selector in the header + 'SHOW_HEADER_LANGUAGE_SELECTOR': False, # Set this to False to facilitate cleaning up invalid xml from your modulestore. 'ENABLE_XBLOCK_XML_VALIDATION': True, diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html index 595e217934..7e4439f617 100644 --- a/cms/templates/widgets/header.html +++ b/cms/templates/widgets/header.html @@ -4,6 +4,7 @@ from django.conf import settings from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ + from openedx.core.djangoapps.lang_pref.api import header_language_selector_is_enabled, released_languages %>
- % if static.show_language_selector(): - <% languages = static.get_released_languages() %> + % if header_language_selector_is_enabled(): + <% languages = released_languages() %> % if len(languages) > 1: - % if include_language_selector: - <%include file="widgets/footer-language-selector.html"/> + % if context.get('include_language_selector', footer_language_selector_is_enabled()): + <%include file="${static.get_template_path('widgets/footer-language-selector.html')}"/> % endif