diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e5ddfa222a..65ed2519be 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,10 @@ These are notable changes in edx-platform. This is a rolling list of changes, in roughly chronological order, most recent first. Add your entries at or near the top. Include a label indicating the component affected. +LMS: Improved accessibility of parts of forum navigation sidebar. + +LMS: enhanced accessibility labeling and aria support for the discussion forum new post dropdown as well as response and comment area labeling. + LMS: enhanced shib support, including detection of linked shib account at login page and support for the ?next= GET parameter. diff --git a/cms/envs/common.py b/cms/envs/common.py index c79cfe7aa7..7f2559eece 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -257,6 +257,7 @@ PIPELINE_JS = { 'js/src/utility.js', 'js/models/settings/course_grading_policy.js', 'js/models/asset.js', 'js/models/assets.js', + 'js/views/assets.js', 'js/views/assets_view.js', 'js/views/asset_view.js'], 'output_filename': 'js/cms-application.js', 'test_order': 0 diff --git a/cms/static/js/views/assets.js b/cms/static/js/views/assets.js new file mode 100644 index 0000000000..572af04df7 --- /dev/null +++ b/cms/static/js/views/assets.js @@ -0,0 +1,90 @@ +// This code is temporarily moved out of asset_index.html +// to fix AWS pipelining issues. We can move it back after RequireJS is integrated. +$(document).ready(function() { + $('.uploads .upload-button').bind('click', showUploadModal); + $('.upload-modal .close-button').bind('click', hideModal); + $('.upload-modal .choose-file-button').bind('click', showFileSelectionMenu); +}); + +var showUploadModal = function (e) { + e.preventDefault(); + resetUploadModal(); + // $modal has to be global for hideModal to work. + $modal = $('.upload-modal').show(); + $('.file-input').bind('change', startUpload); + $('.upload-modal .file-chooser').fileupload({ + dataType: 'json', + type: 'POST', + maxChunkSize: 100 * 1000 * 1000, // 100 MB + autoUpload: true, + progressall: function(e, data) { + var percentComplete = parseInt((100 * data.loaded) / data.total, 10); + showUploadFeedback(e, percentComplete); + }, + maxFileSize: 100 * 1000 * 1000, // 100 MB + maxNumberofFiles: 100, + add: function(e, data) { + data.process().done(function () { + data.submit(); + }); + }, + done: function(e, data) { + displayFinishedUpload(data.result); + } + + }); + + $modalCover.show(); +}; + +var showFileSelectionMenu = function(e) { + e.preventDefault(); + $('.file-input').click(); +}; + +var startUpload = function (e) { + var file = e.target.value; + + $('.upload-modal h1').html(gettext('Uploading…')); + $('.upload-modal .file-name').html(file.substring(file.lastIndexOf("\\") + 1)); + $('.upload-modal .choose-file-button').hide(); + $('.upload-modal .progress-bar').removeClass('loaded').show(); +}; + +var resetUploadModal = function () { + $('.file-input').unbind('change', startUpload); + + // Reset modal so it no longer displays information about previously + // completed uploads. + var percentVal = '0%'; + $('.upload-modal .progress-fill').width(percentVal); + $('.upload-modal .progress-fill').html(percentVal); + $('.upload-modal .progress-bar').hide(); + + $('.upload-modal .file-name').show(); + $('.upload-modal .file-name').html(''); + $('.upload-modal .choose-file-button').html(gettext('Choose File')); + $('.upload-modal .embeddable-xml-input').val(''); + $('.upload-modal .embeddable').hide(); +}; + +var showUploadFeedback = function (event, percentComplete) { + var percentVal = percentComplete + '%'; + $('.upload-modal .progress-fill').width(percentVal); + $('.upload-modal .progress-fill').html(percentVal); +}; + +var displayFinishedUpload = function (resp) { + var asset = resp.asset; + + $('.upload-modal h1').html(gettext('Upload New File')); + $('.upload-modal .embeddable-xml-input').val(asset.portable_url); + $('.upload-modal .embeddable').show(); + $('.upload-modal .file-name').hide(); + $('.upload-modal .progress-fill').html(resp.msg); + $('.upload-modal .choose-file-button').html(gettext('Load Another File')).show(); + $('.upload-modal .progress-fill').width('100%'); + + // TODO remove setting on window object after RequireJS. + window.assetsView.addAsset(new CMS.Models.Asset(asset)); +}; diff --git a/cms/templates/asset_index.html b/cms/templates/asset_index.html index bcab53b36f..790266fb30 100644 --- a/cms/templates/asset_index.html +++ b/cms/templates/asset_index.html @@ -20,96 +20,8 @@ %block> diff --git a/cms/templates/component.html b/cms/templates/component.html index a6deacb486..2412cd74d4 100644 --- a/cms/templates/component.html +++ b/cms/templates/component.html @@ -11,7 +11,6 @@