Serve branded footer JSON/HTML/CSS/JS from an API endpoint in the branding app. Refactor OpenEdX and EdX.org footer templates to use the Python version of the API, ensuring that the API values are consistent with the footer included in main.html. Detailed changes: * Added footer API end-point to the branding app. * Footer API allows the language to be set with querystring parameters. * Footer API allows showing/hiding of the OpenEdX logo using querystring parameters. * Deprecate ENABLE_FOOTER_V3 in favor of the branding API configuration flag. * Move no referrer script into main.html from the edx footer template. * Rename rwd_header_footer.js to rwd_header.js * Cache API responses. Authors: Awais Qureshi, Aamir Khan, Will Daly
221 lines
6.7 KiB
HTML
221 lines
6.7 KiB
HTML
## coding=utf-8
|
|
<%namespace name='static' file='static_content.html'/>
|
|
<%!
|
|
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 microsite_configuration import page_title_breadcrumbs
|
|
from branding import api as branding_api
|
|
|
|
dir_rtl = 'rtl' if get_language_bidi() else 'ltr'
|
|
%>
|
|
<!DOCTYPE html>
|
|
<!--[if lte IE 9]><html class="ie ie9 lte9" lang="${LANGUAGE_CODE}"><![endif]-->
|
|
<!--[if !IE]><!--><html lang="${LANGUAGE_CODE}"><!--<![endif]-->
|
|
<head dir="${dir_rtl}">
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
% if responsive:
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
% endif
|
|
|
|
## Define a couple of helper functions to make life easier when
|
|
## embedding theme conditionals into templates. All inheriting
|
|
## templates have access to these functions, and we can import these
|
|
## into non-inheriting templates via the %namespace tag.
|
|
<%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()">
|
|
<%
|
|
if not theme_enabled():
|
|
return False
|
|
|
|
return getattr(settings, "THEME_NAME", None) == "stanford"
|
|
%>
|
|
</%def>
|
|
|
|
## this needs to be here to prevent the title from mysteriously appearing in the body, in one case
|
|
<%def name="pagetitle()" />
|
|
<%block name="title">
|
|
<title>
|
|
${page_title_breadcrumbs(self.pagetitle())}
|
|
</title>
|
|
</%block>
|
|
|
|
% if not allow_iframing:
|
|
<script type="text/javascript">
|
|
/* immediately break out of an iframe if coming from the marketing website */
|
|
(function(window) {
|
|
if (window.location !== window.top.location) {
|
|
window.top.location = window.location;
|
|
}
|
|
})(this);
|
|
</script>
|
|
% endif
|
|
|
|
<script type="text/javascript" src="/jsi18n/"></script>
|
|
|
|
<link rel="icon" type="image/x-icon" href="${static.url(microsite.get_value('favicon_path', settings.FAVICON_PATH))}" />
|
|
|
|
<%static:css group='style-vendor'/>
|
|
<%static:css group='style-main'/>
|
|
|
|
% if disable_courseware_js:
|
|
<%static:js group='base_vendor'/>
|
|
% else:
|
|
<%static:js group='main_vendor'/>
|
|
% endif
|
|
|
|
<script>
|
|
window.baseUrl = "${settings.STATIC_URL}";
|
|
(function (require) {
|
|
% if settings.DEBUG is True:
|
|
## Using what amounts to a random number in the Development environment for cache-busting
|
|
var urlArgs = "bust=" + (new Date()).getTime();
|
|
% else:
|
|
var urlArgs = "v=${settings.EDX_PLATFORM_REVISION}";
|
|
% endif
|
|
require.config({
|
|
baseUrl: baseUrl,
|
|
urlArgs: urlArgs
|
|
});
|
|
}).call(this, require || RequireJS.require);
|
|
</script>
|
|
<script type="text/javascript" src="${static.url("require-config-lms.js")}"></script>
|
|
|
|
<%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 = None
|
|
|
|
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" />
|
|
|
|
<meta name="path_prefix" content="${EDX_ROOT_URL}">
|
|
<meta name="google-site-verification" content="_mipQ4AtZQDNmbtOkwehQDOgCxUUV2fb_C0b6wbiRHY" />
|
|
|
|
<%include file="${google_analytics_file}" />
|
|
|
|
% if style_overrides_file:
|
|
<link rel="stylesheet" type="text/css" href="${static.url(style_overrides_file)}" />
|
|
% endif
|
|
|
|
</head>
|
|
|
|
<body class="${dir_rtl} <%block name='bodyclass'/> lang_${LANGUAGE_CODE}">
|
|
<div class="window-wrap" dir="${dir_rtl}">
|
|
<a class="nav-skip" href="<%block name="nav_skip">#content</%block>">${_("Skip to main content")}</a>
|
|
|
|
% if not disable_header:
|
|
<%include file="${header_file}" />
|
|
% endif
|
|
|
|
<div class="content-wrapper" id="content">
|
|
${self.body()}
|
|
<%block name="bodyextra"/>
|
|
</div>
|
|
|
|
% 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():
|
|
## TODO (ECOM-1339): Remove this check to permanently enable the V3 footer.
|
|
% if branding_api.is_enabled():
|
|
<%include file="footer-edx-v3.html" />
|
|
% else:
|
|
<%include file="footer-edx-v2.html" />
|
|
% endif
|
|
% else:
|
|
<%include file="${microsite.get_template_path('footer.html')}" />
|
|
% endif
|
|
</%block>
|
|
% endif
|
|
|
|
</div>
|
|
|
|
% if not disable_courseware_js:
|
|
<%static:js group='application'/>
|
|
<%static:js group='module-js'/>
|
|
% endif
|
|
|
|
<%block name="js_extra"/>
|
|
<script type="text/javascript" src="${static.url('js/vendor/noreferrer.js')}" charset="utf-8"></script>
|
|
</body>
|
|
</html>
|
|
|
|
<%def name="login_query()">${
|
|
u"?course_id={0}&enrollment_action={1}{course_mode}{email_opt_in}".format(
|
|
urlquote_plus(course_id),
|
|
urlquote_plus(enrollment_action),
|
|
course_mode=(
|
|
u"&course_mode=" + urlquote_plus(course_mode)
|
|
if course_mode else ""
|
|
),
|
|
email_opt_in=(
|
|
u"&email_opt_in=" + urlquote_plus(email_opt_in)
|
|
if email_opt_in else ""
|
|
)
|
|
) if course_id and enrollment_action else ""
|
|
}</%def>
|
|
|
|
<!-- Performance beacon for onload times -->
|
|
% if settings.FEATURES.get('ENABLE_ONLOAD_BEACON', False):
|
|
<script>
|
|
(function () {
|
|
var sample_rate = ${settings.ONLOAD_BEACON_SAMPLE_RATE};
|
|
var roll = Math.floor(Math.random() * 100)/100;
|
|
var onloadBeaconSent = false;
|
|
|
|
if(roll < sample_rate){
|
|
$(window).load(function() {
|
|
setTimeout(function(){
|
|
var t = window.performance.timing;
|
|
|
|
var data = {
|
|
event: "onload",
|
|
value: t.loadEventEnd - t.navigationStart,
|
|
page: window.location.href,
|
|
};
|
|
|
|
if (!onloadBeaconSent) {
|
|
$.ajax({method: "POST", url: "/performance", data: data});
|
|
}
|
|
onloadBeaconSent = true;
|
|
}, 0);
|
|
});
|
|
}
|
|
}());
|
|
</script>
|
|
% endif
|