ECOM-1339 Branding API footer

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
This commit is contained in:
Will Daly
2015-05-11 16:01:35 +05:00
parent 947354fb89
commit 6af5fc1452
41 changed files with 1254 additions and 487 deletions

View File

@@ -7,18 +7,6 @@ var edx = edx || {};
var _fn = {
el: '#footer-edx-v3',
init: function() {
_fn.$el = _fn.$el || $( _fn.el );
/**
* Only continue if the expected element
* to add footer to is in the DOM
*/
if ( _fn.$el.length > -1 ) {
_fn.footer.get();
}
},
analytics: {
init: function() {
_fn.$el = _fn.$el || $( _fn.el );
@@ -27,7 +15,7 @@ var edx = edx || {};
* Only continue if the expected element
* to add footer to is in the DOM
*/
if ( _fn.$el.length > -1 ) {
if ( _fn.$el.length ) {
_fn.analytics.eventListener();
}
},
@@ -50,31 +38,12 @@ var edx = edx || {};
}
}
},
footer: {
get: function() {
$.ajax({
url: 'https://courses.edx.org/api/v1/branding/footer',
type: 'GET',
dataType: 'html',
success: function( data ) {
_fn.footer.render( data );
}
});
},
render: function( html ) {
_fn.$el.html( html );
}
}
};
return {
load: _fn.init,
analytics: _fn.analytics.init
};
})();
// Initialize the analytics events
edx.footer.analytics();
})(jQuery);

View File

@@ -0,0 +1,19 @@
// ----------------------------------------
// LMS edx.org Footer: Shared Build Compile
// base - utilities
@import 'base/variables';
@import 'base/mixins';
footer#footer-edx-v3 {
@import 'base/extends';
// base - starter
@import 'base/base';
}
// base - elements
@import 'elements/typography';
// shared - platform
@import 'shared/footer-edx';

View File

@@ -21,7 +21,7 @@
@import 'shared/fields';
@import 'shared/forms';
@import 'shared/footer';
@import 'shared/footer-edx'; // Replaces most of the footer partial. Will update footer to remove edx specific styles once feature flag removed.
@import 'shared/footer-edx';
@import 'shared/header';
@import 'shared/course_object';
@import 'shared/course_filter';

View File

@@ -0,0 +1,7 @@
// Variables for LMS (left-to-right)
// ==================================
// Neat
// ==================================
// Sets the default layout direction of the grid.
$default-layout-direction: LTR !global;

View File

@@ -0,0 +1,7 @@
// Variables for LMS (right-to-left)
// ==================================
// Neat
// ==================================
// Sets the default layout direction of the grid.
$default-layout-direction: RTL !global;

View File

@@ -0,0 +1,10 @@
// Footer for edx.org (right-to-left)
// ==================================
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
@import 'vendor/bi-app/bi-app-rtl'; // set the layout for right to left languages
@import 'base/variables-rtl';
// Import shared build for the edx.org footer
@import 'build-footer-edx'

View File

@@ -0,0 +1,10 @@
// Footer for edx.org (left-to-right)
// ==================================
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
@import 'vendor/bi-app/bi-app-ltr'; // set the layout for left to right languages
@import 'base/variables-ltr';
// Import shared build for the edx.org footer
@import 'build-footer-edx'

View File

@@ -1,14 +1,9 @@
## Note: This Sass infrastructure is repeated in application-extend1 and application-extend2, but needed in order to address an IE9 rule limit within CSS - http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/10164546.aspx
// lms - css application architecture
// ====================
// Footer for OpenEdX (right-to-left)
// ==================================
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
@import 'vendor/bi-app/bi-app-rtl'; // set the layout for left to right languages
// BASE *default edX offerings*
// ====================
@import 'vendor/bi-app/bi-app-rtl'; // set the layout for right to left languages
// base - utilities
@import 'base/variables';
@@ -27,19 +22,14 @@
@import '${env.get('THEME_NAME')}';
% endif
// base - assets
@import 'base/font_face';
footer#footer-edx-v3 {
footer#footer-openedx {
@import 'base/reset';
@import 'base/extends';
// base - starter
@import 'base/base';
}
// base - elements
@import 'elements/typography';
// shared - platform
@import 'shared/footer-edx';
@import 'shared/footer';

View File

@@ -1,15 +1,10 @@
## Note: This Sass infrastructure is repeated in application-extend1 and application-extend2, but needed in order to address an IE9 rule limit within CSS - http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/10164546.aspx
// lms - css application architecture
// ====================
// Footer for OpenEdX (left-to-right)
// ==================================
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
@import 'vendor/bi-app/bi-app-ltr'; // set the layout for left to right languages
// BASE *default edX offerings*
// ====================
// base - utilities
@import 'base/variables';
@import 'base/mixins';
@@ -27,19 +22,14 @@
@import '${env.get('THEME_NAME')}';
% endif
// base - assets
@import 'base/font_face';
footer#footer-edx-v3 {
footer#footer-openedx {
@import 'base/reset';
@import 'base/extends';
// base - starter
@import 'base/base';
}
// base - elements
@import 'elements/typography';
// shared - platform
@import 'shared/footer-edx';
@import 'shared/footer';

View File

@@ -4,6 +4,7 @@
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
@import 'vendor/bi-app/bi-app-rtl'; // set the layout for right to left languages
@import 'base/variables-rtl';
// BASE *default edX offerings*
// ====================

View File

@@ -4,6 +4,7 @@
// libs and resets *do not edit*
@import 'bourbon/bourbon'; // lib - bourbon
@import 'vendor/bi-app/bi-app-ltr'; // set the layout for left to right languages
@import 'base/variables-ltr';
// BASE *default edX offerings*
// ====================

View File

@@ -80,7 +80,7 @@ footer#footer-edx-v3 {
margin-bottom: 30px;
}
.sm-link {
a.sm-link {
@include float(left);
@include margin(0, 0, 10px, 12px);
@include font-size(28);

View File

@@ -10,7 +10,7 @@
background: $footer-bg;
clear: both;
footer {
footer#footer-openedx {
@include clearfix();
@include box-sizing(border-box);
max-width: grid-width(12);
@@ -286,6 +286,8 @@ $edx-footer-bg-color: rgb(252,252,252);
}
}
// TODO (ECOM-1339): Remove the "new" (v2) footer once the v3 footer
// is permanently enabled.
.edx-footer-new {
background: $edx-footer-bg-color;