Commit 3f6e3905 by David Baumgold

Merge pull request #9955 from edx/partially-revert-comprehensive-theming

Remove the edx.org comprehensive theme
parents e6068ec4 7cd9db12
......@@ -12,7 +12,11 @@
<div class="wrapper wrapper-l">
<h1 class="branding"><a href="/">
<img src="${static.url("images/header-logo.png")}" alt="${settings.STUDIO_NAME}" />
% if settings.FEATURES.get('IS_EDX_DOMAIN', False):
<img src="${static.url("images/edx-theme/edx-studio-logo.png")}" alt="${settings.STUDIO_NAME}" />
% else:
<img src="${static.url("images/default-theme/logo.png")}" alt="${settings.STUDIO_NAME}" />
% endif
</a></h1>
% if context_course:
......
......@@ -175,7 +175,7 @@ class LearnerProfilePage(FieldsMixin, PageObject):
"""
self.wait_for_field('image')
default_links = self.q(css='.image-frame').attrs('src')
return 'profiles/default' in default_links[0] if default_links else False
return 'default-profile' in default_links[0] if default_links else False
def mouse_hover(self, element):
"""
......
......@@ -70,4 +70,4 @@ def get_logo_url():
elif university:
return staticfiles_storage.url('images/{uni}-on-edx-logo.png'.format(uni=university))
else:
return staticfiles_storage.url('images/logo.png')
return staticfiles_storage.url('images/default-theme/logo.png')
"""Tests of comprehensive theming."""
import unittest
from django.conf import settings
from django.test import TestCase
......@@ -20,6 +21,7 @@ class TestComprehensiveTheming(TestCase):
staticfiles.finders._finders.clear() # pylint: disable=protected-access
@with_comp_theme(settings.REPO_ROOT / 'themes/red-theme')
@unittest.skip("Disabled until we can release theming to production")
def test_red_footer(self):
resp = self.client.get('/')
self.assertEqual(resp.status_code, 200)
......@@ -63,6 +65,7 @@ class TestComprehensiveTheming(TestCase):
do_the_test(self)
@unittest.skip("Disabled until we can release theming to production")
def test_default_logo_image(self):
result = staticfiles.finders.find('images/logo.png')
self.assertEqual(result, settings.REPO_ROOT / 'lms/static/images/logo.png')
......
......@@ -682,7 +682,10 @@ PROFILE_IMAGE_BACKEND = ENV_TOKENS.get('PROFILE_IMAGE_BACKEND', PROFILE_IMAGE_BA
PROFILE_IMAGE_SECRET_KEY = AUTH_TOKENS.get('PROFILE_IMAGE_SECRET_KEY', PROFILE_IMAGE_SECRET_KEY)
PROFILE_IMAGE_MAX_BYTES = ENV_TOKENS.get('PROFILE_IMAGE_MAX_BYTES', PROFILE_IMAGE_MAX_BYTES)
PROFILE_IMAGE_MIN_BYTES = ENV_TOKENS.get('PROFILE_IMAGE_MIN_BYTES', PROFILE_IMAGE_MIN_BYTES)
PROFILE_IMAGE_DEFAULT_FILENAME = 'images/profiles/default'
if FEATURES['IS_EDX_DOMAIN']:
PROFILE_IMAGE_DEFAULT_FILENAME = 'images/edx-theme/default-profile'
else:
PROFILE_IMAGE_DEFAULT_FILENAME = ENV_TOKENS.get('PROFILE_IMAGE_DEFAULT_FILENAME', PROFILE_IMAGE_DEFAULT_FILENAME)
# EdxNotes config
......
......@@ -2602,7 +2602,7 @@ PROFILE_IMAGE_BACKEND = {
'base_url': os.path.join(MEDIA_URL, 'profile-images/'),
},
}
PROFILE_IMAGE_DEFAULT_FILENAME = 'images/profiles/default'
PROFILE_IMAGE_DEFAULT_FILENAME = 'images/default-theme/default-profile'
PROFILE_IMAGE_DEFAULT_FILE_EXTENSION = 'png'
# This secret key is used in generating unguessable URLs to users'
# profile images. Once it has been set, changing it will make the
......
......@@ -17,7 +17,7 @@ from edxmako.shortcuts import marketing_link
ga=microsite.get_value('google_analytics_file', 'theme-google-analytics.html')
)
else:
google_analytics_file = '../google-analytics.html'
google_analytics_file = '../google_analytics.html'
%>
<%include file="${google_analytics_file}" />
......
......@@ -61,13 +61,7 @@ from branding import api as branding_api
<link rel="icon" type="image/x-icon" href="${static.url(microsite.get_value('favicon_path', settings.FAVICON_PATH))}" />
<%static:css group='style-vendor'/>
## route around the overwhelmingly complicated static:css nonsense
<%
application_css_path = "css/lms-main{rtl}.css".format(
rtl="-rtl" if get_language_bidi() else "",
)
%>
<link rel="stylesheet" href="${static.url(application_css_path)}" type="text/css" media="all" />
<%static:css group='style-main'/>
% if disable_courseware_js:
<%static:js group='base_vendor'/>
......@@ -90,7 +84,30 @@ from branding import api as branding_api
<%block name="headextra"/>
<%static:optional_include_mako file="header-extra.html" with_microsite="True" />
<%
if theme_enabled() and not is_microsite():
header_extra_file = 'theme-head-extra.html'
header_file = 'theme-header.html'
google_analytics_file = 'theme-google-analytics.html'
style_overrides_file = None
else:
header_extra_file = microsite.get_template_path('header_extra.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('navigation.html')
google_analytics_file = microsite.get_template_path('google_analytics.html')
style_overrides_file = microsite.get_value('css_overrides_file')
%>
% if header_extra_file:
<%include file="${header_extra_file}" />
% endif
<%include file="widgets/optimizely.html" />
<%include file="widgets/segment-io.html" />
......@@ -98,7 +115,11 @@ from branding import api as branding_api
<meta name="path_prefix" content="${EDX_ROOT_URL}">
<meta name="google-site-verification" content="_mipQ4AtZQDNmbtOkwehQDOgCxUUV2fb_C0b6wbiRHY" />
<%static:optional_include_mako file="google-analytics.html" with_microsite="True" />
<%include file="${google_analytics_file}" />
% if style_overrides_file:
<link rel="stylesheet" type="text/css" href="${static.url(style_overrides_file)}" />
% endif
</head>
......@@ -110,7 +131,7 @@ from branding import api as branding_api
<a class="nav-skip" href="<%block name="nav_skip">#content</%block>">${_("Skip to main content")}</a>
% if not disable_header:
<%include file="header.html" />
<%include file="${header_file}" />
% endif
<div class="content-wrapper" id="content">
......@@ -119,7 +140,16 @@ from branding import api as branding_api
</div>
% if not disable_footer:
<%include file="themable-footer.html" />
<%block name="footer">
## Can be overridden by child templates wanting to hide the footer.
% if theme_enabled() and not is_microsite():
<%include file="theme-footer.html" />
% elif settings.FEATURES.get('IS_EDX_DOMAIN', False) and not is_microsite():
<%include file="footer-edx-v3.html" />
% else:
<%include file="${microsite.get_template_path('footer.html')}" />
% endif
</%block>
% endif
% if not disable_window_wrap:
......
<%!
from microsite_configuration import microsite
%>
<%
theme_enabled = settings.FEATURES.get("USE_CUSTOM_THEME", False)
is_microsite = microsite.is_request_in_microsite()
%>
% if theme_enabled and not is_microsite:
<%include file="theme-footer.html" />
% else:
<%include file="${microsite.get_template_path('footer.html')}" />
% endif
......@@ -90,28 +90,6 @@ in the appropriate place, and making the changes you need. Keep in mind that
in the future if you upgrade the Open edX code, you may have to update the
copied template in your theme also.
Template Names
==============
Here are the list of template names that you *should* use in your comprehensive
theme (so far):
* ``header.html``
* ``footer.html``
You should **not** use the following names in your comprehensive theme:
* ``themable-footer.html``
If you look at the ``main.html`` template file, you will notice that it includes
``header.html`` and ``themable-footer.html``, rather than ``footer.html``.
You might be inclined to override ``themable-footer.html`` as a result. DO NOT
DO THIS. ``themable-footer.html`` is an additional layer of indirection that
is necessary to avoid breaking microsites, which also refers to a file named
``footer.html``. The goal is to eventually make comprehensive theming do
everything that microsites does now, and then deprecate and remove microsites
from the codebase. At that point, the ``themable-footer.html`` file will go
away, since the additional layer of indirection will no longer be necessary.
Installing your theme
---------------------
......
## mako
<%!
from django.utils.translation import ugettext as _
from branding.api import get_footer
%>
<% footer = get_footer(is_secure=is_secure) %>
<%namespace name='static' file='static_content.html'/>
## WARNING: These files are specific to edx.org and are not used in installations outside of that domain. Open edX users will want to use the file "footer.html" for any changes or overrides.
<footer id="footer-edx-v3" role="contentinfo" aria-label="${_("Page Footer")}"
## When rendering the footer through the branding API,
## the direction may not be set on the parent element,
## so we set it here.
% if bidi:
dir=${bidi}
% endif
>
<h2 class="sr footer-about-title">${_("About edX")}</h2>
<div class="footer-content-wrapper">
<div class="footer-logo">
<img alt="edX logo" src="${static.url("images/logo.png")}">
</div>
<div class="site-details">
<nav class="site-nav" aria-label="${_("About edX")}">
% for link in footer["navigation_links"]:
<a href="${link['url']}">${link['title']}</a>
% endfor
</nav>
<nav class="legal-notices" aria-label="${_("Legal")}">
% for link in footer["legal_links"]:
<a href="${link['url']}">${link['title']}</a>
% endfor
</nav>
<p class="copyright">${footer['copyright']}</p>
## The OpenEdX link may be hidden when this view is served
## through an API to partner sites (such as marketing sites or blogs),
## which are not technically powered by OpenEdX.
% if not hide_openedx_link:
<div class="openedx-link">
<a href="${footer['openedx_link']['url']}" title="${footer['openedx_link']['title']}">
<img alt="${footer['openedx_link']['title']}" src="${footer['openedx_link']['image']}" width="140">
</a>
</div>
% endif
</div>
<div class="external-links">
<div class="social-media-links">
% for link in footer['social_links']:
<a href="${link['url']}" class="sm-link external" title="${link['title']}" rel="noreferrer">
<span class="icon fa ${link['icon-class']}" aria-hidden="true"></span>
</a>
% endfor
</div>
<div class="mobile-app-links">
% for link in footer['mobile_links']:
<a href="${link['url']}" class="app-link external">
<img alt="${link['title']}" src="${link['image']}">
</a>
% endfor
</div>
</div>
</div>
</footer>
% if include_dependencies:
<%static:js group='base_vendor'/>
<%static:css group='style-vendor'/>
<%include file="widgets/segment-io.html" />
% endif
% if footer_css_urls:
% for url in footer_css_urls:
<link rel="stylesheet" type="text/css" href="${url}"></link>
% endfor
% endif
% if footer_js_url:
<script type="text/javascript" src="${footer_js_url}"></script>
% endif
## mako
<%namespace name='static' file='static_content.html'/>
<%namespace file='main.html' import="login_query"/>
<%!
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from microsite_configuration import microsite
from microsite_configuration.templatetags.microsite import platform_name
# App that handles subdomain specific branding
import branding
# app that handles site status messages
from status.status import get_site_status_msg
%>
## Provide a hook for themes to inject branding on top.
<%block name="navigation_top" />
<%block>
<%
try:
course_id = course.id.to_deprecated_string()
except:
# can't figure out a better way to get at a possibly-defined course var
course_id = None
site_status_msg = get_site_status_msg(course_id)
%>
% if site_status_msg:
<div class="site-status">
<div class="inner-wrapper">
<span class="white-error-icon"></span>
<p>${site_status_msg}</p>
</div>
</div>
% endif
</%block>
<header class="${"global slim" if course and not disable_courseware_header else "global-new"}" aria-label="Main" role="banner">
<div class="${'rwd ' if responsive else ''}wrapper-header nav-container">
<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("images/logo.png")}" alt="${platform_name()}" title="${platform_name()}" itemprop="url" />
<span class="sr">${_("Home Page")}</span>
</%block>
</a>
</h1>
% 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():
% if not course or disable_courseware_header:
<nav aria-label="Main" class="nav-main">
<ul class="left nav-global authenticated">
<%block name="navigation_global_links_authenticated">
<li class="nav-global-01">
<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>
</li>
<li class="nav-global-03">
<a href="${marketing_link('SCHOOLS')}">${_("Schools & Partners")}</a>
</li>
</%block>
</ul>
</nav>
% endif
<ul class="user">
<li class="primary">
<a href="${reverse('dashboard')}" class="user-link">
<i class="icon fa fa-home" aria-hidden="true"></i>
<span class="sr">${_("Dashboard for:")}</span>
<div>${user.username}</div>
</a>
</li>
<li class="primary">
<a href="#" class="dropdown" aria-haspopup="true" aria-expanded="false"><span class="sr">${_("More options dropdown")}</span> &#9662;</a>
<ul class="dropdown-menu" aria-label="More Options" role="menu">
<%block name="navigation_dropdown_menu_links" >
<li><a href="${reverse('account_settings')}">${_("Account Settings")}</a></li>
<li><a href="${reverse('learner_profile', kwargs={'username': user.username})}">${_("My Profile")}</a></li>
</%block>
<li><a href="${reverse('logout')}" role="menuitem">${_("Sign Out")}</a></li>
</ul>
</li>
</ul>
% if should_display_shopping_cart_func(): # see shoppingcart.context_processor.user_has_cart_context_processor
<ul class="user">
<li class="primary">
<a class="shopping-cart" href="${reverse('shoppingcart.views.show_cart')}">
<i class="icon fa fa-shopping-cart" aria-hidden="true"></i> ${_("Shopping Cart")}
</a>
</li>
</ul>
% endif
% else:
<nav aria-label="Main" class="nav-main">
<ul class="left nav-global">
<%block name="navigation_global_links">
<li class="nav-global-01">
<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>
</li>
<li class="nav-global-03">
<a href="${marketing_link('SCHOOLS')}">${_("Schools & Partners")}</a>
</li>
</%block>
</ul>
</nav>
<nav aria-label="Account" class="nav-account-management">
<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:
<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
<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()}">${_("Sign in")}</a>
% else:
<a class="cta cta-login nav-courseware-button" href="/login${login_query()}">${_("Sign in")}</a>
% endif
% endif
</div>
</div>
</nav>
% endif
</div>
</header>
% if course:
<!--[if lte IE 9]>
<div class="ie-banner" aria-hidden="true">${_('<strong>Warning:</strong> Your browser is not fully supported. We strongly recommend using {chrome_link} or {ff_link}.').format(chrome_link='<a href="https://www.google.com/chrome" target="_blank">Chrome</a>', ff_link='<a href="http://www.mozilla.org/firefox" target="_blank">Firefox</a>')}</div>
<![endif]-->
% endif
%if not user.is_authenticated():
<%include file="forgot_password_modal.html" />
%endif
<%include file="help_modal.html"/>
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