Commit 2b7866bf by Jeremy Bowman Committed by GitHub

Merge pull request #12886 from edx/release-2016-06-28-conflict

Merge release into master
parents f22d6739 225768ac
...@@ -620,7 +620,7 @@ PIPELINE_JS = { ...@@ -620,7 +620,7 @@ PIPELINE_JS = {
'source_filenames': ( 'source_filenames': (
rooted_glob(COMMON_ROOT / 'static/', 'xmodule/descriptors/js/*.js') + rooted_glob(COMMON_ROOT / 'static/', 'xmodule/descriptors/js/*.js') +
rooted_glob(COMMON_ROOT / 'static/', 'xmodule/modules/js/*.js') + rooted_glob(COMMON_ROOT / 'static/', 'xmodule/modules/js/*.js') +
rooted_glob(COMMON_ROOT / 'static/', 'coffee/src/discussion/*.js') rooted_glob(COMMON_ROOT / 'static/', 'common/js/discussion/*.js')
), ),
'output_filename': 'js/cms-modules.js', 'output_filename': 'js/cms-modules.js',
'test_order': 1 'test_order': 1
......
...@@ -535,6 +535,8 @@ ...@@ -535,6 +535,8 @@
.speed-option, .speed-option,
.control-lang { .control-lang {
@include border-left($baseline/10 solid rgb(14, 166, 236));
font-weight: $font-bold;
color: rgb(14, 166, 236); // UXPL primary accent color: rgb(14, 166, 236); // UXPL primary accent
} }
} }
......
...@@ -55,8 +55,9 @@ ...@@ -55,8 +55,9 @@
</div> </div>
</section> </section>
</article> </article>
<div class="subtitles">
<ol class="subtitles"><li></li></ol> <ol class="subtitles-menu"><li></li></ol>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -108,7 +109,9 @@ ...@@ -108,7 +109,9 @@
</section> </section>
</article> </article>
<ol class="subtitles"><li></li></ol> <div class="subtitles">
<ol class="subtitles-menu"><li></li></ol>
</div>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -20,12 +20,10 @@ var options = { ...@@ -20,12 +20,10 @@ var options = {
libraryFilesToInclude: [ libraryFilesToInclude: [
{pattern: 'common_static/js/vendor/requirejs/require.js', included: true}, {pattern: 'common_static/js/vendor/requirejs/require.js', included: true},
{pattern: 'RequireJS-namespace-undefine.js', included: true}, {pattern: 'RequireJS-namespace-undefine.js', included: true},
{pattern: 'spec/main_requirejs.js', included: true},
{pattern: 'common_static/coffee/src/ajax_prefix.js', included: true}, {pattern: 'common_static/coffee/src/ajax_prefix.js', included: true},
{pattern: 'common_static/common/js/vendor/underscore.js', included: true}, {pattern: 'common_static/common/js/vendor/underscore.js', included: true},
{pattern: 'common_static/common/js/vendor/backbone.js', included: true}, {pattern: 'common_static/common/js/vendor/backbone.js', included: true},
{pattern: 'common_static/edx-ui-toolkit/js/utils/global-loader.js', included: true},
{pattern: 'common_static/js/vendor/CodeMirror/codemirror.js', included: true}, {pattern: 'common_static/js/vendor/CodeMirror/codemirror.js', included: true},
{pattern: 'common_static/js/vendor/draggabilly.js'}, {pattern: 'common_static/js/vendor/draggabilly.js'},
{pattern: 'common_static/common/js/vendor/jquery.js', included: true}, {pattern: 'common_static/common/js/vendor/jquery.js', included: true},
...@@ -50,11 +48,14 @@ var options = { ...@@ -50,11 +48,14 @@ var options = {
{pattern: 'common_static/js/vendor/jasmine-imagediff.js', included: true}, {pattern: 'common_static/js/vendor/jasmine-imagediff.js', included: true},
{pattern: 'common_static/common/js/spec_helpers/jasmine-waituntil.js', included: true}, {pattern: 'common_static/common/js/spec_helpers/jasmine-waituntil.js', included: true},
{pattern: 'common_static/common/js/spec_helpers/jasmine-extensions.js', included: true}, {pattern: 'common_static/common/js/spec_helpers/jasmine-extensions.js', included: true},
{pattern: 'common_static/js/vendor/sinon-1.17.0.js', included: true} {pattern: 'common_static/js/vendor/sinon-1.17.0.js', included: true},
{pattern: 'spec/main_requirejs.js', included: true},
], ],
libraryFiles: [ libraryFiles: [
{pattern: 'common_static/edx-pattern-library/js/**/*.js'} {pattern: 'common_static/edx-pattern-library/js/**/*.js'},
{pattern: 'common_static/edx-ui-toolkit/js/**/*.js'}
], ],
// Make sure the patterns in sourceFiles and specFiles do not match the same file. // Make sure the patterns in sourceFiles and specFiles do not match the same file.
......
(function(requirejs) { (function(requirejs, define) {
'use strict';
// We do not wish to bundle common libraries (that may also be used by non-RequireJS code on the page
// into the optimized files. Therefore load these libraries through script tags and explicitly define them.
// Note that when the optimizer executes this code, window will not be defined.
if (window) {
var defineDependency = function (globalName, name, noShim) {
var getGlobalValue = function(name) {
var globalNamePath = name.split('.'),
result = window,
i;
for (i = 0; i < globalNamePath.length; i++) {
result = result[globalNamePath[i]];
}
return result;
},
globalValue = getGlobalValue(globalName);
if (globalValue) {
if (noShim) {
define(name, {});
}
else {
define(name, [], function() { return globalValue; });
}
}
else {
console.error("Expected library to be included on page, but not found on window object: " + name);
}
};
defineDependency("jQuery", "jquery");
defineDependency("jQuery", "jquery-migrate");
defineDependency("_", "underscore");
}
requirejs.config({ requirejs.config({
baseUrl: '/base/', baseUrl: '/base/',
paths: { paths: {
...@@ -6,7 +38,8 @@ ...@@ -6,7 +38,8 @@
"modernizr": "common_static/edx-pattern-library/js/modernizr-custom", "modernizr": "common_static/edx-pattern-library/js/modernizr-custom",
"afontgarde": "common_static/edx-pattern-library/js/afontgarde", "afontgarde": "common_static/edx-pattern-library/js/afontgarde",
"edxicons": "common_static/edx-pattern-library/js/edx-icons", "edxicons": "common_static/edx-pattern-library/js/edx-icons",
"draggabilly": "common_static/js/vendor/draggabilly" "draggabilly": "common_static/js/vendor/draggabilly",
'edx-ui-toolkit': 'common_static/edx-ui-toolkit'
}, },
"moment": { "moment": {
exports: "moment" exports: "moment"
...@@ -18,5 +51,4 @@ ...@@ -18,5 +51,4 @@
exports: "AFontGarde" exports: "AFontGarde"
} }
}); });
}).call(this, RequireJS.requirejs, RequireJS.define);
}).call(this, RequireJS.requirejs);
...@@ -266,6 +266,7 @@ ...@@ -266,6 +266,7 @@
expect($('.closed-captions')).toHaveAttrs({ expect($('.closed-captions')).toHaveAttrs({
'lang': 'de' 'lang': 'de'
}); });
expect(link).toHaveAttr('aria-pressed', 'true');
}); });
it('when clicking on link with current language', function () { it('when clicking on link with current language', function () {
...@@ -284,6 +285,7 @@ ...@@ -284,6 +285,7 @@
expect(state.storage.setItem) expect(state.storage.setItem)
.not.toHaveBeenCalledWith('language', 'en'); .not.toHaveBeenCalledWith('language', 'en');
expect($('.langs-list li.is-active').length).toBe(1); expect($('.langs-list li.is-active').length).toBe(1);
expect(link).toHaveAttr('aria-pressed', 'true');
}); });
it('open the language toggle on hover', function () { it('open the language toggle on hover', function () {
...@@ -413,7 +415,7 @@ ...@@ -413,7 +415,7 @@
}); });
it('show explanation message', function () { it('show explanation message', function () {
expect($('.subtitles-menu li')).toHaveText( expect($('.subtitles .subtitles-menu li')).toHaveText(
'Transcript will be displayed when you start playing the video.' 'Transcript will be displayed when you start playing the video.'
); );
}); });
......
...@@ -203,16 +203,18 @@ ...@@ -203,16 +203,18 @@
describe('onSpeedChange', function () { describe('onSpeedChange', function () {
beforeEach(function () { beforeEach(function () {
state = jasmine.initializePlayer(); state = jasmine.initializePlayer();
$('li[data-speed="1.0"]').addClass('is-active'); $('li[data-speed="1.0"]').addClass('is-active').attr('aria-pressed', 'true');
state.videoSpeedControl.setSpeed(0.75); state.videoSpeedControl.setSpeed(0.75);
}); });
it('set the new speed as active', function () { it('set the new speed as active', function () {
expect($('.video-speeds li[data-speed="1.0"]')) expect($('li[data-speed="1.0"]')).not.toHaveClass('is-active');
.not.toHaveClass('is-active'); expect($('li[data-speed="1.0"] .speed-option').attr('aria-pressed')).not.toEqual('true');
expect($('.video-speeds li[data-speed="0.75"]'))
.toHaveClass('is-active'); expect($('li[data-speed="0.75"]')).toHaveClass('is-active');
expect($('.speeds .value')).toHaveHtml('0.75x'); expect($('li[data-speed="0.75"] .speed-option').attr('aria-pressed')).toEqual('true');
expect($('.speeds .speed-button .value')).toHaveHtml('0.75x');
}); });
}); });
......
(function (requirejs, require, define) { (function (requirejs, require, define) {
"use strict"; "use strict";
define( define(
'video/08_video_speed_control.js', 'video/08_video_speed_control.js', [
['video/00_iterator.js'], 'video/00_iterator.js',
function (Iterator) { 'edx-ui-toolkit/js/utils/html-utils'
], function (Iterator, HtmlUtils) {
/** /**
* Video speed control module. * Video speed control module.
* @exports video/08_video_speed_control.js * @exports video/08_video_speed_control.js
...@@ -95,23 +96,38 @@ function (Iterator) { ...@@ -95,23 +96,38 @@ function (Iterator) {
* Creates any necessary DOM elements, attach them, and set their, * Creates any necessary DOM elements, attach them, and set their,
* initial configuration. * initial configuration.
* @param {array} speeds List of speeds available for the player. * @param {array} speeds List of speeds available for the player.
* @param {string} currentSpeed The current speed set to the player.
*/ */
render: function (speeds) { render: function (speeds, currentSpeed) {
var speedsContainer = this.speedsContainer, var speedsContainer = this.speedsContainer,
reversedSpeeds = speeds.concat().reverse(), reversedSpeeds = speeds.concat().reverse(),
speedsList = $.map(reversedSpeeds, function (speed) { speedsList = $.map(reversedSpeeds, function (speed) {
return [ return HtmlUtils.interpolateHtml(
'<li data-speed="', speed, '">', HtmlUtils.HTML(
'<button class="control speed-option" tabindex="-1">', [
speed, 'x', '<li data-speed="{speed}">',
'</button>', '<button class="control speed-option" tabindex="-1" aria-pressed="false">',
'</li>' '{speed}x',
].join(''); '</button>',
'</li>'
].join('')
),
{
speed: speed
}
).toString();
}); });
speedsContainer.html(speedsList.join('')); HtmlUtils.setHtml(
speedsContainer,
HtmlUtils.HTML(speedsList)
);
this.speedLinks = new Iterator(speedsContainer.find('.speed-option')); this.speedLinks = new Iterator(speedsContainer.find('.speed-option'));
this.state.el.find('.secondary-controls').prepend(this.el); HtmlUtils.prepend(
this.state.el.find('.secondary-controls'),
HtmlUtils.HTML(this.el)
);
this.setActiveSpeed(currentSpeed);
}, },
/** /**
...@@ -216,17 +232,38 @@ function (Iterator) { ...@@ -216,17 +232,38 @@ function (Iterator) {
if (speed !== this.currentSpeed || forceUpdate) { if (speed !== this.currentSpeed || forceUpdate) {
this.speedsContainer this.speedsContainer
.find('li') .find('li')
.removeClass('is-active') .siblings("li[data-speed='" + speed + "']");
.siblings("li[data-speed='" + speed + "']")
.addClass('is-active');
this.speedButton.find('.value').html(speed + 'x'); this.speedButton.find('.value').text(speed + 'x');
this.currentSpeed = speed; this.currentSpeed = speed;
if (!silent) { if (!silent) {
this.el.trigger('speedchange', [speed, this.state.speed]); this.el.trigger('speedchange', [speed, this.state.speed]);
} }
} }
this.resetActiveSpeed();
this.setActiveSpeed(speed);
},
resetActiveSpeed: function() {
var speedOptions = this.speedsContainer.find('li');
$(speedOptions).each(function(index, el) {
$(el).removeClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'false');
});
},
setActiveSpeed: function(speed) {
var speedOption = this.speedsContainer.find('li[data-speed="' + speed + '"]');
speedOption.addClass('is-active')
.find('.speed-option')
.attr('aria-pressed', 'true');
this.speedButton.attr('title', gettext('Video speed: ') + speed + 'x');
}, },
/** /**
...@@ -244,10 +281,13 @@ function (Iterator) { ...@@ -244,10 +281,13 @@ function (Iterator) {
* @param {jquery Event} event * @param {jquery Event} event
*/ */
clickLinkHandler: function (event) { clickLinkHandler: function (event) {
var speed = $(event.currentTarget).parent().data('speed'); var el = $(event.currentTarget).parent(),
speed = $(el).data('speed');
this.closeMenu();
this.resetActiveSpeed();
this.setActiveSpeed(speed);
this.state.videoCommands.execute('speed', speed); this.state.videoCommands.execute('speed', speed);
this.closeMenu(true);
return false; return false;
}, },
......
...@@ -395,6 +395,12 @@ class BlockStructureBlockData(BlockStructure): ...@@ -395,6 +395,12 @@ class BlockStructureBlockData(BlockStructure):
Subclass of BlockStructure that is responsible for managing block Subclass of BlockStructure that is responsible for managing block
and transformer data. and transformer data.
""" """
# The latest version of the data structure of this class. Incrementally
# update this value whenever the data structure changes. Dependent storage
# layers can then use this value when serializing/deserializing block
# structures, and invalidating any previously cached/stored data.
VERSION = 1
def __init__(self, root_block_usage_key): def __init__(self, root_block_usage_key):
super(BlockStructureBlockData, self).__init__(root_block_usage_key) super(BlockStructureBlockData, self).__init__(root_block_usage_key)
......
...@@ -6,7 +6,7 @@ from logging import getLogger ...@@ -6,7 +6,7 @@ from logging import getLogger
from openedx.core.lib.cache_utils import zpickle, zunpickle from openedx.core.lib.cache_utils import zpickle, zunpickle
from .block_structure import BlockStructureModulestoreData from .block_structure import BlockStructureModulestoreData, BlockStructureBlockData
logger = getLogger(__name__) # pylint: disable=C0103 logger = getLogger(__name__) # pylint: disable=C0103
...@@ -126,4 +126,7 @@ class BlockStructureCache(object): ...@@ -126,4 +126,7 @@ class BlockStructureCache(object):
Returns the cache key to use for storing the block structure Returns the cache key to use for storing the block structure
for the given root_block_usage_key. for the given root_block_usage_key.
""" """
return "root.key." + unicode(root_block_usage_key) return "v{version}.root.key.{root_usage_key}".format(
version=unicode(BlockStructureBlockData.VERSION),
root_usage_key=unicode(root_block_usage_key),
)
...@@ -4,6 +4,7 @@ Tests for manager.py ...@@ -4,6 +4,7 @@ Tests for manager.py
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from unittest import TestCase from unittest import TestCase
from ..block_structure import BlockStructureBlockData
from ..exceptions import UsageKeyNotInBlockStructure from ..exceptions import UsageKeyNotInBlockStructure
from ..manager import BlockStructureManager from ..manager import BlockStructureManager
from ..transformers import BlockStructureTransformers from ..transformers import BlockStructureTransformers
...@@ -154,6 +155,12 @@ class TestBlockStructureManager(TestCase, ChildrenMapTestMixin): ...@@ -154,6 +155,12 @@ class TestBlockStructureManager(TestCase, ChildrenMapTestMixin):
self.collect_and_verify(expect_modulestore_called=True, expect_cache_updated=True) self.collect_and_verify(expect_modulestore_called=True, expect_cache_updated=True)
self.assertEquals(TestTransformer1.collect_call_count, 2) self.assertEquals(TestTransformer1.collect_call_count, 2)
def test_get_collected_version_update(self):
self.collect_and_verify(expect_modulestore_called=True, expect_cache_updated=True)
BlockStructureBlockData.VERSION += 1
self.collect_and_verify(expect_modulestore_called=True, expect_cache_updated=True)
self.assertEquals(TestTransformer1.collect_call_count, 2)
def test_clear(self): def test_clear(self):
self.collect_and_verify(expect_modulestore_called=True, expect_cache_updated=True) self.collect_and_verify(expect_modulestore_called=True, expect_cache_updated=True)
self.bs_manager.clear() self.bs_manager.clear()
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
"javascript-concat-html": 213, "javascript-concat-html": 213,
"javascript-escape": 7, "javascript-escape": 7,
"javascript-interpolate": 49, "javascript-interpolate": 49,
"javascript-jquery-append": 111, "javascript-jquery-append": 104,
"javascript-jquery-html": 279, "javascript-jquery-html": 276,
"javascript-jquery-insert-into-target": 27, "javascript-jquery-insert-into-target": 27,
"javascript-jquery-insertion": 29, "javascript-jquery-insertion": 29,
"javascript-jquery-prepend": 13, "javascript-jquery-prepend": 13,
...@@ -28,5 +28,5 @@ ...@@ -28,5 +28,5 @@
"python-wrap-html": 264, "python-wrap-html": 264,
"underscore-not-escaped": 658 "underscore-not-escaped": 658
}, },
"total": 2245 "total": 2228
} }
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