diff --git a/cms/envs/aws.py b/cms/envs/aws.py
index 3d7093431d..bdb670eb66 100644
--- a/cms/envs/aws.py
+++ b/cms/envs/aws.py
@@ -177,6 +177,7 @@ ASSET_IGNORE_REGEX = ENV_TOKENS.get('ASSET_IGNORE_REGEX', ASSET_IGNORE_REGEX)
# Theme overrides
THEME_NAME = ENV_TOKENS.get('THEME_NAME', None)
+COMPREHENSIVE_THEME_DIR = path(ENV_TOKENS.get('COMPREHENSIVE_THEME_DIR', COMPREHENSIVE_THEME_DIR))
#Timezone overrides
TIME_ZONE = ENV_TOKENS.get('TIME_ZONE', TIME_ZONE)
diff --git a/cms/envs/common.py b/cms/envs/common.py
index 6cfcede38d..71493e06ec 100644
--- a/cms/envs/common.py
+++ b/cms/envs/common.py
@@ -31,7 +31,8 @@ import lms.envs.common
# Although this module itself may not use these imported variables, other dependent modules may.
from lms.envs.common import (
USE_TZ, TECH_SUPPORT_EMAIL, PLATFORM_NAME, BUGS_EMAIL, DOC_STORE_CONFIG, DATA_DIR, ALL_LANGUAGES, WIKI_ENABLED,
- update_module_store_settings, ASSET_IGNORE_REGEX, COPYRIGHT_YEAR, PARENTAL_CONSENT_AGE_LIMIT, COMP_THEME_DIR,
+ update_module_store_settings, ASSET_IGNORE_REGEX, COPYRIGHT_YEAR,
+ PARENTAL_CONSENT_AGE_LIMIT, COMPREHENSIVE_THEME_DIR,
# The following PROFILE_IMAGE_* settings are included as they are
# indirectly accessed through the email opt-in API, which is
# technically accessible through the CMS via legacy URLs.
@@ -467,12 +468,12 @@ EMBARGO_SITE_REDIRECT_URL = None
PIPELINE_ENABLED = True
-# Process static files using RequireJS Optimizer
-STATICFILES_STORAGE = 'openedx.core.lib.django_require.staticstorage.OptimizedCachedRequireJsStorage'
+STATICFILES_STORAGE = 'openedx.core.storage.ProductionStorage'
# List of finder classes that know how to find static files in various locations.
# Note: the pipeline finder is included to be able to discover optimized files
STATICFILES_FINDERS = [
+ 'openedx.core.djangoapps.theming.finders.ComprehensiveThemeFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
diff --git a/cms/envs/devstack.py b/cms/envs/devstack.py
index 127eb8a3a1..c19db5e9b0 100644
--- a/cms/envs/devstack.py
+++ b/cms/envs/devstack.py
@@ -37,10 +37,11 @@ FEATURES['PREVIEW_LMS_BASE'] = "preview." + LMS_BASE
# Skip packaging and optimization in development
PIPELINE_ENABLED = False
-STATICFILES_STORAGE = 'pipeline.storage.NonPackagingPipelineStorage'
+STATICFILES_STORAGE = 'openedx.core.storage.DevelopmentStorage'
# Revert to the default set of finders as we don't want the production pipeline
STATICFILES_FINDERS = [
+ 'openedx.core.djangoapps.theming.finders.ComprehensiveThemeFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
diff --git a/cms/static/images/default-theme/logo.png b/cms/static/images/studio-logo.png
similarity index 100%
rename from cms/static/images/default-theme/logo.png
rename to cms/static/images/studio-logo.png
diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html
index 4014139a70..37270f3af5 100644
--- a/cms/templates/widgets/header.html
+++ b/cms/templates/widgets/header.html
@@ -12,11 +12,7 @@
% if context_course:
diff --git a/common/test/acceptance/pages/lms/learner_profile.py b/common/test/acceptance/pages/lms/learner_profile.py
index f71562de3a..dec050f022 100644
--- a/common/test/acceptance/pages/lms/learner_profile.py
+++ b/common/test/acceptance/pages/lms/learner_profile.py
@@ -175,7 +175,7 @@ class LearnerProfilePage(FieldsMixin, PageObject):
"""
self.wait_for_field('image')
default_links = self.q(css='.image-frame').attrs('src')
- return 'default-profile' in default_links[0] if default_links else False
+ return 'profiles/default' in default_links[0] if default_links else False
def mouse_hover(self, element):
"""
diff --git a/common/test/test_microsites/test_microsite/templates/head-extra.html b/common/test/test_microsites/test_microsite/templates/head-extra.html
new file mode 100644
index 0000000000..82d60e754c
--- /dev/null
+++ b/common/test/test_microsites/test_microsite/templates/head-extra.html
@@ -0,0 +1,7 @@
+<%namespace name='static' file='../../static_content.html'/>
+<%! from microsite_configuration import microsite %>
+<% style_overrides_file = microsite.get_value('css_overrides_file') %>
+
+% if style_overrides_file:
+
+% endif
diff --git a/lms/djangoapps/branding/__init__.py b/lms/djangoapps/branding/__init__.py
index 96287a29f9..a7f8c512c1 100644
--- a/lms/djangoapps/branding/__init__.py
+++ b/lms/djangoapps/branding/__init__.py
@@ -81,4 +81,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/default-theme/logo.png')
+ return staticfiles_storage.url('images/logo.png')
diff --git a/lms/djangoapps/branding/views.py b/lms/djangoapps/branding/views.py
index e94ffded33..85d7f9a85d 100644
--- a/lms/djangoapps/branding/views.py
+++ b/lms/djangoapps/branding/views.py
@@ -232,7 +232,7 @@ def footer(request):
"title": "Powered by Open edX",
"image": "http://example.com/openedx.png"
},
- "logo_image": "http://example.com/static/images/default-theme/logo.png",
+ "logo_image": "http://example.com/static/images/logo.png",
"copyright": "EdX, Open edX, and the edX and Open edX logos are \
registered trademarks or trademarks of edX Inc."
}
diff --git a/lms/djangoapps/courseware/tests/test_comp_theming.py b/lms/djangoapps/courseware/tests/test_comprehensive_theming.py
similarity index 85%
rename from lms/djangoapps/courseware/tests/test_comp_theming.py
rename to lms/djangoapps/courseware/tests/test_comprehensive_theming.py
index 65803687b4..ec734fec1d 100644
--- a/lms/djangoapps/courseware/tests/test_comp_theming.py
+++ b/lms/djangoapps/courseware/tests/test_comprehensive_theming.py
@@ -1,13 +1,12 @@
"""Tests of comprehensive theming."""
-import unittest
from django.conf import settings
from django.test import TestCase
from path import path # pylint: disable=no-name-in-module
from django.contrib import staticfiles
-from openedx.core.djangoapps.theming.test_util import with_comp_theme
+from openedx.core.djangoapps.theming.test_util import with_comprehensive_theme
from openedx.core.lib.tempdir import mkdtemp_clean
@@ -20,8 +19,7 @@ class TestComprehensiveTheming(TestCase):
# Clear the internal staticfiles caches, to get test isolation.
staticfiles.finders.get_finder.cache_clear()
- @with_comp_theme(settings.REPO_ROOT / 'themes/red-theme')
- @unittest.skip("Disabled until we can release theming to production")
+ @with_comprehensive_theme(settings.REPO_ROOT / 'themes/red-theme')
def test_red_footer(self):
resp = self.client.get('/')
self.assertEqual(resp.status_code, 200)
@@ -42,7 +40,7 @@ class TestComprehensiveTheming(TestCase):
with open(template_dir / "footer.html", "w") as footer:
footer.write("")
- @with_comp_theme(tmp_theme)
+ @with_comprehensive_theme(tmp_theme)
def do_the_test(self):
"""A function to do the work so we can use the decorator."""
resp = self.client.get('/')
@@ -56,7 +54,7 @@ class TestComprehensiveTheming(TestCase):
before_finders = list(settings.STATICFILES_FINDERS)
before_dirs = list(settings.STATICFILES_DIRS)
- @with_comp_theme(settings.REPO_ROOT / 'themes/red-theme')
+ @with_comprehensive_theme(settings.REPO_ROOT / 'themes/red-theme')
def do_the_test(self):
"""A function to do the work so we can use the decorator."""
self.assertEqual(list(settings.STATICFILES_FINDERS), before_finders)
@@ -65,12 +63,11 @@ 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')
- @with_comp_theme(settings.REPO_ROOT / 'themes/red-theme')
+ @with_comprehensive_theme(settings.REPO_ROOT / 'themes/red-theme')
def test_overridden_logo_image(self):
result = staticfiles.finders.find('images/logo.png')
self.assertEqual(result, settings.REPO_ROOT / 'themes/red-theme/lms/static/images/logo.png')
diff --git a/lms/envs/aws.py b/lms/envs/aws.py
index 45a614f255..5fcaa2f4f1 100644
--- a/lms/envs/aws.py
+++ b/lms/envs/aws.py
@@ -237,7 +237,7 @@ BULK_EMAIL_ROUTING_KEY_SMALL_JOBS = LOW_PRIORITY_QUEUE
# Theme overrides
THEME_NAME = ENV_TOKENS.get('THEME_NAME', None)
-COMP_THEME_DIR = path(ENV_TOKENS.get('COMP_THEME_DIR', COMP_THEME_DIR))
+COMPREHENSIVE_THEME_DIR = path(ENV_TOKENS.get('COMPREHENSIVE_THEME_DIR', COMPREHENSIVE_THEME_DIR))
# Marketing link overrides
MKTG_URL_LINK_MAP.update(ENV_TOKENS.get('MKTG_URL_LINK_MAP', {}))
@@ -701,10 +701,7 @@ 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)
-if FEATURES['IS_EDX_DOMAIN']:
- PROFILE_IMAGE_DEFAULT_FILENAME = 'images/edx-theme/default'
-else:
- PROFILE_IMAGE_DEFAULT_FILENAME = ENV_TOKENS.get('PROFILE_IMAGE_DEFAULT_FILENAME', PROFILE_IMAGE_DEFAULT_FILENAME)
+PROFILE_IMAGE_DEFAULT_FILENAME = 'images/profiles/default'
# EdxNotes config
diff --git a/lms/envs/common.py b/lms/envs/common.py
index 176659cf0a..e805a586ca 100644
--- a/lms/envs/common.py
+++ b/lms/envs/common.py
@@ -426,7 +426,7 @@ COURSES_ROOT = ENV_ROOT / "data"
DATA_DIR = COURSES_ROOT
# comprehensive theming system
-COMP_THEME_DIR = ""
+COMPREHENSIVE_THEME_DIR = ""
# TODO: Remove the rest of the sys.path modification here and in cms/envs/common.py
sys.path.append(REPO_ROOT)
@@ -1087,7 +1087,7 @@ FOOTER_OPENEDX_LOGO_IMAGE = "https://files.edx.org/openedx-logos/edx-openedx-log
# This is just a placeholder image.
# Site operators can customize this with their organization's image.
-FOOTER_ORGANIZATION_IMAGE = "images/default-theme/logo.png"
+FOOTER_ORGANIZATION_IMAGE = "images/logo.png"
# These are referred to both by the Django asset pipeline
# AND by the branding footer API, which needs to decide which
@@ -1197,12 +1197,12 @@ X_FRAME_OPTIONS = 'ALLOW'
PIPELINE_ENABLED = True
-# Process static files using RequireJS Optimizer
-STATICFILES_STORAGE = 'openedx.core.lib.django_require.staticstorage.OptimizedCachedRequireJsStorage'
+STATICFILES_STORAGE = 'openedx.core.storage.ProductionStorage'
# List of finder classes that know how to find static files in various locations.
# Note: the pipeline finder is included to be able to discover optimized files
STATICFILES_FINDERS = [
+ 'openedx.core.djangoapps.theming.finders.ComprehensiveThemeFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'pipeline.finders.PipelineFinder',
@@ -2550,7 +2550,7 @@ PDF_RECEIPT_TAX_ID_LABEL = 'Tax ID'
PDF_RECEIPT_LOGO_PATH = PROJECT_ROOT + '/static/images/openedx-logo-tag.png'
# Height of the Logo in mm
PDF_RECEIPT_LOGO_HEIGHT_MM = 12
-PDF_RECEIPT_COBRAND_LOGO_PATH = PROJECT_ROOT + '/static/images/default-theme/logo.png'
+PDF_RECEIPT_COBRAND_LOGO_PATH = PROJECT_ROOT + '/static/images/logo.png'
# Height of the Co-brand Logo in mm
PDF_RECEIPT_COBRAND_LOGO_HEIGHT_MM = 12
@@ -2647,7 +2647,7 @@ PROFILE_IMAGE_BACKEND = {
'base_url': os.path.join(MEDIA_URL, 'profile-images/'),
},
}
-PROFILE_IMAGE_DEFAULT_FILENAME = 'images/default-theme/default-profile'
+PROFILE_IMAGE_DEFAULT_FILENAME = 'images/profiles/default'
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
diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py
index 897768757b..154e000656 100644
--- a/lms/envs/devstack.py
+++ b/lms/envs/devstack.py
@@ -86,12 +86,12 @@ def should_show_debug_toolbar(_):
########################### PIPELINE #################################
-# Skip packaging and optimization in development
PIPELINE_ENABLED = False
-STATICFILES_STORAGE = 'pipeline.storage.NonPackagingPipelineStorage'
+STATICFILES_STORAGE = 'openedx.core.storage.DevelopmentStorage'
# Revert to the default set of finders as we don't want the production pipeline
STATICFILES_FINDERS = [
+ 'openedx.core.djangoapps.theming.finders.ComprehensiveThemeFinder',
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
]
diff --git a/lms/static/images/default-theme/logo-large.png b/lms/static/images/logo-large.png
similarity index 100%
rename from lms/static/images/default-theme/logo-large.png
rename to lms/static/images/logo-large.png
diff --git a/lms/static/images/default-theme/logo.png b/lms/static/images/logo.png
similarity index 100%
rename from lms/static/images/default-theme/logo.png
rename to lms/static/images/logo.png
diff --git a/lms/static/images/default-theme/default-profile_120.png b/lms/static/images/profiles/default_120.png
similarity index 100%
rename from lms/static/images/default-theme/default-profile_120.png
rename to lms/static/images/profiles/default_120.png
diff --git a/lms/static/images/default-theme/default-profile_30.png b/lms/static/images/profiles/default_30.png
similarity index 100%
rename from lms/static/images/default-theme/default-profile_30.png
rename to lms/static/images/profiles/default_30.png
diff --git a/lms/static/images/default-theme/default-profile_50.png b/lms/static/images/profiles/default_50.png
similarity index 100%
rename from lms/static/images/default-theme/default-profile_50.png
rename to lms/static/images/profiles/default_50.png
diff --git a/lms/static/images/default-theme/default-profile_500.png b/lms/static/images/profiles/default_500.png
similarity index 100%
rename from lms/static/images/default-theme/default-profile_500.png
rename to lms/static/images/profiles/default_500.png
diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html
index a41bd48446..60b862199a 100644
--- a/lms/templates/courseware/course_about.html
+++ b/lms/templates/courseware/course_about.html
@@ -10,18 +10,6 @@ from edxmako.shortcuts import marketing_link
<%inherit file="../main.html" />
<%block name="headextra">
-
- <%
- if self.theme_enabled():
- google_analytics_file = u'../{ga}'.format(
- ga=microsite.get_value('google_analytics_file', 'theme-google-analytics.html')
- )
- else:
- google_analytics_file = '../google_analytics.html'
- %>
-
- <%include file="${google_analytics_file}" />
-
## OG (Open Graph) title and description added below to give social media info to display
## (https://developers.facebook.com/docs/opengraph/howtos/maximizing-distribution-media-content#tags)
diff --git a/lms/templates/google_analytics.html b/lms/templates/google_analytics.html
deleted file mode 100644
index 44ef9e76d6..0000000000
--- a/lms/templates/google_analytics.html
+++ /dev/null
@@ -1,13 +0,0 @@
-% if settings.GOOGLE_ANALYTICS_ACCOUNT:
-
-% endif
diff --git a/lms/templates/google_tag_manager.html b/lms/templates/google_tag_manager.html
deleted file mode 100644
index b3c6892d0e..0000000000
--- a/lms/templates/google_tag_manager.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<%doc>
- Yet, installing google tag manager for microsite(s).
- So intentionally left it blank
-%doc>
diff --git a/lms/templates/header.html b/lms/templates/header.html
index b3732c3912..00526f0ef6 100644
--- a/lms/templates/header.html
+++ b/lms/templates/header.html
@@ -1,3 +1,4 @@
+## mako
<%namespace name='static' file='static_content.html'/>
<%!
from microsite_configuration import microsite
@@ -5,13 +6,8 @@ from microsite_configuration import microsite
<%
theme_enabled = settings.FEATURES.get("USE_CUSTOM_THEME", False)
is_microsite = microsite.is_request_in_microsite()
-style_overrides_file = microsite.get_value('css_overrides_file')
%>
-% if style_overrides_file:
-
-% endif
-
% if theme_enabled and not is_microsite:
<%include file="theme-header.html" />
% else:
diff --git a/lms/templates/main.html b/lms/templates/main.html
index 1e450583ec..4af999ae83 100644
--- a/lms/templates/main.html
+++ b/lms/templates/main.html
@@ -61,7 +61,17 @@ from branding import api as branding_api
<%static:css group='style-vendor'/>
- <%static:css group='style-main'/>
+ ## We could do <%static:css group='style-main'/>, but that's only useful
+ ## if the group contains multiple files, and the 'style-main' group doesn't.
+ ## Instead, we'll construct this element manually, to improve clarity.
+ ## When nothing in the system is referencing the 'style-main' group, it can
+ ## be removed from the environment file.
+ <%
+ application_css_path = "css/lms-main{rtl}.css".format(
+ rtl="-rtl" if get_language_bidi() else "",
+ )
+ %>
+
% if disable_courseware_js:
<%static:js group='base_vendor'/>
@@ -84,31 +94,7 @@ from branding import api as branding_api
<%block name="headextra"/>
-<%
- 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')
- google_tag_manager_file = microsite.get_template_path('google_tag_manager.html')
-%>
-
- % if header_extra_file:
- <%include file="${header_extra_file}" />
- % endif
+ <%static:optional_include_mako file="head-extra.html" with_microsite="True" />
<%include file="widgets/optimizely.html" />
<%include file="widgets/segment-io.html" />
@@ -116,16 +102,25 @@ from branding import api as branding_api
- <%include file="${google_analytics_file}" />
+<% ga_acct = microsite.get_value("GOOGLE_ANALYTICS_ACCOUNT", settings.GOOGLE_ANALYTICS_ACCOUNT) %>
+% if ga_acct:
+
% endif
-<%include file="${google_tag_manager_file}" />
+<%static:optional_include_mako file="body-initial.html" with_microsite="True" />
% if not disable_window_wrap:
@@ -133,7 +128,7 @@ from branding import api as branding_api
#content%block>">${_("Skip to main content")}
% if not disable_header:
- <%include file="${header_file}" />
+ <%include file="${microsite.get_template_path('header.html')}" />
% endif
@@ -142,16 +137,7 @@ from branding import api as branding_api
% if not disable_footer:
- <%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>
+ <%include file="themable-footer.html" />
% endif
% if not disable_window_wrap:
@@ -162,6 +148,7 @@ from branding import api as branding_api
<%include file="widgets/segment-io-footer.html" />
+ <%static:optional_include_mako file="body-extra.html" with_microsite="True" />