From c15d97ea9bb4c23618f5e209318f54b97dd4f4fe Mon Sep 17 00:00:00 2001 From: stephensanchez Date: Thu, 9 Oct 2014 16:54:58 +0000 Subject: [PATCH] Removing the feature flags for new header and footer. Fix acceptance tests Updating lettuce tests. Revert the deletion of the original edx header and footer. Renaming old header and footers to legacy files. Add IS_EDX_DOMAIN flag for header. Updating tests and django main template. renaming the header files for microsite backwards compat. --- common/djangoapps/edxmako/shortcuts.py | 16 ----- common/djangoapps/edxmako/tests.py | 12 ---- lms/envs/common.py | 12 ---- .../{footer-edx.html => footer-legacy.html} | 0 lms/templates/main.html | 13 ++-- lms/templates/main_django.html | 12 ++-- ...al_navigation.html => navigation-edx.html} | 68 ++++++++++--------- lms/templates/navigation.html | 66 +++++++++--------- 8 files changed, 76 insertions(+), 123 deletions(-) rename lms/templates/{footer-edx.html => footer-legacy.html} (100%) rename lms/templates/{original_navigation.html => navigation-edx.html} (68%) diff --git a/common/djangoapps/edxmako/shortcuts.py b/common/djangoapps/edxmako/shortcuts.py index ff86cf8bcf..c17337c9c3 100644 --- a/common/djangoapps/edxmako/shortcuts.py +++ b/common/djangoapps/edxmako/shortcuts.py @@ -76,22 +76,6 @@ def marketing_link_context_processor(request): ] ) - -def header_footer_context_processor(request): - """ - A django context processor to pass feature flags through to all Django - Templates that are related to the display of the header and footer in - the edX platform. - """ - # TODO: ECOM-136 Remove this processor with the corresponding header and footer feature flags. - return dict( - [ - ("ENABLE_NEW_EDX_HEADER", settings.FEATURES.get("ENABLE_NEW_EDX_HEADER", False)), - ("ENABLE_NEW_EDX_FOOTER", settings.FEATURES.get("ENABLE_NEW_EDX_FOOTER", False)) - ] - ) - - def open_source_footer_context_processor(request): """ Checks the site name to determine whether to use the edX.org footer or the Open Source Footer. diff --git a/common/djangoapps/edxmako/tests.py b/common/djangoapps/edxmako/tests.py index 75b8c09715..40da9b63b8 100644 --- a/common/djangoapps/edxmako/tests.py +++ b/common/djangoapps/edxmako/tests.py @@ -14,7 +14,6 @@ from edxmako import add_lookup, LOOKUP from edxmako.shortcuts import ( marketing_link, render_to_string, - header_footer_context_processor, open_source_footer_context_processor ) from student.tests.factories import UserFactory @@ -40,17 +39,6 @@ class ShortcutsTests(UrlResetMixin, TestCase): link = marketing_link('ABOUT') self.assertEquals(link, expected_link) - @ddt.data((True, True), (False, False), (False, True), (True, False)) - @ddt.unpack - def test_header_and_footer(self, header_setting, footer_setting): - with patch.dict('django.conf.settings.FEATURES', { - 'ENABLE_NEW_EDX_HEADER': header_setting, - 'ENABLE_NEW_EDX_FOOTER': footer_setting, - }): - result = header_footer_context_processor({}) - self.assertEquals(footer_setting, result.get('ENABLE_NEW_EDX_FOOTER')) - self.assertEquals(header_setting, result.get('ENABLE_NEW_EDX_HEADER')) - @ddt.data((True, None), (False, None)) @ddt.unpack def test_edx_footer(self, expected_result, _): diff --git a/lms/envs/common.py b/lms/envs/common.py index c5dea04781..495150885a 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -273,15 +273,6 @@ FEATURES = { # Default to false here b/c dev environments won't have the api, will override in aws.py 'ENABLE_ANALYTICS_ACTIVE_COUNT': False, - # TODO: ECOM-136 remove this feature flag when new styles are available on main site.for - # Enable the new edX footer to be rendered. Defaults to false. - 'ENABLE_NEW_EDX_FOOTER': False, - - # TODO: ECOM-136 - # Enables the new navigation template and styles. This should be enabled - # when the styles appropriately match the edX.org website. - 'ENABLE_NEW_EDX_HEADER': False, - # When a logged in user goes to the homepage ('/') should the user be # redirected to the dashboard - this is default Open edX behavior. Set to # False to not redirect the user @@ -410,9 +401,6 @@ TEMPLATE_CONTEXT_PROCESSORS = ( # Allows the open edX footer to be leveraged in Django Templates. 'edxmako.shortcuts.open_source_footer_context_processor', - # TODO: Used for header and footer feature flags. Remove as part of ECOM-136 - 'edxmako.shortcuts.header_footer_context_processor', - # Shoppingcart processor (detects if request.user has a cart) 'shoppingcart.context_processor.user_has_cart_context_processor', diff --git a/lms/templates/footer-edx.html b/lms/templates/footer-legacy.html similarity index 100% rename from lms/templates/footer-edx.html rename to lms/templates/footer-legacy.html diff --git a/lms/templates/main.html b/lms/templates/main.html index c3895de287..68573776ff 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -79,19 +79,16 @@ else: header_extra_file = None - if settings.FEATURES.get("ENABLE_NEW_EDX_HEADER", False): - header_file = microsite.get_template_path('navigation.html') + if settings.FEATURES['IS_EDX_DOMAIN'] and not is_microsite(): + header_file = microsite.get_template_path('navigation-edx.html') else: - header_file = microsite.get_template_path('original_navigation.html') - + header_file = microsite.get_template_path('navigation.html') google_analytics_file = microsite.get_template_path('google_analytics.html') if settings.FEATURES['IS_EDX_DOMAIN'] and not is_microsite(): - if settings.FEATURES.get('ENABLE_NEW_EDX_FOOTER', False): - footer_file = microsite.get_template_path('footer-edx-new.html') - else: - footer_file = microsite.get_template_path('footer-edx.html') + footer_file = microsite.get_template_path('footer-edx-new.html') + else: footer_file = microsite.get_template_path('footer.html') diff --git a/lms/templates/main_django.html b/lms/templates/main_django.html index dd19587be9..7532f6e25a 100644 --- a/lms/templates/main_django.html +++ b/lms/templates/main_django.html @@ -32,10 +32,10 @@ {% trans "Skip to this view's content" %} {% with course=request.course %} - {% if ENABLE_NEW_EDX_HEADER %} - {% include "navigation.html" %} + {% if IS_EDX_DOMAIN %} + {% include "navigation-edx.html" %} {% else %} - {% include "original_navigation.html" %} + {% include "navigation.html" %} {% endif %} {% endwith %}
@@ -45,11 +45,7 @@ {% if IS_REQUEST_IN_MICROSITE %} {# For now we don't support overriden Django templates in microsites. Leave footer blank for now which is better than saying Edx.#} {% elif IS_EDX_DOMAIN %} - {% if ENABLE_NEW_EDX_FOOTER %} - {% include "footer-edx-new.html" %} - {% else %} - {% include "footer-edx.html" %} - {% endif %} + {% include "footer-edx-new.html" %} {% else %} {% include "footer.html" %} {% endif %} diff --git a/lms/templates/original_navigation.html b/lms/templates/navigation-edx.html similarity index 68% rename from lms/templates/original_navigation.html rename to lms/templates/navigation-edx.html index aebf7624ab..d5807a93a8 100644 --- a/lms/templates/original_navigation.html +++ b/lms/templates/navigation-edx.html @@ -36,30 +36,31 @@ site_status_msg = get_site_status_msg(course_id) % endif -
-
+
  1. @@ -79,6 +80,7 @@ site_status_msg = get_site_status_msg(course_id)
+ % if display_shopping_cart: # see shoppingcart.context_processor.user_has_cart_context_processor
  1. @@ -96,37 +98,37 @@ site_status_msg = get_site_status_msg(course_id) ${_("How it Works")}
  2. % endif - % if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: - % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain: - - % else: - - % endif - % endif
- + + % endif @@ -140,4 +142,4 @@ site_status_msg = get_site_status_msg(course_id) <%include file="forgot_password_modal.html" /> %endif -<%include file="help_modal.html"/> \ No newline at end of file +<%include file="help_modal.html"/> diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html index d5807a93a8..4852757aea 100644 --- a/lms/templates/navigation.html +++ b/lms/templates/navigation.html @@ -36,31 +36,30 @@ site_status_msg = get_site_status_msg(course_id) % endif -