Commit 479ce51b by Matt Drayer

Merge pull request #11290 from edx/saleem-latif/WL-277

WL-277: Remove microsite_configuration/microsite.py references from individual html templates
parents 45db325a 2d834492
...@@ -6,7 +6,6 @@ from util.date_utils import get_default_time_display ...@@ -6,7 +6,6 @@ from util.date_utils import get_default_time_display
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from openedx.core.lib.js_utils import escape_json_dumps from openedx.core.lib.js_utils import escape_json_dumps
from contentstore.utils import reverse_usage_url from contentstore.utils import reverse_usage_url
from microsite_configuration import microsite
from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
%> %>
<%block name="title">${_("Course Outline")}</%block> <%block name="title">${_("Course Outline")}</%block>
...@@ -54,9 +53,6 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration ...@@ -54,9 +53,6 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
%endif %endif
%if deprecated_blocks_info.get('blocks') or deprecated_blocks_info.get('block_types_enabled'): %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="wrapper wrapper-alert wrapper-alert-error is-shown">
<div class="alert announcement"> <div class="alert announcement">
<i class="feedback-symbol fa fa-warning" aria-hidden="true"></i><span class="sr">${_("Warning")}</span> <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 ...@@ -87,7 +83,7 @@ from openedx.core.djangoapps.self_paced.models import SelfPacedConfiguration
<div class="advance-modules-list"> <div class="advance-modules-list">
<p class="advance-modules-remove-text"> <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( ${_("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>" link_start='<a href="{advance_settings_url}">'.format(advance_settings_url=deprecated_blocks_info['advance_settings_url']), link_end="</a>"
)} )}
</p> </p>
......
...@@ -4,8 +4,7 @@ from pipeline_mako import compressed_css, compressed_js ...@@ -4,8 +4,7 @@ from pipeline_mako import compressed_css, compressed_js
from django.utils.translation import get_language_bidi from django.utils.translation import get_language_bidi
from mako.exceptions import TemplateLookupException from mako.exceptions import TemplateLookupException
from microsite_configuration import microsite 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 openedx.core.djangoapps.theming.helpers import get_page_title_breadcrumbs, get_value
from certificates.api import get_asset_url_by_slug from certificates.api import get_asset_url_by_slug
%> %>
...@@ -89,10 +88,10 @@ source, template_path = Loader(engine).load_template_source(path) ...@@ -89,10 +88,10 @@ source, template_path = Loader(engine).load_template_source(path)
</script> </script>
</%def> </%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 # http://stackoverflow.com/q/21219531
if with_microsite: if is_theming_enabled:
file = microsite.get_template_path(file) file = get_template_path(file)
try: try:
tmpl = self.get_template(file) tmpl = self.get_template(file)
except TemplateLookupException: except TemplateLookupException:
...@@ -109,3 +108,19 @@ else: ...@@ -109,3 +108,19 @@ else:
<%def name="get_platform_name()"><% <%def name="get_platform_name()"><%
return get_value('platform_name', settings.PLATFORM_NAME) return get_value('platform_name', settings.PLATFORM_NAME)
%></%def> %></%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>
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<%! <%!
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from microsite_configuration import microsite
%> %>
......
<%namespace name='static' file='../../static_content.html'/> <%namespace name='static' file='../../static_content.html'/>
<%! from microsite_configuration import microsite %> <% style_overrides_file = static.get_value('css_overrides_file') %>
<% style_overrides_file = microsite.get_value('css_overrides_file') %>
% if style_overrides_file: % if style_overrides_file:
<link rel="stylesheet" type="text/css" href="${static.url(style_overrides_file)}" /> <link rel="stylesheet" type="text/css" href="${static.url(style_overrides_file)}" />
......
<%namespace name='static' file='../static_content.html'/> <%namespace name='static' file='../static_content.html'/>
<%! <%!
from microsite_configuration import microsite
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from courseware.courses import get_course_about_section from courseware.courses import get_course_about_section
...@@ -213,7 +212,7 @@ from openedx.core.lib.courses import course_image_url ...@@ -213,7 +212,7 @@ from openedx.core.lib.courses import course_image_url
<section class="course-sidebar"> <section class="course-sidebar">
<section class="course-summary"> <section class="course-summary">
<header> <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="social-sharing">
<div class="sharing-message">${_("Share with friends and family!")}</div> <div class="sharing-message">${_("Share with friends and family!")}</div>
## TODO: this should probably be an overrideable block, ## TODO: this should probably be an overrideable block,
...@@ -228,15 +227,15 @@ from openedx.core.lib.courses import course_image_url ...@@ -228,15 +227,15 @@ from openedx.core.lib.courses import course_image_url
</a> </a>
% else: % else:
<% <%
site_domain = microsite.get_value('site_domain', settings.SITE_NAME) site_domain = static.get_value('site_domain', settings.SITE_NAME)
platform_name = microsite.get_value('platform_name', settings.PLATFORM_NAME) platform_name = static.get_platform_name()
## Translators: This text will be automatically posted to the student's ## Translators: This text will be automatically posted to the student's
## Twitter account. {url} should appear at the end of the text. ## Twitter account. {url} should appear at the end of the text.
tweet_text = _("I just enrolled in {number} {title} through {account}: {url}").format( tweet_text = _("I just enrolled in {number} {title} through {account}: {url}").format(
number=course.number, number=course.number,
title=course.display_name_with_default_escaped, 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( url=u"http://{domain}{path}".format(
domain=site_domain, domain=site_domain,
path=reverse('about_course', args=[course.id.to_deprecated_string()]) path=reverse('about_course', args=[course.id.to_deprecated_string()])
...@@ -244,7 +243,7 @@ from openedx.core.lib.courses import course_image_url ...@@ -244,7 +243,7 @@ from openedx.core.lib.courses import course_image_url
).replace(u" ", u"+") ).replace(u" ", u"+")
tweet_action = u"http://twitter.com/intent/tweet?text={tweet_text}".format(tweet_text=tweet_text) 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( email_subject = u"mailto:?subject={subject}&body={body}".format(
subject=_("Take a course with {platform} online").format(platform=platform_name), subject=_("Take a course with {platform} online").format(platform=platform_name),
......
<%! <%!
import json import json
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from microsite_configuration import microsite
from openedx.core.lib.js_utils import escape_json_dumps from openedx.core.lib.js_utils import escape_json_dumps
%> %>
<%inherit file="../main.html" /> <%inherit file="../main.html" />
......
...@@ -5,7 +5,6 @@ from django.utils.translation import ugettext as _ ...@@ -5,7 +5,6 @@ from django.utils.translation import ugettext as _
from django.template import RequestContext from django.template import RequestContext
import third_party_auth import third_party_auth
from third_party_auth import pipeline from third_party_auth import pipeline
from microsite_configuration import microsite
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
import json import json
%> %>
...@@ -175,7 +174,7 @@ import json ...@@ -175,7 +174,7 @@ import json
</li> </li>
% endif % endif
<%include file="${microsite.get_template_path('dashboard/_dashboard_status_verification.html')}" /> <%include file="${static.get_template_path('dashboard/_dashboard_status_verification.html')}" />
</ul> </ul>
</section> </section>
......
<%namespace name='static' file='static_content.html'/>
<%! <%!
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse 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')}"> <section id="forgot-password-modal" class="modal" role="dialog" tabindex="-1" aria-label="${_('Password Reset')}">
...@@ -31,7 +32,7 @@ from microsite_configuration import microsite ...@@ -31,7 +32,7 @@ from microsite_configuration import microsite
<li class="field required text" id="forgot-password-modal-field-email"> <li class="field required text" id="forgot-password-modal-field-email">
<label for="pwd_reset_email">${_("Your E-mail Address")}</label> <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" /> <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> </li>
</ol> </ol>
</fieldset> </fieldset>
......
## mako ## mako
<%namespace name='static' file='static_content.html'/> <%namespace name='static' file='static_content.html'/>
<%! <%include file="${static.get_themed_template_path(relative_path='theme-header.html', default_path='navigation.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
...@@ -7,7 +7,6 @@ from django.conf import settings ...@@ -7,7 +7,6 @@ from django.conf import settings
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from xmodule.tabs import CourseTabList from xmodule.tabs import CourseTabList
from microsite_configuration import microsite
%> %>
% if settings.FEATURES.get('ENABLE_FEEDBACK_SUBMISSION', False): % if settings.FEATURES.get('ENABLE_FEEDBACK_SUBMISSION', False):
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<%! <%!
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from courseware.courses import get_studio_url 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 from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition
%> %>
......
<%namespace name='static' file='/static_content.html'/>
<%page args="section_data"/> <%page args="section_data"/>
<%! <%!
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from courseware.courses import get_studio_url 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 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_ ...@@ -83,7 +83,7 @@ from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_
<div class="request-response-error"></div> <div class="request-response-error"></div>
</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" /> <hr class="divider" />
<div class="auto_enroll auto_enroll_csv"> <div class="auto_enroll auto_enroll_csv">
......
...@@ -6,7 +6,6 @@ from django.core.urlresolvers import reverse ...@@ -6,7 +6,6 @@ from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
import third_party_auth import third_party_auth
from third_party_auth import provider, pipeline 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> <%block name="pagetitle">${_("Log into your {platform_name} Account").format(platform_name=platform_name)}</%block>
...@@ -233,8 +232,8 @@ from microsite_configuration import microsite ...@@ -233,8 +232,8 @@ from microsite_configuration import microsite
<aside role="complementary"> <aside role="complementary">
<% <%
# allow for microsite overrides on the registration sidebars, otherwise default to pre-existing ones # allow for theming overrides on the registration sidebars, otherwise default to pre-existing ones
sidebar_file = microsite.get_template_path('login-sidebar.html') sidebar_file = static.get_template_path('login-sidebar.html')
%> %>
<%include file="${sidebar_file}" /> <%include file="${sidebar_file}" />
......
...@@ -5,7 +5,6 @@ from django.core.urlresolvers import reverse ...@@ -5,7 +5,6 @@ from django.core.urlresolvers import reverse
from django.utils.http import urlquote_plus from django.utils.http import urlquote_plus
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.utils.translation import get_language_bidi from django.utils.translation import get_language_bidi
from microsite_configuration import microsite
from branding import api as branding_api from branding import api as branding_api
%> %>
<!DOCTYPE html> <!DOCTYPE html>
...@@ -23,9 +22,6 @@ from branding import api as branding_api ...@@ -23,9 +22,6 @@ from branding import api as branding_api
<%def name="theme_enabled()"> <%def name="theme_enabled()">
<% return settings.FEATURES.get("USE_CUSTOM_THEME", False) %> <% return settings.FEATURES.get("USE_CUSTOM_THEME", False) %>
</%def> </%def>
<%def name="is_microsite()">
<% return microsite.is_request_in_microsite() %>
</%def>
<%def name="stanford_theme_enabled()"> <%def name="stanford_theme_enabled()">
<% <%
...@@ -57,7 +53,7 @@ from branding import api as branding_api ...@@ -57,7 +53,7 @@ from branding import api as branding_api
<script type="text/javascript" src="/i18n.js"></script> <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'/> <%static:css group='style-vendor'/>
## We could do <%static:css group='style-main'/>, but that's only useful ## We could do <%static:css group='style-main'/>, but that's only useful
...@@ -96,7 +92,7 @@ from branding import api as branding_api ...@@ -96,7 +92,7 @@ from branding import api as branding_api
<%block name="headextra"/> <%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/optimizely.html" />
<%include file="widgets/segment-io.html" /> <%include file="widgets/segment-io.html" />
...@@ -104,7 +100,7 @@ from branding import api as branding_api ...@@ -104,7 +100,7 @@ from branding import api as branding_api
<meta name="path_prefix" content="${EDX_ROOT_URL}"> <meta name="path_prefix" content="${EDX_ROOT_URL}">
<meta name="google-site-verification" content="_mipQ4AtZQDNmbtOkwehQDOgCxUUV2fb_C0b6wbiRHY" /> <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: % if ga_acct:
<script type="text/javascript"> <script type="text/javascript">
var _gaq = _gaq || []; var _gaq = _gaq || [];
...@@ -122,7 +118,7 @@ from branding import api as branding_api ...@@ -122,7 +118,7 @@ from branding import api as branding_api
</head> </head>
<body class="${static.dir_rtl()} <%block name='bodyclass'/> lang_${LANGUAGE_CODE}"> <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> <div id="page-prompt"></div>
% if not disable_window_wrap: % if not disable_window_wrap:
<div class="window-wrap" dir="${static.dir_rtl()}"> <div class="window-wrap" dir="${static.dir_rtl()}">
...@@ -130,7 +126,7 @@ from branding import api as branding_api ...@@ -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> <a class="nav-skip" href="<%block name="nav_skip">#content</%block>">${_("Skip to main content")}</a>
% if not disable_header: % if not disable_header:
<%include file="${microsite.get_template_path('header.html')}" /> <%include file="${static.get_template_path('header.html')}" />
% endif % endif
<div class="content-wrapper" id="content"> <div class="content-wrapper" id="content">
...@@ -150,7 +146,7 @@ from branding import api as branding_api ...@@ -150,7 +146,7 @@ from branding import api as branding_api
<%include file="widgets/segment-io-footer.html" /> <%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/vendor/noreferrer.js')}" charset="utf-8"></script>
<script type="text/javascript" src="${static.url('js/utils/navigation.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> </body>
</html> </html>
......
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from microsite_configuration import microsite
# App that handles subdomain specific branding # App that handles subdomain specific branding
from branding import api as branding_api from branding import api as branding_api
# app that handles site status messages # app that handles site status messages
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from microsite_configuration import microsite
from lms.djangoapps.ccx.overrides import get_current_ccx from lms.djangoapps.ccx.overrides import get_current_ccx
# App that handles subdomain specific branding # App that handles subdomain specific branding
...@@ -96,7 +95,7 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -96,7 +95,7 @@ site_status_msg = get_site_status_msg(course_id)
</ul> </ul>
</li> </li>
</ol> </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"> <ol class="user">
<li class="primary"> <li class="primary">
<a class="shopping-cart" href="${reverse('shoppingcart.views.show_cart')}"> <a class="shopping-cart" href="${reverse('shoppingcart.views.show_cart')}">
...@@ -108,7 +107,7 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -108,7 +107,7 @@ site_status_msg = get_site_status_msg(course_id)
% else: % else:
<ol class="left nav-global"> <ol class="left nav-global">
<%block name="navigation_global_links"> <%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"> <li class="nav-global-01">
<a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a> <a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a>
</li> </li>
......
...@@ -6,7 +6,6 @@ from django.utils.translation import ugettext as _ ...@@ -6,7 +6,6 @@ from django.utils.translation import ugettext as _
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils import html from django.utils import html
from django_countries import countries from django_countries import countries
from microsite_configuration import microsite
from student.models import UserProfile from student.models import UserProfile
from datetime import date from datetime import date
import third_party_auth import third_party_auth
...@@ -112,8 +111,8 @@ import calendar ...@@ -112,8 +111,8 @@ import calendar
<section role="main" class="content"> <section role="main" class="content">
<form role="form" id="register-form" method="post" data-remote="true" action="/create_account" novalidate> <form role="form" id="register-form" method="post" data-remote="true" action="/create_account" novalidate>
<% <%
# allow for microsite override on the registration form # allow for theming override on the registration form
registration_form = microsite.get_template_path('register-form.html') registration_form = static.get_template_path('register-form.html')
%> %>
<%include file="${registration_form}" /> <%include file="${registration_form}" />
</form> </form>
...@@ -122,8 +121,8 @@ import calendar ...@@ -122,8 +121,8 @@ import calendar
<aside role="complementary"> <aside role="complementary">
<% <%
# allow for microsite overrides on the registration sidebars, otherwise default to pre-existing ones # allow for theming overrides on the registration sidebars, otherwise default to pre-existing ones
sidebar_file = microsite.get_template_path('register-sidebar.html') sidebar_file = static.get_template_path('register-sidebar.html')
%> %>
<%include file="${sidebar_file}" /> <%include file="${sidebar_file}" />
......
<%namespace name='static' file='/static_content.html'/>
<%inherit file="shopping_cart_flow.html" /> <%inherit file="shopping_cart_flow.html" />
<%! <%!
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.utils.translation import ungettext from django.utils.translation import ungettext
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from markupsafe import escape from markupsafe import escape
from microsite_configuration import microsite
from openedx.core.lib.courses import course_image_url from openedx.core.lib.courses import course_image_url
%> %>
...@@ -377,8 +378,8 @@ 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> <span class="pull-right">${_("Total")}: <b> ${currency_symbol}${"{0:0.2f}".format(order.total_cost)} ${currency.upper()}</b></span>
</div> </div>
</div> </div>
## Allow for a microsite to be able to insert additional text at the bottom of the page ## Allow for a theming to be able to insert additional text at the bottom of the page
<%include file="${microsite.get_template_path('receipt_custom_pane.html')}" /> <%include file="${static.get_template_path('receipt_custom_pane.html')}" />
</section> </section>
</div> </div>
</%block> </%block>
## 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 ## specific HTML into the lower pane of the receipt.html page
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
<%! <%!
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.conf import settings from django.conf import settings
from microsite_configuration import microsite
%> %>
<%block name="pagetitle">${_("Shopping cart")}</%block> <%block name="pagetitle">${_("Shopping cart")}</%block>
<%block name="headextra"> <%block name="headextra">
...@@ -13,7 +12,7 @@ from microsite_configuration import microsite ...@@ -13,7 +12,7 @@ from microsite_configuration import microsite
<div class="container"> <div class="container">
<header class="wrapper confirm-enrollment shopping-cart"> <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: % if shoppingcart_items:
<ol class="steps"> <ol class="steps">
<li <%block name="review_highlight"/>>${_('Review')}</li> <li <%block name="review_highlight"/>>${_('Review')}</li>
......
...@@ -3,7 +3,6 @@ import json ...@@ -3,7 +3,6 @@ import json
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.conf import settings from django.conf import settings
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from microsite_configuration import microsite
%> %>
<!--<%namespace name='static' file='/static_content.html'/>--> <!--<%namespace name='static' file='/static_content.html'/>-->
...@@ -30,7 +29,7 @@ from microsite_configuration import microsite ...@@ -30,7 +29,7 @@ from microsite_configuration import microsite
<%static:require_module module_name="js/student_account/views/account_settings_factory" class_name="AccountSettingsFactory"> <%static:require_module module_name="js/student_account/views/account_settings_factory" class_name="AccountSettingsFactory">
var fieldsData = ${ json.dumps(fields) }; var fieldsData = ${ json.dumps(fields) };
var authData = ${ json.dumps(auth) }; 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( AccountSettingsFactory(
fieldsData, authData, '${user_accounts_api_url}', '${user_preferences_api_url}', ${user.id}, platformName fieldsData, authData, '${user_accounts_api_url}', '${user_preferences_api_url}', ${user.id}, platformName
......
## mako ## 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()
%>
## This file only exists as an additional layer of indirection to preserve ## 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 ## (as much as possible). If you are writing your own theme using the
## "comprehensive theming" system, do NOT override this file. You should ## "comprehensive theming" system, do NOT override this file. You should
## override "footer.html" instead. ## override "footer.html" instead.
% if theme_enabled and not is_microsite: <%include file="${static.get_themed_template_path(relative_path='theme-footer.html', default_path='footer.html')}" />
<%include file="theme-footer.html" />
% else:
<%include file="${microsite.get_template_path('footer.html')}" />
% endif
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
""" """
from microsite_configuration import microsite from microsite_configuration import microsite
from microsite_configuration import page_title_breadcrumbs from microsite_configuration import page_title_breadcrumbs
from django.conf import settings
def get_page_title_breadcrumbs(*args): def get_page_title_breadcrumbs(*args):
...@@ -17,3 +18,37 @@ def get_value(val_name, default=None, **kwargs): ...@@ -17,3 +18,37 @@ def get_value(val_name, default=None, **kwargs):
This is a proxy function to hide microsite_configuration behind comprehensive theming. This is a proxy function to hide microsite_configuration behind comprehensive theming.
""" """
return microsite.get_value(val_name, default=default, **kwargs) 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)
...@@ -5,8 +5,6 @@ ...@@ -5,8 +5,6 @@
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from microsite_configuration import microsite
# App that handles subdomain specific branding # App that handles subdomain specific branding
import branding import branding
# app that handles site status messages # app that handles site status messages
......
...@@ -10,7 +10,6 @@ import branding ...@@ -10,7 +10,6 @@ import branding
# app that handles site status messages # app that handles site status messages
from status.status import get_site_status_msg from status.status import get_site_status_msg
from microsite_configuration import microsite
from ccx.overrides import get_current_ccx from ccx.overrides import get_current_ccx
%> %>
...@@ -109,7 +108,7 @@ site_status_msg = get_site_status_msg(course_id) ...@@ -109,7 +108,7 @@ site_status_msg = get_site_status_msg(course_id)
% else: % else:
<ol class="left nav-global"> <ol class="left nav-global">
<%block name="navigation_global_links"> <%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"> <li class="nav-global-01">
<a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a> <a href="${marketing_link('HOW_IT_WORKS')}">${_("How it Works")}</a>
</li> </li>
......
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