From 2d8344924006534a7e85ced9b6712924f6f48e25 Mon Sep 17 00:00:00 2001 From: Saleem Latif <saleem_ee@hotmail.com> Date: Wed, 20 Jan 2016 17:37:15 +0500 Subject: [PATCH] Remove microsite_configuration/microsite.py references from individual templates * mattdrayer: Updated get_themed_template_path --- cms/templates/course_outline.html | 6 +--- .../templates/static_content.html | 25 ++++++++++--- .../test_microsite/templates/footer.html | 1 - .../test_microsite/templates/head-extra.html | 3 +- lms/templates/courseware/course_about.html | 11 +++--- lms/templates/courseware/courses.html | 1 - lms/templates/dashboard.html | 3 +- lms/templates/forgot_password_modal.html | 5 +-- lms/templates/header.html | 14 +------- lms/templates/help_modal.html | 1 - .../cohort_management.html | 1 - .../instructor_dashboard_2/membership.html | 4 +-- lms/templates/login.html | 5 ++- lms/templates/main.html | 16 ++++----- lms/templates/navigation-edx.html | 2 -- lms/templates/navigation.html | 5 ++- lms/templates/register.html | 9 +++-- lms/templates/shoppingcart/receipt.html | 7 ++-- .../shoppingcart/receipt_custom_pane.html | 2 +- .../shoppingcart/shopping_cart_flow.html | 3 +- .../student_account/account_settings.html | 3 +- lms/templates/themable-footer.html | 16 ++------- openedx/core/djangoapps/theming/helpers.py | 35 +++++++++++++++++++ themes/edx.org/lms/templates/header.html | 2 -- themes/red-theme/lms/templates/header.html | 3 +- 25 files changed, 94 insertions(+), 89 deletions(-) diff --git a/cms/templates/course_outline.html b/cms/templates/course_outline.html index bf360056c5c..c7a5f2582ce 100644 --- a/cms/templates/course_outline.html +++ b/cms/templates/course_outline.html @@ -6,7 +6,6 @@ from util.date_utils import get_default_time_display from django.utils.translation import ugettext as _ from openedx.core.lib.js_utils import escape_json_dumps from contentstore.utils import reverse_usage_url -from microsite_configuration import microsite from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration %> <%block name="title">${_("Course Outline")}</%block> @@ -54,9 +53,6 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration %endif %if deprecated_blocks_info.get('blocks') or deprecated_blocks_info.get('block_types_enabled'): - <% - platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME) - %> <div class="wrapper wrapper-alert wrapper-alert-error is-shown"> <div class="alert announcement"> <i class="feedback-symbol fa fa-warning" aria-hidden="true"></i><span class="sr">${_("Warning")}</span> @@ -87,7 +83,7 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration <div class="advance-modules-list"> <p class="advance-modules-remove-text"> ${_("To avoid errors, {platform_name} strongly recommends that you remove unsupported features from the course advanced settings. To do this, go to the {link_start}Advanced Settings page{link_end}, locate the \"Advanced Module List\" setting, and then delete the following modules from the list.").format( - platform_name=platform_name, + platform_name=static.get_platform_name(), link_start='<a href="{advance_settings_url}">'.format(advance_settings_url=deprecated_blocks_info['advance_settings_url']), link_end="</a>" )} </p> diff --git a/common/djangoapps/pipeline_mako/templates/static_content.html b/common/djangoapps/pipeline_mako/templates/static_content.html index ccfab078458..97f433e1000 100644 --- a/common/djangoapps/pipeline_mako/templates/static_content.html +++ b/common/djangoapps/pipeline_mako/templates/static_content.html @@ -4,8 +4,7 @@ from pipeline_mako import compressed_css, compressed_js from django.utils.translation import get_language_bidi from mako.exceptions import TemplateLookupException -from microsite_configuration import microsite -from openedx.core.djangoapps.theming.helpers import get_page_title_breadcrumbs, get_value +from openedx.core.djangoapps.theming.helpers import get_page_title_breadcrumbs, get_value, get_template_path, get_themed_template_path, is_request_in_themed_site from certificates.api import get_asset_url_by_slug %> @@ -89,10 +88,10 @@ source, template_path = Loader(engine).load_template_source(path) </script> </%def> -<%def name="optional_include_mako(file, with_microsite=False)"><% +<%def name="optional_include_mako(file, is_theming_enabled=False)"><% # http://stackoverflow.com/q/21219531 -if with_microsite: - file = microsite.get_template_path(file) +if is_theming_enabled: + file = get_template_path(file) try: tmpl = self.get_template(file) except TemplateLookupException: @@ -109,3 +108,19 @@ else: <%def name="get_platform_name()"><% return get_value('platform_name', settings.PLATFORM_NAME) %></%def> + +<%def name="get_value(val_name, default=None, **kwargs)"><% + return get_value(val_name, default=default, **kwargs) +%></%def> + +<%def name="get_template_path(relative_path, **kwargs)"><% + return get_template_path(relative_path, **kwargs) +%></%def> + +<%def name="get_themed_template_path(relative_path, default_path, **kwargs)"><% + return get_themed_template_path(relative_path, default_path, **kwargs) +%></%def> + +<%def name="is_request_in_themed_site()"><% + return is_request_in_themed_site() +%></%def> diff --git a/common/test/test_microsites/test_microsite/templates/footer.html b/common/test/test_microsites/test_microsite/templates/footer.html index 66ea6e55516..a7044c0e35d 100644 --- a/common/test/test_microsites/test_microsite/templates/footer.html +++ b/common/test/test_microsites/test_microsite/templates/footer.html @@ -3,7 +3,6 @@ <%! from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ -from microsite_configuration import microsite %> diff --git a/common/test/test_microsites/test_microsite/templates/head-extra.html b/common/test/test_microsites/test_microsite/templates/head-extra.html index 82d60e754c4..197662ceaba 100644 --- a/common/test/test_microsites/test_microsite/templates/head-extra.html +++ b/common/test/test_microsites/test_microsite/templates/head-extra.html @@ -1,6 +1,5 @@ <%namespace name='static' file='../../static_content.html'/> -<%! from microsite_configuration import microsite %> -<% style_overrides_file = microsite.get_value('css_overrides_file') %> +<% style_overrides_file = static.get_value('css_overrides_file') %> % if style_overrides_file: <link rel="stylesheet" type="text/css" href="${static.url(style_overrides_file)}" /> diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index dbddd8a5c10..d376099e85f 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -1,6 +1,5 @@ <%namespace name='static' file='../static_content.html'/> <%! -from microsite_configuration import microsite from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse from courseware.courses import get_course_about_section @@ -213,7 +212,7 @@ from openedx.core.lib.courses import course_image_url <section class="course-sidebar"> <section class="course-summary"> <header> - % if microsite.get_value('course_about_show_social_links', True): + % if static.get_value('course_about_show_social_links', True): <div class="social-sharing"> <div class="sharing-message">${_("Share with friends and family!")}</div> ## TODO: this should probably be an overrideable block, @@ -228,15 +227,15 @@ from openedx.core.lib.courses import course_image_url </a> % else: <% - site_domain = microsite.get_value('site_domain', settings.SITE_NAME) - platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME) + site_domain = static.get_value('site_domain', settings.SITE_NAME) + platform_name = static.get_platform_name() ## Translators: This text will be automatically posted to the student's ## Twitter account. {url} should appear at the end of the text. tweet_text = _("I just enrolled in {number} {title} through {account}: {url}").format( number=course.number, title=course.display_name_with_default_escaped, - account=microsite.get_value('course_about_twitter_account', settings.PLATFORM_TWITTER_ACCOUNT), + account=static.get_value('course_about_twitter_account', settings.PLATFORM_TWITTER_ACCOUNT), url=u"http://{domain}{path}".format( domain=site_domain, path=reverse('about_course', args=[course.id.to_deprecated_string()]) @@ -244,7 +243,7 @@ from openedx.core.lib.courses import course_image_url ).replace(u" ", u"+") tweet_action = u"http://twitter.com/intent/tweet?text={tweet_text}".format(tweet_text=tweet_text) - facebook_link = microsite.get_value('course_about_facebook_link', settings.PLATFORM_FACEBOOK_ACCOUNT) + facebook_link = static.get_value('course_about_facebook_link', settings.PLATFORM_FACEBOOK_ACCOUNT) email_subject = u"mailto:?subject={subject}&body={body}".format( subject=_("Take a course with {platform} online").format(platform=platform_name), diff --git a/lms/templates/courseware/courses.html b/lms/templates/courseware/courses.html index 326856ccc09..0fdcc6836a8 100644 --- a/lms/templates/courseware/courses.html +++ b/lms/templates/courseware/courses.html @@ -1,7 +1,6 @@ <%! import json from django.utils.translation import ugettext as _ - from microsite_configuration import microsite from openedx.core.lib.js_utils import escape_json_dumps %> <%inherit file="../main.html" /> diff --git a/lms/templates/dashboard.html b/lms/templates/dashboard.html index 1fe6a6213e6..d256c936a0a 100644 --- a/lms/templates/dashboard.html +++ b/lms/templates/dashboard.html @@ -5,7 +5,6 @@ from django.utils.translation import ugettext as _ from django.template import RequestContext import third_party_auth from third_party_auth import pipeline -from microsite_configuration import microsite from django.core.urlresolvers import reverse import json %> @@ -175,7 +174,7 @@ import json </li> % endif - <%include file="${microsite.get_template_path('dashboard/_dashboard_status_verification.html')}" /> + <%include file="${static.get_template_path('dashboard/_dashboard_status_verification.html')}" /> </ul> </section> diff --git a/lms/templates/forgot_password_modal.html b/lms/templates/forgot_password_modal.html index c5141354de2..660d30d5e30 100644 --- a/lms/templates/forgot_password_modal.html +++ b/lms/templates/forgot_password_modal.html @@ -1,7 +1,8 @@ +<%namespace name='static' file='static_content.html'/> + <%! from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse -from microsite_configuration import microsite %> <section id="forgot-password-modal" class="modal" role="dialog" tabindex="-1" aria-label="${_('Password Reset')}"> @@ -31,7 +32,7 @@ from microsite_configuration import microsite <li class="field required text" id="forgot-password-modal-field-email"> <label for="pwd_reset_email">${_("Your E-mail Address")}</label> <input class="" id="pwd_reset_email" type="email" name="email" value="" placeholder="example: username@domain.com" aria-describedby="pwd_reset_email-tip" aria-required="true" /> - <span class="tip tip-input" id="pwd_reset_email-tip">${_("This is the e-mail address you used to register with {platform}").format(platform=microsite.get_value('platform_name', settings.PLATFORM_NAME))}</span> + <span class="tip tip-input" id="pwd_reset_email-tip">${_("This is the e-mail address you used to register with {platform}").format(platform=static.get_platform_name())}</span> </li> </ol> </fieldset> diff --git a/lms/templates/header.html b/lms/templates/header.html index 00526f0ef6d..7cd5ee065e8 100644 --- a/lms/templates/header.html +++ b/lms/templates/header.html @@ -1,15 +1,3 @@ ## mako <%namespace name='static' file='static_content.html'/> -<%! -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-header.html" /> -% else: - <%include file="${microsite.get_template_path('navigation.html')}" /> -% endif +<%include file="${static.get_themed_template_path(relative_path='theme-header.html', default_path='navigation.html')}" /> diff --git a/lms/templates/help_modal.html b/lms/templates/help_modal.html index 85fc3ab3ab6..4b5f6b97f1d 100644 --- a/lms/templates/help_modal.html +++ b/lms/templates/help_modal.html @@ -7,7 +7,6 @@ from django.conf import settings from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse from xmodule.tabs import CourseTabList -from microsite_configuration import microsite %> % if settings.FEATURES.get('ENABLE_FEEDBACK_SUBMISSION', False): diff --git a/lms/templates/instructor/instructor_dashboard_2/cohort_management.html b/lms/templates/instructor/instructor_dashboard_2/cohort_management.html index 7a46a00d936..71d5fe0dfc2 100644 --- a/lms/templates/instructor/instructor_dashboard_2/cohort_management.html +++ b/lms/templates/instructor/instructor_dashboard_2/cohort_management.html @@ -3,7 +3,6 @@ <%! from django.utils.translation import ugettext as _ from courseware.courses import get_studio_url -from microsite_configuration import microsite from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition %> diff --git a/lms/templates/instructor/instructor_dashboard_2/membership.html b/lms/templates/instructor/instructor_dashboard_2/membership.html index 102903320f9..cf00fb208a6 100644 --- a/lms/templates/instructor/instructor_dashboard_2/membership.html +++ b/lms/templates/instructor/instructor_dashboard_2/membership.html @@ -1,8 +1,8 @@ +<%namespace name='static' file='/static_content.html'/> <%page args="section_data"/> <%! from django.utils.translation import ugettext as _ from courseware.courses import get_studio_url -from microsite_configuration import microsite from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition %> @@ -83,7 +83,7 @@ from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_ <div class="request-response-error"></div> </div> -%if microsite.get_value('ALLOW_AUTOMATED_SIGNUPS', settings.FEATURES.get('ALLOW_AUTOMATED_SIGNUPS', False)): +%if static.get_value('ALLOW_AUTOMATED_SIGNUPS', settings.FEATURES.get('ALLOW_AUTOMATED_SIGNUPS', False)): <hr class="divider" /> <div class="auto_enroll auto_enroll_csv"> diff --git a/lms/templates/login.html b/lms/templates/login.html index b0012d1d01b..439cfab8da4 100644 --- a/lms/templates/login.html +++ b/lms/templates/login.html @@ -6,7 +6,6 @@ from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ import third_party_auth from third_party_auth import provider, pipeline -from microsite_configuration import microsite %> <%block name="pagetitle">${_("Log into your {platform_name} Account").format(platform_name=platform_name)}</%block> @@ -233,8 +232,8 @@ from microsite_configuration import microsite <aside role="complementary"> <% - # allow for microsite overrides on the registration sidebars, otherwise default to pre-existing ones - sidebar_file = microsite.get_template_path('login-sidebar.html') + # allow for theming overrides on the registration sidebars, otherwise default to pre-existing ones + sidebar_file = static.get_template_path('login-sidebar.html') %> <%include file="${sidebar_file}" /> diff --git a/lms/templates/main.html b/lms/templates/main.html index fd72b3dd84b..03c3b3f46c0 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -5,7 +5,6 @@ from django.core.urlresolvers import reverse from django.utils.http import urlquote_plus from django.utils.translation import ugettext as _ from django.utils.translation import get_language_bidi -from microsite_configuration import microsite from branding import api as branding_api %> <!DOCTYPE html> @@ -23,9 +22,6 @@ from branding import api as branding_api <%def name="theme_enabled()"> <% return settings.FEATURES.get("USE_CUSTOM_THEME", False) %> </%def> -<%def name="is_microsite()"> - <% return microsite.is_request_in_microsite() %> -</%def> <%def name="stanford_theme_enabled()"> <% @@ -57,7 +53,7 @@ from branding import api as branding_api <script type="text/javascript" src="/i18n.js"></script> - <link rel="icon" type="image/x-icon" href="${static.url(microsite.get_value('favicon_path', settings.FAVICON_PATH))}" /> + <link rel="icon" type="image/x-icon" href="${static.url(static.get_value('favicon_path', settings.FAVICON_PATH))}" /> <%static:css group='style-vendor'/> ## We could do <%static:css group='style-main'/>, but that's only useful @@ -96,7 +92,7 @@ from branding import api as branding_api <%block name="headextra"/> - <%static:optional_include_mako file="head-extra.html" with_microsite="True" /> + <%static:optional_include_mako file="head-extra.html" is_theming_enabled="True" /> <%include file="widgets/optimizely.html" /> <%include file="widgets/segment-io.html" /> @@ -104,7 +100,7 @@ from branding import api as branding_api <meta name="path_prefix" content="${EDX_ROOT_URL}"> <meta name="google-site-verification" content="_mipQ4AtZQDNmbtOkwehQDOgCxUUV2fb_C0b6wbiRHY" /> -<% ga_acct = microsite.get_value("GOOGLE_ANALYTICS_ACCOUNT", settings.GOOGLE_ANALYTICS_ACCOUNT) %> +<% ga_acct = static.get_value("GOOGLE_ANALYTICS_ACCOUNT", settings.GOOGLE_ANALYTICS_ACCOUNT) %> % if ga_acct: <script type="text/javascript"> var _gaq = _gaq || []; @@ -122,7 +118,7 @@ from branding import api as branding_api </head> <body class="${static.dir_rtl()} <%block name='bodyclass'/> lang_${LANGUAGE_CODE}"> -<%static:optional_include_mako file="body-initial.html" with_microsite="True" /> +<%static:optional_include_mako file="body-initial.html" is_theming_enabled="True" /> <div id="page-prompt"></div> % if not disable_window_wrap: <div class="window-wrap" dir="${static.dir_rtl()}"> @@ -130,7 +126,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="${microsite.get_template_path('header.html')}" /> + <%include file="${static.get_template_path('header.html')}" /> % endif <div class="content-wrapper" id="content"> @@ -150,7 +146,7 @@ from branding import api as branding_api <%include file="widgets/segment-io-footer.html" /> <script type="text/javascript" src="${static.url('js/vendor/noreferrer.js')}" charset="utf-8"></script> <script type="text/javascript" src="${static.url('js/utils/navigation.js')}" charset="utf-8"></script> - <%static:optional_include_mako file="body-extra.html" with_microsite="True" /> + <%static:optional_include_mako file="body-extra.html" is_theming_enabled="True" /> </body> </html> diff --git a/lms/templates/navigation-edx.html b/lms/templates/navigation-edx.html index 35a401390df..0e005d0d1dc 100644 --- a/lms/templates/navigation-edx.html +++ b/lms/templates/navigation-edx.html @@ -5,8 +5,6 @@ from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ -from microsite_configuration import microsite - # App that handles subdomain specific branding from branding import api as branding_api # app that handles site status messages diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html index e3e1e97a516..532401130ca 100644 --- a/lms/templates/navigation.html +++ b/lms/templates/navigation.html @@ -5,7 +5,6 @@ from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ -from microsite_configuration import microsite from lms.djangoapps.ccx.overrides import get_current_ccx # App that handles subdomain specific branding @@ -96,7 +95,7 @@ site_status_msg = get_site_status_msg(course_id) </ul> </li> </ol> - % if should_display_shopping_cart_func() and not (course and microsite.is_request_in_microsite()): # see shoppingcart.context_processor.user_has_cart_context_processor + % if should_display_shopping_cart_func() and not (course and static.is_request_in_themed_site()): # see shoppingcart.context_processor.user_has_cart_context_processor <ol class="user"> <li class="primary"> <a class="shopping-cart" href="${reverse('shoppingcart.views.show_cart')}"> @@ -108,7 +107,7 @@ site_status_msg = get_site_status_msg(course_id) % else: <ol class="left nav-global"> <%block name="navigation_global_links"> - % if microsite.get_value('ENABLE_MKTG_SITE', settings.FEATURES.get('ENABLE_MKTG_SITE', False)): + % if static.get_value('ENABLE_MKTG_SITE', settings.FEATURES.get('ENABLE_MKTG_SITE', False)): <li class="nav-global-01"> <a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a> </li> diff --git a/lms/templates/register.html b/lms/templates/register.html index 583010f481e..b273dbf36df 100644 --- a/lms/templates/register.html +++ b/lms/templates/register.html @@ -6,7 +6,6 @@ from django.utils.translation import ugettext as _ from django.core.urlresolvers import reverse from django.utils import html from django_countries import countries -from microsite_configuration import microsite from student.models import UserProfile from datetime import date import third_party_auth @@ -112,8 +111,8 @@ import calendar <section role="main" class="content"> <form role="form" id="register-form" method="post" data-remote="true" action="/create_account" novalidate> <% - # allow for microsite override on the registration form - registration_form = microsite.get_template_path('register-form.html') + # allow for theming override on the registration form + registration_form = static.get_template_path('register-form.html') %> <%include file="${registration_form}" /> </form> @@ -122,8 +121,8 @@ import calendar <aside role="complementary"> <% - # allow for microsite overrides on the registration sidebars, otherwise default to pre-existing ones - sidebar_file = microsite.get_template_path('register-sidebar.html') + # allow for theming overrides on the registration sidebars, otherwise default to pre-existing ones + sidebar_file = static.get_template_path('register-sidebar.html') %> <%include file="${sidebar_file}" /> diff --git a/lms/templates/shoppingcart/receipt.html b/lms/templates/shoppingcart/receipt.html index aa3beede3c3..181268858f3 100644 --- a/lms/templates/shoppingcart/receipt.html +++ b/lms/templates/shoppingcart/receipt.html @@ -1,10 +1,11 @@ +<%namespace name='static' file='/static_content.html'/> + <%inherit file="shopping_cart_flow.html" /> <%! from django.utils.translation import ugettext as _ from django.utils.translation import ungettext from django.core.urlresolvers import reverse from markupsafe import escape -from microsite_configuration import microsite from openedx.core.lib.courses import course_image_url %> @@ -377,8 +378,8 @@ from openedx.core.lib.courses import course_image_url <span class="pull-right">${_("Total")}: <b> ${currency_symbol}${"{0:0.2f}".format(order.total_cost)} ${currency.upper()}</b></span> </div> </div> - ## Allow for a microsite to be able to insert additional text at the bottom of the page - <%include file="${microsite.get_template_path('receipt_custom_pane.html')}" /> + ## Allow for a theming to be able to insert additional text at the bottom of the page + <%include file="${static.get_template_path('receipt_custom_pane.html')}" /> </section> </div> </%block> diff --git a/lms/templates/shoppingcart/receipt_custom_pane.html b/lms/templates/shoppingcart/receipt_custom_pane.html index 08755f0a8e7..d4dc1490897 100644 --- a/lms/templates/shoppingcart/receipt_custom_pane.html +++ b/lms/templates/shoppingcart/receipt_custom_pane.html @@ -1,2 +1,2 @@ -## Intentionally left blank. This Mako template can be overriden by a microsite template to insert brand +## Intentionally left blank. This Mako template can be overriden by a theming template to insert brand ## specific HTML into the lower pane of the receipt.html page diff --git a/lms/templates/shoppingcart/shopping_cart_flow.html b/lms/templates/shoppingcart/shopping_cart_flow.html index 052b013e2a1..56c4c12d74f 100644 --- a/lms/templates/shoppingcart/shopping_cart_flow.html +++ b/lms/templates/shoppingcart/shopping_cart_flow.html @@ -3,7 +3,6 @@ <%! from django.utils.translation import ugettext as _ from django.conf import settings -from microsite_configuration import microsite %> <%block name="pagetitle">${_("Shopping cart")}</%block> <%block name="headextra"> @@ -13,7 +12,7 @@ from microsite_configuration import microsite <div class="container"> <header class="wrapper confirm-enrollment shopping-cart"> - <h1> ${_("{platform_name} - Shopping Cart").format(platform_name=microsite.get_value('platform_name', settings.PLATFORM_NAME))}</h1> + <h1> ${_("{platform_name} - Shopping Cart").format(platform_name=static.get_platform_name())}</h1> % if shoppingcart_items: <ol class="steps"> <li <%block name="review_highlight"/>>${_('Review')}</li> diff --git a/lms/templates/student_account/account_settings.html b/lms/templates/student_account/account_settings.html index 69ea9669be0..7d912789dcb 100644 --- a/lms/templates/student_account/account_settings.html +++ b/lms/templates/student_account/account_settings.html @@ -3,7 +3,6 @@ import json from django.core.urlresolvers import reverse from django.conf import settings from django.utils.translation import ugettext as _ -from microsite_configuration import microsite %> <!--<%namespace name='static' file='/static_content.html'/>--> @@ -30,7 +29,7 @@ from microsite_configuration import microsite <%static:require_module module_name="js/student_account/views/account_settings_factory" class_name="AccountSettingsFactory"> var fieldsData = ${ json.dumps(fields) }; var authData = ${ json.dumps(auth) }; - var platformName = ${ json.dumps(microsite.get_value('platform_name', settings.PLATFORM_NAME))}; + var platformName = ${json.dumps(static.get_platform_name())}; AccountSettingsFactory( fieldsData, authData, '${user_accounts_api_url}', '${user_preferences_api_url}', ${user.id}, platformName diff --git a/lms/templates/themable-footer.html b/lms/templates/themable-footer.html index 09893ad4e80..bd78ca45f79 100644 --- a/lms/templates/themable-footer.html +++ b/lms/templates/themable-footer.html @@ -1,20 +1,10 @@ ## mako -<%! -from microsite_configuration import microsite -%> -<% -theme_enabled = settings.FEATURES.get("USE_CUSTOM_THEME", False) -is_microsite = microsite.is_request_in_microsite() -%> +<%namespace name='static' file='static_content.html'/> ## This file only exists as an additional layer of indirection to preserve -## backwards compatibility with microsites and Stanford theming +## backwards compatibility with Stanford theming ## (as much as possible). If you are writing your own theme using the ## "comprehensive theming" system, do NOT override this file. You should ## override "footer.html" instead. -% if theme_enabled and not is_microsite: - <%include file="theme-footer.html" /> -% else: - <%include file="${microsite.get_template_path('footer.html')}" /> -% endif +<%include file="${static.get_themed_template_path(relative_path='theme-footer.html', default_path='footer.html')}" /> diff --git a/openedx/core/djangoapps/theming/helpers.py b/openedx/core/djangoapps/theming/helpers.py index 5957765ec90..28ce710ebe8 100644 --- a/openedx/core/djangoapps/theming/helpers.py +++ b/openedx/core/djangoapps/theming/helpers.py @@ -3,6 +3,7 @@ """ from microsite_configuration import microsite from microsite_configuration import page_title_breadcrumbs +from django.conf import settings def get_page_title_breadcrumbs(*args): @@ -17,3 +18,37 @@ def get_value(val_name, default=None, **kwargs): This is a proxy function to hide microsite_configuration behind comprehensive theming. """ return microsite.get_value(val_name, default=default, **kwargs) + + +def get_template_path(relative_path, **kwargs): + """ + This is a proxy function to hide microsite_configuration behind comprehensive theming. + """ + return microsite.get_template_path(relative_path, **kwargs) + + +def is_request_in_themed_site(): + """ + This is a proxy function to hide microsite_configuration behind comprehensive theming. + """ + return microsite.is_request_in_microsite() + + +def get_themed_template_path(relative_path, default_path, **kwargs): + """ + This is a proxy function to hide microsite_configuration behind comprehensive theming. + + The workflow considers the "Stanford theming" feature alongside of microsites. It returns + the path of the themed template (i.e. relative_path) if Stanford theming is enabled AND + microsite theming is disabled, otherwise it will return the path of either the microsite + override template or the base lms template. + + :param relative_path: relative path of themed template + :param default_path: relative path of the microsite's or lms template to use if + theming is disabled or microsite is enabled + """ + is_stanford_theming_enabled = settings.FEATURES.get("USE_CUSTOM_THEME", False) + is_microsite = microsite.is_request_in_microsite() + if is_stanford_theming_enabled and not is_microsite: + return relative_path + return microsite.get_template_path(default_path, **kwargs) diff --git a/themes/edx.org/lms/templates/header.html b/themes/edx.org/lms/templates/header.html index 88adee13b12..e80e0483108 100644 --- a/themes/edx.org/lms/templates/header.html +++ b/themes/edx.org/lms/templates/header.html @@ -5,8 +5,6 @@ from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ -from microsite_configuration import microsite - # App that handles subdomain specific branding import branding # app that handles site status messages diff --git a/themes/red-theme/lms/templates/header.html b/themes/red-theme/lms/templates/header.html index 345e926f9a5..50525484a84 100755 --- a/themes/red-theme/lms/templates/header.html +++ b/themes/red-theme/lms/templates/header.html @@ -10,7 +10,6 @@ import branding # app that handles site status messages from status.status import get_site_status_msg -from microsite_configuration import microsite from ccx.overrides import get_current_ccx %> @@ -109,7 +108,7 @@ site_status_msg = get_site_status_msg(course_id) % else: <ol class="left nav-global"> <%block name="navigation_global_links"> - % if microsite.get_value('ENABLE_MKTG_SITE', settings.FEATURES.get('ENABLE_MKTG_SITE', False)): + % if static.get_value('ENABLE_MKTG_SITE', settings.FEATURES.get('ENABLE_MKTG_SITE', False)): <li class="nav-global-01"> <a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a> </li> -- GitLab