diff --git a/cms/templates/widgets/header.html b/cms/templates/widgets/header.html index 836a618c8f3d..9257ac5a3872 100644 --- a/cms/templates/widgets/header.html +++ b/cms/templates/widgets/header.html @@ -12,7 +12,11 @@

- ${settings.STUDIO_NAME} + % if settings.FEATURES.get('IS_EDX_DOMAIN', False): + ${settings.STUDIO_NAME} + % else: + ${settings.STUDIO_NAME} + % endif

% if context_course: diff --git a/common/test/acceptance/pages/lms/learner_profile.py b/common/test/acceptance/pages/lms/learner_profile.py index 87325be1a71a..4b2f08f1eb3b 100644 --- a/common/test/acceptance/pages/lms/learner_profile.py +++ b/common/test/acceptance/pages/lms/learner_profile.py @@ -175,7 +175,7 @@ def profile_has_default_image(self): """ 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): """ diff --git a/lms/djangoapps/branding/__init__.py b/lms/djangoapps/branding/__init__.py index efe6c93876ff..e8fa35ee2220 100644 --- a/lms/djangoapps/branding/__init__.py +++ b/lms/djangoapps/branding/__init__.py @@ -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') diff --git a/lms/djangoapps/courseware/tests/test_comp_theming.py b/lms/djangoapps/courseware/tests/test_comp_theming.py index d2bc70123816..56ebca08f8ea 100644 --- a/lms/djangoapps/courseware/tests/test_comp_theming.py +++ b/lms/djangoapps/courseware/tests/test_comp_theming.py @@ -1,5 +1,6 @@ """Tests of comprehensive theming.""" +import unittest from django.conf import settings from django.test import TestCase @@ -20,6 +21,7 @@ def setUp(self): 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 @@ def do_the_test(self): 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') diff --git a/lms/envs/aws.py b/lms/envs/aws.py index 42caf4dd31c2..0ceb9f0511f5 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -682,7 +682,10 @@ 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 diff --git a/lms/envs/common.py b/lms/envs/common.py index 70e90a1ee7d4..d9f767599536 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -2601,7 +2601,7 @@ '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 diff --git a/lms/static/images/profiles/default_120.png b/lms/static/images/default-theme/default-profile_120.png similarity index 100% rename from lms/static/images/profiles/default_120.png rename to lms/static/images/default-theme/default-profile_120.png diff --git a/lms/static/images/profiles/default_30.png b/lms/static/images/default-theme/default-profile_30.png similarity index 100% rename from lms/static/images/profiles/default_30.png rename to lms/static/images/default-theme/default-profile_30.png diff --git a/lms/static/images/profiles/default_50.png b/lms/static/images/default-theme/default-profile_50.png similarity index 100% rename from lms/static/images/profiles/default_50.png rename to lms/static/images/default-theme/default-profile_50.png diff --git a/lms/static/images/profiles/default_500.png b/lms/static/images/default-theme/default-profile_500.png similarity index 100% rename from lms/static/images/profiles/default_500.png rename to lms/static/images/default-theme/default-profile_500.png diff --git a/lms/static/images/logo-large.png b/lms/static/images/default-theme/logo-large.png similarity index 100% rename from lms/static/images/logo-large.png rename to lms/static/images/default-theme/logo-large.png diff --git a/lms/static/images/logo.png b/lms/static/images/default-theme/logo.png similarity index 100% rename from lms/static/images/logo.png rename to lms/static/images/default-theme/logo.png diff --git a/themes/edx.org/lms/static/images/profiles/default_120.png b/lms/static/images/edx-theme/default_120.png similarity index 100% rename from themes/edx.org/lms/static/images/profiles/default_120.png rename to lms/static/images/edx-theme/default_120.png diff --git a/themes/edx.org/lms/static/images/profiles/default_30.png b/lms/static/images/edx-theme/default_30.png similarity index 100% rename from themes/edx.org/lms/static/images/profiles/default_30.png rename to lms/static/images/edx-theme/default_30.png diff --git a/themes/edx.org/lms/static/images/profiles/default_50.png b/lms/static/images/edx-theme/default_50.png similarity index 100% rename from themes/edx.org/lms/static/images/profiles/default_50.png rename to lms/static/images/edx-theme/default_50.png diff --git a/themes/edx.org/lms/static/images/profiles/default_500.png b/lms/static/images/edx-theme/default_500.png similarity index 100% rename from themes/edx.org/lms/static/images/profiles/default_500.png rename to lms/static/images/edx-theme/default_500.png diff --git a/themes/edx.org/lms/static/images/logo.png b/lms/static/images/edx-theme/edx-header-logo.png similarity index 100% rename from themes/edx.org/lms/static/images/logo.png rename to lms/static/images/edx-theme/edx-header-logo.png diff --git a/themes/edx.org/lms/static/images/logo-large.png b/lms/static/images/edx-theme/edx-logo-bw.png similarity index 100% rename from themes/edx.org/lms/static/images/logo-large.png rename to lms/static/images/edx-theme/edx-logo-bw.png diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index c8df28da92b5..870d4785ed4f 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -17,7 +17,7 @@ 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}" /> diff --git a/lms/templates/google-analytics.html b/lms/templates/google_analytics.html similarity index 100% rename from lms/templates/google-analytics.html rename to lms/templates/google_analytics.html diff --git a/lms/templates/main.html b/lms/templates/main.html index bafffe74629e..1ff63edf9d26 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -61,13 +61,7 @@ <%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 "", - ) - %> - + <%static:css group='style-main'/> % if disable_courseware_js: <%static:js group='base_vendor'/> @@ -90,7 +84,30 @@ <%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 @@ - <%static:optional_include_mako file="google-analytics.html" with_microsite="True" /> + <%include file="${google_analytics_file}" /> + +% if style_overrides_file: + +% endif @@ -110,7 +131,7 @@ #content">${_("Skip to main content")} % if not disable_header: - <%include file="header.html" /> + <%include file="${header_file}" /> % endif
@@ -119,7 +140,16 @@
% 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 + % endif % if not disable_window_wrap: diff --git a/lms/templates/themable-footer.html b/lms/templates/themable-footer.html deleted file mode 100644 index dc688d9f4340..000000000000 --- a/lms/templates/themable-footer.html +++ /dev/null @@ -1,13 +0,0 @@ -<%! -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 diff --git a/themes/README.rst b/themes/README.rst index 547c7d01f1a0..88fe30dc179f 100644 --- a/themes/README.rst +++ b/themes/README.rst @@ -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 --------------------- diff --git a/themes/edx.org/lms/templates/footer.html b/themes/edx.org/lms/templates/footer.html deleted file mode 100644 index d74638c628c7..000000000000 --- a/themes/edx.org/lms/templates/footer.html +++ /dev/null @@ -1,81 +0,0 @@ -## 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. - -% 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: - - % endfor -% endif -% if footer_js_url: - -% endif - diff --git a/themes/edx.org/lms/templates/header.html b/themes/edx.org/lms/templates/header.html deleted file mode 100644 index 3194120dc988..000000000000 --- a/themes/edx.org/lms/templates/header.html +++ /dev/null @@ -1,157 +0,0 @@ -## 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: -
-
- -

${site_status_msg}

-
-
-% endif - - - -% if course: - -% endif - -%if not user.is_authenticated(): - <%include file="forgot_password_modal.html" /> -%endif - -<%include file="help_modal.html"/>