Commit c15d97ea by stephensanchez

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.
parent af3d2713
......@@ -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.
......
......@@ -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, _):
......
......@@ -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',
......
......@@ -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')
......
......@@ -32,10 +32,10 @@
<body class="{% block bodyclass %}{% endblock %} lang_{{LANGUAGE_CODE}}">
<a class="nav-skip" href="{% block nav_skip %}#content{% endblock %}">{% trans "Skip to this view's content" %}</a>
{% 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 %}
<div class="content-wrapper" id="content">
......@@ -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 %}
......
......@@ -36,30 +36,31 @@ site_status_msg = get_site_status_msg(course_id)
% endif
</%block>
<header class="global ${"slim" if course else ""}" aria-label="${_('Global Navigation')}">
<nav>
<h1 class="logo">
<a href="${marketing_link('ROOT')}">
<header class="${"global slim" if course and not disable_courseware_header else "global-new"}" aria-label="Main" role="banner">
<nav aria-label="Main">
<h1 class="logo" itemscope="" itemtype="http://schema.org/Organization">
<a href="${marketing_link('ROOT')}" title="Home page" itemprop="url">
<%block name="navigation_logo">
<img src="${static.url(branding.get_logo_url())}" alt="${platform_name()}"/>
<img src="${static.url(branding.get_logo_url())}" alt="${platform_name()}" title="${platform_name()}" itemprop="url" />
</%block>
</a>
</h1>
% if course:
% if course and not disable_courseware_header:
<h2><span class="provider">${course.display_org_with_default | h}:</span> ${course.display_number_with_default | h} ${course.display_name_with_default}</h2>
% endif
% if user.is_authenticated():
<ol class="left nav-global authenticated">
<div class="left nav-global authenticated">
<%block name="navigation_global_links_authenticated">
% if settings.FEATURES.get('COURSES_ARE_BROWSABLE'):
<li class="nav-global-01">
<div class="nav-global-01">
<a href="${marketing_link('COURSES')}">${_('Find Courses')}</a>
</li>
</div>
% endif
</%block>
</ol>
</div>
<ol class="user">
<li class="primary">
<a href="${reverse('dashboard')}" class="user-link">
......@@ -79,6 +80,7 @@ site_status_msg = get_site_status_msg(course_id)
</ul>
</li>
</ol>
% if display_shopping_cart: # see shoppingcart.context_processor.user_has_cart_context_processor
<ol class="user">
<li class="primary">
......@@ -96,37 +98,37 @@ site_status_msg = get_site_status_msg(course_id)
<a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a>
</li>
<li class="nav-global-02">
<a href="${marketing_link('COURSES')}">${_("Courses")}</a>
<a href="${marketing_link('COURSES')}">${_("Find Courses")}</a>
</li>
<li class="nav-global-03">
<a href="${marketing_link('SCHOOLS')}">${_("Schools")}</a>
<a href="${marketing_link('SCHOOLS')}">${_("Schools & Partners")}</a>
</li>
% endif
</%block>
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<li class="nav-global-04">
<a class="cta cta-register" href="${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}">${_("Register Now")}</a>
</li>
% else:
<li class="nav-global-04">
<a class="cta cta-register" href="/register">${_("Register Now")}</a>
</li>
% endif
% endif
</ol>
<ol class="right nav-courseware">
<li class="nav-courseware-01">
<div class="right nav-courseware">
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<a class="cta cta-login" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Log in")}</a>
% else:
<a class="cta cta-login" href="/login${login_query()}">${_("Log in")}</a>
% endif
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<div class="nav-courseware-01">
<a class="cta cta-register" href="${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}">${_("Register")}</a>
</div>
% else:
<div class="nav-courseware-01">
<a class="cta cta-register" href="/register">${_("Register")}</a>
</div>
% endif
% endif
</li>
</ol>
<div class="nav-courseware-02">
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<a class="cta cta-login nav-courseware-button" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Log in")}</a>
% else:
<a class="cta cta-login nav-courseware-button" href="/login${login_query()}">${_("Log in")}</a>
% endif
% endif
</div>
</div>
% endif
</nav>
</header>
......@@ -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"/>
......@@ -36,31 +36,30 @@ site_status_msg = get_site_status_msg(course_id)
% endif
</%block>
<header class="${"global slim" if course and not disable_courseware_header else "global-new"}" aria-label="Main" role="banner">
<nav aria-label="Main">
<h1 class="logo" itemscope="" itemtype="http://schema.org/Organization">
<a href="${marketing_link('ROOT')}" title="Home page" itemprop="url">
<header class="global ${"slim" if course else ""}" aria-label="${_('Global Navigation')}">
<nav>
<h1 class="logo">
<a href="${marketing_link('ROOT')}">
<%block name="navigation_logo">
<img src="${static.url(branding.get_logo_url())}" alt="${platform_name()}" title="${platform_name()}" itemprop="url" />
<img src="${static.url(branding.get_logo_url())}" alt="${platform_name()}"/>
</%block>
</a>
</h1>
% if course and not disable_courseware_header:
% if course:
<h2><span class="provider">${course.display_org_with_default | h}:</span> ${course.display_number_with_default | h} ${course.display_name_with_default}</h2>
% endif
% if user.is_authenticated():
<div class="left nav-global authenticated">
<ol class="left nav-global authenticated">
<%block name="navigation_global_links_authenticated">
% if settings.FEATURES.get('COURSES_ARE_BROWSABLE'):
<div class="nav-global-01">
<li class="nav-global-01">
<a href="${marketing_link('COURSES')}">${_('Find Courses')}</a>
</div>
</li>
% endif
</%block>
</div>
</ol>
<ol class="user">
<li class="primary">
<a href="${reverse('dashboard')}" class="user-link">
......@@ -80,7 +79,6 @@ site_status_msg = get_site_status_msg(course_id)
</ul>
</li>
</ol>
% if display_shopping_cart: # see shoppingcart.context_processor.user_has_cart_context_processor
<ol class="user">
<li class="primary">
......@@ -98,37 +96,37 @@ site_status_msg = get_site_status_msg(course_id)
<a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a>
</li>
<li class="nav-global-02">
<a href="${marketing_link('COURSES')}">${_("Find Courses")}</a>
<a href="${marketing_link('COURSES')}">${_("Courses")}</a>
</li>
<li class="nav-global-03">
<a href="${marketing_link('SCHOOLS')}">${_("Schools & Partners")}</a>
<a href="${marketing_link('SCHOOLS')}">${_("Schools")}</a>
</li>
% endif
</%block>
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<li class="nav-global-04">
<a class="cta cta-register" href="${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}">${_("Register Now")}</a>
</li>
% else:
<li class="nav-global-04">
<a class="cta cta-register" href="/register">${_("Register Now")}</a>
</li>
% endif
% endif
</ol>
<div class="right nav-courseware">
<ol class="right nav-courseware">
<li class="nav-courseware-01">
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<div class="nav-courseware-01">
<a class="cta cta-register" href="${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}">${_("Register")}</a>
</div>
% else:
<div class="nav-courseware-01">
<a class="cta cta-register" href="/register">${_("Register")}</a>
</div>
% endif
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<a class="cta cta-login" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Log in")}</a>
% else:
<a class="cta cta-login" href="/login${login_query()}">${_("Log in")}</a>
% endif
% endif
<div class="nav-courseware-02">
% if not settings.FEATURES['DISABLE_LOGIN_BUTTON']:
% if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:
<a class="cta cta-login nav-courseware-button" href="${reverse('course-specific-login', args=[course.id.to_deprecated_string()])}${login_query()}">${_("Log in")}</a>
% else:
<a class="cta cta-login nav-courseware-button" href="/login${login_query()}">${_("Log in")}</a>
% endif
% endif
</div>
</div>
</li>
</ol>
% endif
</nav>
</header>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment