diff --git a/cms/static/cms/js/build.js b/cms/static/cms/js/build.js
index 7157989f62..a88009f2b3 100644
--- a/cms/static/cms/js/build.js
+++ b/cms/static/cms/js/build.js
@@ -100,7 +100,7 @@
* inlined in the build config.
*/
shim: {
- 'xmodule': {
+ xmodule: {
deps: [
'jquery', 'underscore', 'codemirror', 'tinymce',
'jquery.tinymce', 'jquery.qtip', 'jquery.scrollTo', 'jquery.flot',
diff --git a/cms/static/cms/js/main.js b/cms/static/cms/js/main.js
index 6474659c36..c2570289b0 100644
--- a/cms/static/cms/js/main.js
+++ b/cms/static/cms/js/main.js
@@ -43,8 +43,8 @@
message = JSON.parse(jqXHR.responseText).error;
}
msg = new NotificationView.Error({
- 'title': gettext("Studio's having trouble saving your work"),
- 'message': message
+ title: gettext("Studio's having trouble saving your work"),
+ message: message
});
console.log('Studio AJAX Error', { // eslint-disable-line no-console
url: event.currentTarget.URL,
diff --git a/cms/static/cms/js/xblock/cms.runtime.v1.js b/cms/static/cms/js/xblock/cms.runtime.v1.js
index 6b07ec80e1..ce362ba584 100644
--- a/cms/static/cms/js/xblock/cms.runtime.v1.js
+++ b/cms/static/cms/js/xblock/cms.runtime.v1.js
@@ -1,5 +1,5 @@
define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/modal',
- 'common/js/components/views/feedback_notification'],
+ 'common/js/components/views/feedback_notification'],
function($, Backbone, XBlock, URI, gettext, ModalUtils, NotificationView) {
'use strict';
@@ -149,7 +149,7 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
};
return v1;
- })(XBlock.Runtime.v1);
+ }(XBlock.Runtime.v1));
PreviewRuntime.v1 = (function(_super) {
__extends(v1, _super);
@@ -161,7 +161,7 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
v1.prototype.handlerPrefix = '/preview/xblock';
return v1;
- })(BaseRuntime.v1);
+ }(BaseRuntime.v1));
StudioRuntime.v1 = (function(_super) {
__extends(v1, _super);
@@ -173,7 +173,7 @@ define(['jquery', 'backbone', 'xblock/runtime.v1', 'URI', 'gettext', 'js/utils/m
v1.prototype.handlerPrefix = '/xblock';
return v1;
- })(BaseRuntime.v1);
+ }(BaseRuntime.v1));
// Install the runtime's into the global namespace
window.BaseRuntime = BaseRuntime;
diff --git a/cms/static/js/base.js b/cms/static/js/base.js
index ed2c75f7bf..0e1bcc8724 100644
--- a/cms/static/js/base.js
+++ b/cms/static/js/base.js
@@ -25,8 +25,7 @@ require([
ModuleUtils,
IframeUtils,
DropdownMenuView
- )
-{
+ ) {
var $body;
domReady(function() {
diff --git a/cms/static/js/certificates/collections/certificates.js b/cms/static/js/certificates/collections/certificates.js
index e567514d21..d6ae6c6320 100644
--- a/cms/static/js/certificates/collections/certificates.js
+++ b/cms/static/js/certificates/collections/certificates.js
@@ -31,8 +31,7 @@ function(Backbone, gettext, Certificate) {
// otherwise return empty array
if (typeof certificate_info === 'object') {
return_array = certificate_info;
- }
- else {
+ } else {
console.error(
interpolate(
gettext('Could not parse certificate JSON. %(message)s'), {message: ex.message}, true
diff --git a/cms/static/js/certificates/spec/custom_matchers.js b/cms/static/js/certificates/spec/custom_matchers.js
index cd960f469f..8079de4883 100644
--- a/cms/static/js/certificates/spec/custom_matchers.js
+++ b/cms/static/js/certificates/spec/custom_matchers.js
@@ -11,7 +11,7 @@ define(['jquery'], function($) { // eslint-disable-line no-unused-vars
compare: function(actual, values) {
var passed = _.every(values, function(value, key) {
return actual.get(key) === value;
- }.bind(this));
+ });
return {
pass: passed
diff --git a/cms/static/js/certificates/spec/views/certificate_details_spec.js b/cms/static/js/certificates/spec/views/certificate_details_spec.js
index 4a58c5d97e..7a0332bda8 100644
--- a/cms/static/js/certificates/spec/views/certificate_details_spec.js
+++ b/cms/static/js/certificates/spec/views/certificate_details_spec.js
@@ -131,8 +131,8 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
it('should parse a JSON object collection into a Backbone model collection', function() {
var course_title = 'Test certificate course title override 2';
var CERTIFICATE_JSON_OBJECT = [{
- 'course_title': course_title,
- 'signatories': '[]'
+ course_title: course_title,
+ signatories: '[]'
}];
this.collection.parse(CERTIFICATE_JSON_OBJECT);
var model = this.collection.at(1);
diff --git a/cms/static/js/certificates/views/certificate_details.js b/cms/static/js/certificates/views/certificate_details.js
index a23ad8be06..7972dc74ba 100644
--- a/cms/static/js/certificates/views/certificate_details.js
+++ b/cms/static/js/certificates/views/certificate_details.js
@@ -49,8 +49,7 @@ function($, _, str, gettext, BaseView, SignatoryModel, SignatoryDetailsView, Vie
return self.model.set('editing', true);
}
);
- }
- else {
+ } else {
this.model.set('editing', true);
}
},
diff --git a/cms/static/js/certificates/views/certificate_editor.js b/cms/static/js/certificates/views/certificate_editor.js
index 82a3291ef9..e08ac582b4 100644
--- a/cms/static/js/certificates/views/certificate_editor.js
+++ b/cms/static/js/certificates/views/certificate_editor.js
@@ -25,7 +25,7 @@ function($, _, Backbone, gettext,
'change .certificate-course-title-input': 'setCourseTitle',
'focus .input-text': 'onFocus',
'blur .input-text': 'onBlur',
- 'submit': 'setAndClose',
+ submit: 'setAndClose',
'click .action-cancel': 'cancel',
'click .action-add-signatory': 'addSignatory'
},
diff --git a/cms/static/js/certificates/views/certificate_item.js b/cms/static/js/certificates/views/certificate_item.js
index 11aeed55c8..ed9cc9fd29 100644
--- a/cms/static/js/certificates/views/certificate_item.js
+++ b/cms/static/js/certificates/views/certificate_item.js
@@ -23,8 +23,8 @@ function(gettext, ListItemView, CertificateDetailsView, CertificateEditorView) {
attributes: function() {
// Retrieves the defined attribute set
return {
- 'id': this.model.get('id'),
- 'tabindex': -1
+ id: this.model.get('id'),
+ tabindex: -1
};
},
diff --git a/cms/static/js/certificates/views/signatory_details.js b/cms/static/js/certificates/views/signatory_details.js
index 596e294861..9d6543e279 100644
--- a/cms/static/js/certificates/views/signatory_details.js
+++ b/cms/static/js/certificates/views/signatory_details.js
@@ -76,10 +76,10 @@ function($, _, str, Backbone, gettext, TemplateUtils, ViewUtils, BaseView, Signa
actionableModel.setOriginalAttributes();
dfd.resolve();
self.closeSignatoryEditView();
- }.bind(this)
+ }
});
return dfd;
- }.bind(this));
+ });
},
closeSignatoryEditView: function(event) {
diff --git a/cms/static/js/certificates/views/signatory_editor.js b/cms/static/js/certificates/views/signatory_editor.js
index c6be7ba4f1..21d53f7f20 100644
--- a/cms/static/js/certificates/views/signatory_editor.js
+++ b/cms/static/js/certificates/views/signatory_editor.js
@@ -144,8 +144,7 @@ function($, _, Backbone, gettext,
if (model.isNew()) {
model.collection.remove(model);
self.eventAgg.trigger('onSignatoryRemoved', model);
- }
- else {
+ } else {
deleting.show();
model.destroy({
wait: true,
@@ -200,8 +199,7 @@ function($, _, Backbone, gettext,
$(selector).addClass('error');
$(selector).append("" + errorMessage + '');
}
- }
- else {
+ } else {
// Remove the error message.
$(selector).removeClass('error');
$(selector + '>span.message-error').remove();
diff --git a/cms/static/js/factories/base.js b/cms/static/js/factories/base.js
index ac5a706c62..abaeb89d17 100644
--- a/cms/static/js/factories/base.js
+++ b/cms/static/js/factories/base.js
@@ -1,2 +1,2 @@
define(['js/base', 'cms/js/main', 'js/src/logger', 'datepair', 'accessibility',
-'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course']);
+ 'ieshim', 'tooltip_manager', 'lang_edx', 'js/models/course']);
diff --git a/cms/static/js/factories/login.js b/cms/static/js/factories/login.js
index 3b01d4e477..7d080cdb2b 100644
--- a/cms/static/js/factories/login.js
+++ b/cms/static/js/factories/login.js
@@ -22,10 +22,10 @@ define(['jquery.cookie', 'utility', 'common/js/components/utils/view_utils'], fu
$('form#login_form').submit(function(event) {
event.preventDefault();
- var submitButton = $('#submit'),
+ var $submitButton = $('#submit'),
deferred = new $.Deferred(),
promise = deferred.promise();
- ViewUtils.disableElementWhileRunning(submitButton, function() { return promise; });
+ ViewUtils.disableElementWhileRunning($submitButton, function() { return promise; });
var submit_data = $('#login_form').serialize();
postJSON('/login_post', submit_data, function(json) {
diff --git a/cms/static/js/factories/manage_users.js b/cms/static/js/factories/manage_users.js
index 1db6d11c68..837ea6fec7 100644
--- a/cms/static/js/factories/manage_users.js
+++ b/cms/static/js/factories/manage_users.js
@@ -16,7 +16,7 @@ function(_, gettext, ManageUsersAndRoles) {
// Roles order are important: first role is considered initial role (the role added to user when (s)he's added
// Last role is considered an admin role (unrestricted access + ability to manage other users' permissions)
// Changing roles is performed in promote-demote fashion, so moves only to adjacent roles is allowed
- var roles = [{key: 'staff', name: gettext('Staff')}, {key: 'instructor', 'name': gettext('Admin')}];
+ var roles = [{key: 'staff', name: gettext('Staff')}, {key: 'instructor', name: gettext('Admin')}];
var options = {
el: $('#content'),
diff --git a/cms/static/js/factories/manage_users_lib.js b/cms/static/js/factories/manage_users_lib.js
index 504ca9e3f3..8bfe07134d 100644
--- a/cms/static/js/factories/manage_users_lib.js
+++ b/cms/static/js/factories/manage_users_lib.js
@@ -19,7 +19,7 @@ function(_, gettext, ManageUsersAndRoles) {
var roles = [
{key: 'library_user', name: gettext('Library User')},
{key: 'staff', name: gettext('Staff')},
- {key: 'instructor', 'name': gettext('Admin')}
+ {key: 'instructor', name: gettext('Admin')}
];
var options = {
diff --git a/cms/static/js/factories/settings_advanced.js b/cms/static/js/factories/settings_advanced.js
index 37fad0b6c1..16eb86f45e 100644
--- a/cms/static/js/factories/settings_advanced.js
+++ b/cms/static/js/factories/settings_advanced.js
@@ -24,17 +24,16 @@ define([
editor.render();
$('#deprecated-settings').click(function() {
- var wrapperDeprecatedSetting = $('.wrapper-deprecated-setting'),
- deprecatedSettingsLabel = $('.deprecated-settings-label');
+ var $wrapperDeprecatedSetting = $('.wrapper-deprecated-setting'),
+ $deprecatedSettingsLabel = $('.deprecated-settings-label');
if ($(this).is(':checked')) {
- wrapperDeprecatedSetting.addClass('is-set');
- deprecatedSettingsLabel.text(gettext('Hide Deprecated Settings'));
+ $wrapperDeprecatedSetting.addClass('is-set');
+ $deprecatedSettingsLabel.text(gettext('Hide Deprecated Settings'));
editor.render_deprecated = true;
- }
- else {
- wrapperDeprecatedSetting.removeClass('is-set');
- deprecatedSettingsLabel.text(gettext('Show Deprecated Settings'));
+ } else {
+ $wrapperDeprecatedSetting.removeClass('is-set');
+ $deprecatedSettingsLabel.text(gettext('Show Deprecated Settings'));
editor.render_deprecated = false;
}
diff --git a/cms/static/js/models/course.js b/cms/static/js/models/course.js
index 95a77454f4..090ca9aee9 100644
--- a/cms/static/js/models/course.js
+++ b/cms/static/js/models/course.js
@@ -1,7 +1,7 @@
define(['backbone'], function(Backbone) {
var Course = Backbone.Model.extend({
defaults: {
- 'name': ''
+ name: ''
},
validate: function(attrs, options) {
if (!attrs.name) {
diff --git a/cms/static/js/models/course_info.js b/cms/static/js/models/course_info.js
index fbf114d795..3f32dcf492 100644
--- a/cms/static/js/models/course_info.js
+++ b/cms/static/js/models/course_info.js
@@ -5,8 +5,8 @@ define(['backbone'], function(Backbone) {
url: '',
defaults: {
- 'updates': null, // UpdateCollection
- 'handouts': null // HandoutCollection
+ updates: null, // UpdateCollection
+ handouts: null // HandoutCollection
}
});
return CourseInfo;
diff --git a/cms/static/js/models/course_update.js b/cms/static/js/models/course_update.js
index 33ffca2eb7..9bd642aad6 100644
--- a/cms/static/js/models/course_update.js
+++ b/cms/static/js/models/course_update.js
@@ -2,16 +2,16 @@ define(['backbone', 'jquery', 'jquery.ui'], function(Backbone, $) {
// course update -- biggest kludge here is the lack of a real id to map updates to originals
var CourseUpdate = Backbone.Model.extend({
defaults: {
- 'date': $.datepicker.formatDate('MM d, yy', new Date()),
- 'content': '',
- 'push_notification_enabled': false,
- 'push_notification_selected': false
+ date: $.datepicker.formatDate('MM d, yy', new Date()),
+ content: '',
+ push_notification_enabled: false,
+ push_notification_selected: false
},
validate: function(attrs) {
var date_exists = (attrs.date !== null && attrs.date !== '');
var date_is_valid_string = ($.datepicker.formatDate('MM d, yy', new Date(attrs.date)) === attrs.date);
if (!(date_exists && date_is_valid_string)) {
- return {'date_required': gettext('Action required: Enter a valid date.')};
+ return {date_required: gettext('Action required: Enter a valid date.')};
}
}
});
diff --git a/cms/static/js/models/explicit_url.js b/cms/static/js/models/explicit_url.js
index fa1cad1afa..3ee510074f 100644
--- a/cms/static/js/models/explicit_url.js
+++ b/cms/static/js/models/explicit_url.js
@@ -5,7 +5,7 @@
define(['backbone'], function(Backbone) {
return Backbone.Model.extend({
defaults: {
- 'explicit_url': ''
+ explicit_url: ''
},
url: function() {
return this.get('explicit_url');
diff --git a/cms/static/js/models/license.js b/cms/static/js/models/license.js
index 9ba433d4d8..ff90c60b8d 100644
--- a/cms/static/js/models/license.js
+++ b/cms/static/js/models/license.js
@@ -1,9 +1,9 @@
define(['backbone', 'underscore'], function(Backbone, _) {
var LicenseModel = Backbone.Model.extend({
defaults: {
- 'type': null,
- 'options': {},
- 'custom': false // either `false`, or a string
+ type: null,
+ options: {},
+ custom: false // either `false`, or a string
},
initialize: function(attributes) {
@@ -55,16 +55,16 @@ define(['backbone', 'underscore'], function(Backbone, _) {
if (spaceIndex == -1) {
// if there's no space, it's a license type without options
return this.set({
- 'type': string,
- 'options': {},
- 'custom': false
+ type: string,
+ options: {},
+ custom: false
}, options);
} else {
// if there is a space, it's a custom license
return this.set({
- 'type': null,
- 'options': {},
- 'custom': string
+ type: null,
+ options: {},
+ custom: string
}, options);
}
}
@@ -91,7 +91,7 @@ define(['backbone', 'underscore'], function(Backbone, _) {
});
return this.set({
- 'type': type, 'options': optionsObj, 'custom': false
+ type: type, options: optionsObj, custom: false
}, options);
}
});
diff --git a/cms/static/js/models/location.js b/cms/static/js/models/location.js
index 42d40ed228..e755fb6fef 100644
--- a/cms/static/js/models/location.js
+++ b/cms/static/js/models/location.js
@@ -9,11 +9,11 @@ define(['backbone', 'underscore'], function(Backbone, _) {
},
toUrl: function(overrides) {
return;
- (overrides && overrides['tag'] ? overrides['tag'] : this.get('tag')) + '://' +
- (overrides && overrides['org'] ? overrides['org'] : this.get('org')) + '/' +
- (overrides && overrides['course'] ? overrides['course'] : this.get('course')) + '/' +
- (overrides && overrides['category'] ? overrides['category'] : this.get('category')) + '/' +
- (overrides && overrides['name'] ? overrides['name'] : this.get('name')) + '/';
+ (overrides && overrides.tag ? overrides.tag : this.get('tag')) + '://' +
+ (overrides && overrides.org ? overrides.org : this.get('org')) + '/' +
+ (overrides && overrides.course ? overrides.course : this.get('course')) + '/' +
+ (overrides && overrides.category ? overrides.category : this.get('category')) + '/' +
+ (overrides && overrides.name ? overrides.name : this.get('name')) + '/';
},
_tagPattern: /[^:]+/g,
_fieldPattern: new RegExp('[^/]+', 'g'),
@@ -27,8 +27,7 @@ define(['backbone', 'underscore'], function(Backbone, _) {
category: payload[3],
name: payload[4]
};
- }
- else if (_.isString(payload)) {
+ } else if (_.isString(payload)) {
this._tagPattern.lastIndex = 0; // odd regex behavior requires this to be reset sometimes
var foundTag = this._tagPattern.exec(payload);
if (foundTag) {
@@ -40,18 +39,15 @@ define(['backbone', 'underscore'], function(Backbone, _) {
category: this.getNextField(payload),
name: this.getNextField(payload)
};
- }
- else return null;
- }
- else {
+ } else return null;
+ } else {
return payload;
}
},
getNextField: function(payload) {
try {
return this._fieldPattern.exec(payload)[0];
- }
- catch (err) {
+ } catch (err) {
return '';
}
}
diff --git a/cms/static/js/models/metadata.js b/cms/static/js/models/metadata.js
index efa6333b4f..1372861005 100644
--- a/cms/static/js/models/metadata.js
+++ b/cms/static/js/models/metadata.js
@@ -5,13 +5,13 @@ define(['backbone'], function(Backbone) {
*/
var Metadata = Backbone.Model.extend({
defaults: {
- 'field_name': null,
- 'display_name': null,
- 'value': null,
- 'explicitly_set': null,
- 'default_value': null,
- 'options': null,
- 'type': null
+ field_name: null,
+ display_name: null,
+ value: null,
+ explicitly_set: null,
+ default_value: null,
+ options: null,
+ type: null
},
initialize: function() {
diff --git a/cms/static/js/models/module_info.js b/cms/static/js/models/module_info.js
index cfb4e44b5f..32c1291b12 100644
--- a/cms/static/js/models/module_info.js
+++ b/cms/static/js/models/module_info.js
@@ -3,10 +3,10 @@ define(['backbone', 'js/utils/module'], function(Backbone, ModuleUtils) {
urlRoot: ModuleUtils.urlRoot,
defaults: {
- 'id': null,
- 'data': null,
- 'metadata': null,
- 'children': null
+ id: null,
+ data: null,
+ metadata: null,
+ children: null
}
});
return ModuleInfo;
diff --git a/cms/static/js/models/section.js b/cms/static/js/models/section.js
index 8ee969da64..2499ac8ddf 100644
--- a/cms/static/js/models/section.js
+++ b/cms/static/js/models/section.js
@@ -2,7 +2,7 @@ define(['backbone', 'gettext', 'common/js/components/views/feedback_notification
function(Backbone, gettext, NotificationView, ModuleUtils) {
var Section = Backbone.Model.extend({
defaults: {
- 'name': ''
+ name: ''
},
validate: function(attrs, options) {
if (!attrs.name) {
diff --git a/cms/static/js/models/settings/course_details.js b/cms/static/js/models/settings/course_details.js
index 1498a6be13..394883d480 100644
--- a/cms/static/js/models/settings/course_details.js
+++ b/cms/static/js/models/settings/course_details.js
@@ -90,7 +90,7 @@ define(['backbone', 'underscore', 'gettext', 'js/models/validation_helpers', 'js
set_videosource: function(newsource) {
// newsource either is or just the "speed:key, *" string
// returns the videosource for the preview which iss the key whose speed is closest to 1
- if (_.isEmpty(newsource) && !_.isEmpty(this.get('intro_video'))) this.set({'intro_video': null}, {validate: true});
+ if (_.isEmpty(newsource) && !_.isEmpty(this.get('intro_video'))) this.set({intro_video: null}, {validate: true});
// TODO remove all whitespace w/in string
else {
if (this.get('intro_video') !== newsource) this.set('intro_video', newsource, {validate: true});
diff --git a/cms/static/js/models/settings/course_grader.js b/cms/static/js/models/settings/course_grader.js
index b478501465..1a1eb05a8c 100644
--- a/cms/static/js/models/settings/course_grader.js
+++ b/cms/static/js/models/settings/course_grader.js
@@ -1,21 +1,21 @@
define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
var CourseGrader = Backbone.Model.extend({
defaults: {
- 'type': '', // must be unique w/in collection (ie. w/in course)
- 'min_count': 1,
- 'drop_count': 0,
- 'short_label': '', // what to use in place of type if space is an issue
- 'weight': 0 // int 0..100
+ type: '', // must be unique w/in collection (ie. w/in course)
+ min_count: 1,
+ drop_count: 0,
+ short_label: '', // what to use in place of type if space is an issue
+ weight: 0 // int 0..100
},
parse: function(attrs) {
// round off values while converting them to integer
- if (attrs['weight']) {
+ if (attrs.weight) {
attrs.weight = Math.round(attrs.weight);
}
- if (attrs['min_count']) {
+ if (attrs.min_count) {
attrs.min_count = Math.round(attrs.min_count);
}
- if (attrs['drop_count']) {
+ if (attrs.drop_count) {
attrs.drop_count = Math.round(attrs.drop_count);
}
return attrs;
@@ -23,12 +23,11 @@ define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
validate: function(attrs) {
var errors = {};
if (_.has(attrs, 'type')) {
- if (_.isEmpty(attrs['type'])) {
+ if (_.isEmpty(attrs.type)) {
errors.type = gettext('The assignment type must have a name.');
- }
- else {
+ } else {
// FIXME somehow this.collection is unbound sometimes. I can't track down when
- var existing = this.collection && this.collection.some(function(other) { return (other.cid != this.cid) && (other.get('type') == attrs['type']); }, this);
+ var existing = this.collection && this.collection.some(function(other) { return (other.cid != this.cid) && (other.get('type') == attrs.type); }, this);
if (existing) {
errors.type = gettext("There's already another assignment type with this name.");
}
@@ -38,8 +37,7 @@ define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
var intWeight = Math.round(attrs.weight); // see if this ensures value saved is int
if (!isFinite(intWeight) || /\D+/.test(attrs.weight) || intWeight < 0 || intWeight > 100) {
errors.weight = gettext('Please enter an integer between 0 and 100.');
- }
- else {
+ } else {
attrs.weight = intWeight;
if (this.collection && attrs.weight > 0) {
// FIXME b/c saves don't update the models if validation fails, we should
@@ -48,21 +46,20 @@ define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
// if ((this.collection.sumWeights() + attrs.weight - this.get('weight')) > 100)
// errors.weight = "The weights cannot add to more than 100.";
}
- } }
+ }
+ }
if (_.has(attrs, 'min_count')) {
var intMinCount = Math.round(attrs.min_count);
if (!isFinite(intMinCount) || /\D+/.test(attrs.min_count) || intMinCount < 1) {
errors.min_count = gettext('Please enter an integer greater than 0.');
- }
- else attrs.min_count = intMinCount;
+ } else attrs.min_count = intMinCount;
}
if (_.has(attrs, 'drop_count')) {
var dropCount = attrs.drop_count;
var intDropCount = Math.round(dropCount);
if (!isFinite(intDropCount) || /\D+/.test(dropCount) || (_.isString(dropCount) && _.isEmpty(dropCount.trim())) || intDropCount < 0) {
errors.drop_count = gettext('Please enter non-negative integer.');
- }
- else attrs.drop_count = intDropCount;
+ } else attrs.drop_count = intDropCount;
}
if (_.has(attrs, 'min_count') && _.has(attrs, 'drop_count') && !_.has(errors, 'min_count') && !_.has(errors, 'drop_count') && attrs.drop_count > attrs.min_count) {
var template = _.template(
diff --git a/cms/static/js/models/settings/course_grading_policy.js b/cms/static/js/models/settings/course_grading_policy.js
index 887eb25ec8..d0fd345217 100644
--- a/cms/static/js/models/settings/course_grading_policy.js
+++ b/cms/static/js/models/settings/course_grading_policy.js
@@ -8,21 +8,20 @@ define(['backbone', 'js/models/location', 'js/collections/course_grader'],
minimum_grade_credit: null // either null or percentage
},
parse: function(attributes) {
- if (attributes['graders']) {
+ if (attributes.graders) {
var graderCollection;
// interesting race condition: if {parse:true} when newing, then parse called before .attributes created
if (this.attributes && this.has('graders')) {
graderCollection = this.get('graders');
graderCollection.reset(attributes.graders, {parse: true});
- }
- else {
+ } else {
graderCollection = new CourseGraderCollection(attributes.graders, {parse: true});
}
attributes.graders = graderCollection;
}
// If grace period is unset or equal to 00:00 on the server,
// it's received as null
- if (attributes['grace_period'] === null) {
+ if (attributes.grace_period === null) {
attributes.grace_period = {
hours: 0,
minutes: 0
@@ -37,15 +36,9 @@ define(['backbone', 'js/models/location', 'js/collections/course_grader'],
},
gracePeriodToDate: function() {
var newDate = new Date();
- if (this.has('grace_period') && this.get('grace_period')['hours'])
- newDate.setHours(this.get('grace_period')['hours']);
- else newDate.setHours(0);
- if (this.has('grace_period') && this.get('grace_period')['minutes'])
- newDate.setMinutes(this.get('grace_period')['minutes']);
- else newDate.setMinutes(0);
- if (this.has('grace_period') && this.get('grace_period')['seconds'])
- newDate.setSeconds(this.get('grace_period')['seconds']);
- else newDate.setSeconds(0);
+ if (this.has('grace_period') && this.get('grace_period').hours) { newDate.setHours(this.get('grace_period').hours); } else newDate.setHours(0);
+ if (this.has('grace_period') && this.get('grace_period').minutes) { newDate.setMinutes(this.get('grace_period').minutes); } else newDate.setMinutes(0);
+ if (this.has('grace_period') && this.get('grace_period').seconds) { newDate.setSeconds(this.get('grace_period').seconds); } else newDate.setSeconds(0);
return newDate;
},
@@ -69,9 +62,9 @@ define(['backbone', 'js/models/location', 'js/collections/course_grader'],
},
validate: function(attrs) {
if (_.has(attrs, 'grace_period')) {
- if (attrs['grace_period'] === null) {
+ if (attrs.grace_period === null) {
return {
- 'grace_period': gettext('Grace period must be specified in HH:MM format.')
+ grace_period: gettext('Grace period must be specified in HH:MM format.')
};
}
}
@@ -80,7 +73,7 @@ define(['backbone', 'js/models/location', 'js/collections/course_grader'],
var minimum_grade_cutoff = _.min(_.values(attrs.grade_cutoffs));
if (isNaN(attrs.minimum_grade_credit) || attrs.minimum_grade_credit === null || attrs.minimum_grade_credit < minimum_grade_cutoff) {
return {
- 'minimum_grade_credit': interpolate(
+ minimum_grade_credit: interpolate(
gettext('Not able to set passing grade to less than %(minimum_grade_cutoff)s%.'),
{minimum_grade_cutoff: minimum_grade_cutoff * 100},
true
diff --git a/cms/static/js/models/textbook.js b/cms/static/js/models/textbook.js
index e107daa288..22eac9dd39 100644
--- a/cms/static/js/models/textbook.js
+++ b/cms/static/js/models/textbook.js
@@ -1,5 +1,5 @@
define(['backbone', 'underscore', 'gettext', 'js/models/chapter', 'js/collections/chapter',
- 'backbone.associations', 'cms/js/main'],
+ 'backbone.associations', 'cms/js/main'],
function(Backbone, _, gettext, ChapterModel, ChapterCollection) {
var Textbook = Backbone.AssociatedModel.extend({
defaults: function() {
@@ -40,7 +40,7 @@ define(['backbone', 'underscore', 'gettext', 'js/models/chapter', 'js/collection
delete ret.tab_title;
}
if ('url' in ret && !('chapters' in ret)) {
- ret.chapters = {'url': ret.url};
+ ret.chapters = {url: ret.url};
delete ret.url;
}
_.each(ret.chapters, function(chapter, i) {
diff --git a/cms/static/js/models/uploads.js b/cms/static/js/models/uploads.js
index a6a97e2a63..be12dbfb1a 100644
--- a/cms/static/js/models/uploads.js
+++ b/cms/static/js/models/uploads.js
@@ -1,15 +1,15 @@
define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
var FileUpload = Backbone.Model.extend({
defaults: {
- 'title': '',
- 'message': '',
- 'selectedFile': null,
- 'uploading': false,
- 'uploadedBytes': 0,
- 'totalBytes': 0,
- 'finished': false,
- 'mimeTypes': [],
- 'fileFormats': []
+ title: '',
+ message: '',
+ selectedFile: null,
+ uploading: false,
+ uploadedBytes: 0,
+ totalBytes: 0,
+ finished: false,
+ mimeTypes: [],
+ fileFormats: []
},
validate: function(attrs, options) {
if (attrs.selectedFile && !this.checkTypeValidity(attrs.selectedFile)) {
diff --git a/cms/static/js/models/validation_helpers.js b/cms/static/js/models/validation_helpers.js
index 5c11533a55..61b8d592c1 100644
--- a/cms/static/js/models/validation_helpers.js
+++ b/cms/static/js/models/validation_helpers.js
@@ -14,6 +14,6 @@ define(['jquery'],
};
return {
- 'validateIntegerRange': validateIntegerRange
+ validateIntegerRange: validateIntegerRange
};
});
diff --git a/cms/static/js/models/xblock_container_info.js b/cms/static/js/models/xblock_container_info.js
index 8237989e7a..7add185ddc 100644
--- a/cms/static/js/models/xblock_container_info.js
+++ b/cms/static/js/models/xblock_container_info.js
@@ -2,7 +2,7 @@ define(['js/models/custom_sync_xblock_info'],
function(CustomSyncXBlockInfo) {
var XBlockContainerInfo = CustomSyncXBlockInfo.extend({
urlRoots: {
- 'read': '/xblock/container'
+ read: '/xblock/container'
}
});
return XBlockContainerInfo;
diff --git a/cms/static/js/models/xblock_outline_info.js b/cms/static/js/models/xblock_outline_info.js
index 50a7a41938..4d33fa3244 100644
--- a/cms/static/js/models/xblock_outline_info.js
+++ b/cms/static/js/models/xblock_outline_info.js
@@ -3,7 +3,7 @@ define(['js/models/custom_sync_xblock_info'],
var XBlockOutlineInfo = CustomSyncXBlockInfo.extend({
urlRoots: {
- 'read': '/xblock/outline'
+ read: '/xblock/outline'
},
createChild: function(response) {
diff --git a/cms/static/js/spec/factories/xblock_validation_spec.js b/cms/static/js/spec/factories/xblock_validation_spec.js
index 23cbcbc0e1..5ba9380981 100644
--- a/cms/static/js/spec/factories/xblock_validation_spec.js
+++ b/cms/static/js/spec/factories/xblock_validation_spec.js
@@ -23,10 +23,10 @@ define(['jquery', 'js/factories/xblock_validation', 'common/js/spec_helpers/temp
var noContainerContent = 'no-container-content';
var notConfiguredMessages = {
- 'empty': false,
- 'summary': {'text': 'my summary', 'type': 'not-configured'},
- 'messages': [],
- 'xblock_id': 'id'
+ empty: false,
+ summary: {text: 'my summary', type: 'not-configured'},
+ messages: [],
+ xblock_id: 'id'
};
// Root is false, will not add noContainerContent.
XBlockValidationFactory(notConfiguredMessages, true, false, false, $messageDiv);
@@ -42,10 +42,10 @@ define(['jquery', 'js/factories/xblock_validation', 'common/js/spec_helpers/temp
beforeEach(function() {
messagesWithSummary = {
- 'empty': false,
- 'summary': {'text': 'my summary'},
- 'messages': [{'text': 'one', 'type': 'warning'}, {'text': 'two', 'type': 'error'}],
- 'xblock_id': 'id'
+ empty: false,
+ summary: {text: 'my summary'},
+ messages: [{text: 'one', type: 'warning'}, {text: 'two', type: 'error'}],
+ xblock_id: 'id'
};
});
diff --git a/cms/static/js/spec/models/component_template_spec.js b/cms/static/js/spec/models/component_template_spec.js
index d68a989b25..3bc2226655 100644
--- a/cms/static/js/spec/models/component_template_spec.js
+++ b/cms/static/js/spec/models/component_template_spec.js
@@ -2,54 +2,54 @@ define(['js/models/component_template'],
function(ComponentTemplate) {
describe('ComponentTemplates', function() {
var mockTemplateJSON = {
- 'templates': [
+ templates: [
{
- 'category': 'problem',
- 'boilerplate_name': 'formularesponse.yaml',
- 'display_name': 'Math Expression Input'
+ category: 'problem',
+ boilerplate_name: 'formularesponse.yaml',
+ display_name: 'Math Expression Input'
}, {
- 'category': 'problem',
- 'boilerplate_name': null,
- 'display_name': 'Blank Advanced Problem'
+ category: 'problem',
+ boilerplate_name: null,
+ display_name: 'Blank Advanced Problem'
}, {
- 'category': 'problem',
- 'boilerplate_name': 'checkboxes.yaml',
- 'display_name': 'Checkboxes'
+ category: 'problem',
+ boilerplate_name: 'checkboxes.yaml',
+ display_name: 'Checkboxes'
}, {
- 'category': 'problem',
- 'boilerplate_name': 'multiple_choice.yaml',
- 'display_name': 'Multiple Choice'
+ category: 'problem',
+ boilerplate_name: 'multiple_choice.yaml',
+ display_name: 'Multiple Choice'
}, {
- 'category': 'problem',
- 'boilerplate_name': 'drag_and_drop.yaml',
- 'display_name': 'Drag and Drop'
+ category: 'problem',
+ boilerplate_name: 'drag_and_drop.yaml',
+ display_name: 'Drag and Drop'
}, {
- 'category': 'problem',
- 'boilerplate_name': 'problem_with_hint.yaml',
- 'display_name': 'Problem with Adaptive Hint'
+ category: 'problem',
+ boilerplate_name: 'problem_with_hint.yaml',
+ display_name: 'Problem with Adaptive Hint'
}, {
- 'category': 'problem',
- 'boilerplate_name': 'imageresponse.yaml',
- 'display_name': 'Image Mapped Input'
+ category: 'problem',
+ boilerplate_name: 'imageresponse.yaml',
+ display_name: 'Image Mapped Input'
}, {
- 'category': 'openassessment',
- 'boilerplate_name': null,
- 'display_name': 'Peer Assessment'
+ category: 'openassessment',
+ boilerplate_name: null,
+ display_name: 'Peer Assessment'
}, {
- 'category': 'problem',
- 'boilerplate_name': 'an_easy_problem.yaml',
- 'display_name': 'An Easy Problem'
+ category: 'problem',
+ boilerplate_name: 'an_easy_problem.yaml',
+ display_name: 'An Easy Problem'
}, {
- 'category': 'word_cloud',
- 'boilerplate_name': null,
- 'display_name': 'Word Cloud'
+ category: 'word_cloud',
+ boilerplate_name: null,
+ display_name: 'Word Cloud'
}, { // duplicate display name to verify sort behavior
- 'category': 'word_cloud',
- 'boilerplate_name': 'alternate_word_cloud.yaml',
- 'display_name': 'Word Cloud'
+ category: 'word_cloud',
+ boilerplate_name: 'alternate_word_cloud.yaml',
+ display_name: 'Word Cloud'
}],
- 'type': 'problem',
- 'support_legend': {'show_legend': false}
+ type: 'problem',
+ support_legend: {show_legend: false}
};
it('orders templates correctly', function() {
@@ -60,16 +60,16 @@ define(['js/models/component_template'],
componentTemplate.parse(mockTemplateJSON);
for (i = 0; i < componentTemplate.templates.length; i++) {
template = componentTemplate.templates[i];
- templateName = template['display_name'];
+ templateName = template.display_name;
if (lastTemplate) {
- if (!firstComparison || lastTemplate['boilerplate_name']) {
- expect(lastTemplate['display_name'] < templateName).toBeTruthy();
+ if (!firstComparison || lastTemplate.boilerplate_name) {
+ expect(lastTemplate.display_name < templateName).toBeTruthy();
}
firstComparison = false;
} else {
// If the first template is blank, make sure that it has the correct category
- if (!template['boilerplate_name']) {
- expect(template['category']).toBe('problem');
+ if (!template.boilerplate_name) {
+ expect(template.category).toBe('problem');
}
lastTemplate = template;
}
diff --git a/cms/static/js/spec/models/explicit_url_spec.js b/cms/static/js/spec/models/explicit_url_spec.js
index a349106045..d281d8b28c 100644
--- a/cms/static/js/spec/models/explicit_url_spec.js
+++ b/cms/static/js/spec/models/explicit_url_spec.js
@@ -2,7 +2,7 @@ define(['js/models/explicit_url'],
function(Model) {
describe('Model ', function() {
it('allows url to be passed in constructor', function() {
- expect(new Model({'explicit_url': '/fancy/url'}).url()).toBe('/fancy/url');
+ expect(new Model({explicit_url: '/fancy/url'}).url()).toBe('/fancy/url');
});
it('returns empty string if url not set', function() {
expect(new Model().url()).toBe('');
diff --git a/cms/static/js/spec/models/group_configuration_spec.js b/cms/static/js/spec/models/group_configuration_spec.js
index ac49f4679c..8426d6b376 100644
--- a/cms/static/js/spec/models/group_configuration_spec.js
+++ b/cms/static/js/spec/models/group_configuration_spec.js
@@ -86,45 +86,45 @@ define([
it('should match server model to client model', function() {
var serverModelSpec = {
- 'id': 10,
- 'name': 'My Group Configuration',
- 'description': 'Some description',
- 'version': 2,
- 'scheme': 'random',
- 'groups': [
+ id: 10,
+ name: 'My Group Configuration',
+ description: 'Some description',
+ version: 2,
+ scheme: 'random',
+ groups: [
{
- 'version': 1,
- 'name': 'Group 1',
- 'usage': []
+ version: 1,
+ name: 'Group 1',
+ usage: []
}, {
- 'version': 1,
- 'name': 'Group 2',
- 'usage': []
+ version: 1,
+ name: 'Group 2',
+ usage: []
}
]
},
clientModelSpec = {
- 'id': 10,
- 'name': 'My Group Configuration',
- 'description': 'Some description',
- 'scheme': 'random',
- 'showGroups': false,
- 'editing': false,
- 'version': 2,
- 'groups': [
+ id: 10,
+ name: 'My Group Configuration',
+ description: 'Some description',
+ scheme: 'random',
+ showGroups: false,
+ editing: false,
+ version: 2,
+ groups: [
{
- 'version': 1,
- 'order': 0,
- 'name': 'Group 1',
- 'usage': []
+ version: 1,
+ order: 0,
+ name: 'Group 1',
+ usage: []
}, {
- 'version': 1,
- 'order': 1,
- 'name': 'Group 2',
- 'usage': []
+ version: 1,
+ order: 1,
+ name: 'Group 2',
+ usage: []
}
],
- 'usage': []
+ usage: []
},
model = new GroupConfigurationModel(
serverModelSpec, {parse: true}
diff --git a/cms/static/js/spec/models/license_spec.js b/cms/static/js/spec/models/license_spec.js
index 73a67508ff..3f860487f8 100644
--- a/cms/static/js/spec/models/license_spec.js
+++ b/cms/static/js/spec/models/license_spec.js
@@ -9,22 +9,22 @@ define(['js/models/license'], function(LicenseModel) {
it('accepts normal arguments', function() {
var model = new LicenseModel({
- 'type': 'creative-commons',
- 'options': {'fake-boolean': true, 'version': 'your momma'}
+ type: 'creative-commons',
+ options: {'fake-boolean': true, version: 'your momma'}
});
expect(model.get('type')).toEqual('creative-commons');
- expect(model.get('options')).toEqual({'fake-boolean': true, 'version': 'your momma'});
+ expect(model.get('options')).toEqual({'fake-boolean': true, version: 'your momma'});
});
it('accepts a license string argument', function() {
- var model = new LicenseModel({'asString': 'all-rights-reserved'});
+ var model = new LicenseModel({asString: 'all-rights-reserved'});
expect(model.get('type')).toEqual('all-rights-reserved');
expect(model.get('options')).toEqual({});
expect(model.get('custom')).toBeFalsy();
});
it('accepts a custom license argument', function() {
- var model = new LicenseModel({'asString': 'Mozilla Public License 2.0'});
+ var model = new LicenseModel({asString: 'Mozilla Public License 2.0'});
expect(model.get('type')).toBeNull();
expect(model.get('options')).toEqual({});
expect(model.get('custom')).toEqual('Mozilla Public License 2.0');
@@ -39,7 +39,7 @@ define(['js/models/license'], function(LicenseModel) {
it('can parse license strings', function() {
this.model.setFromString('creative-commons: BY');
expect(this.model.get('type')).toEqual('creative-commons');
- expect(this.model.get('options')).toEqual({'BY': true});
+ expect(this.model.get('options')).toEqual({BY: true});
expect(this.model.get('custom')).toBeFalsy();
});
@@ -54,17 +54,17 @@ define(['js/models/license'], function(LicenseModel) {
it('can stringify a license with options', function() {
this.model.set({
- 'type': 'abc',
- 'options': {'ping': 'pong', 'bing': true, 'buzz': true, 'beep': false}}
+ type: 'abc',
+ options: {ping: 'pong', bing: true, buzz: true, beep: false}}
);
expect(this.model.toString()).toEqual('abc: ping=pong bing buzz');
});
it('can stringify a custom license', function() {
this.model.set({
- 'type': "doesn't matter",
- 'options': {'ignore': 'me'},
- 'custom': 'this is my super cool license'
+ type: "doesn't matter",
+ options: {ignore: 'me'},
+ custom: 'this is my super cool license'
});
expect(this.model.toString()).toEqual('this is my super cool license');
});
diff --git a/cms/static/js/spec/models/xblock_info_spec.js b/cms/static/js/spec/models/xblock_info_spec.js
index 4d36ecfc98..365358e316 100644
--- a/cms/static/js/spec/models/xblock_info_spec.js
+++ b/cms/static/js/spec/models/xblock_info_spec.js
@@ -2,48 +2,48 @@ define(['backbone', 'js/models/xblock_info'],
function(Backbone, XBlockInfo) {
describe('XblockInfo isEditableOnCourseOutline', function() {
it('works correct', function() {
- expect(new XBlockInfo({'category': 'chapter'}).isEditableOnCourseOutline()).toBe(true);
- expect(new XBlockInfo({'category': 'course'}).isEditableOnCourseOutline()).toBe(false);
- expect(new XBlockInfo({'category': 'sequential'}).isEditableOnCourseOutline()).toBe(true);
- expect(new XBlockInfo({'category': 'vertical'}).isEditableOnCourseOutline()).toBe(true);
+ expect(new XBlockInfo({category: 'chapter'}).isEditableOnCourseOutline()).toBe(true);
+ expect(new XBlockInfo({category: 'course'}).isEditableOnCourseOutline()).toBe(false);
+ expect(new XBlockInfo({category: 'sequential'}).isEditableOnCourseOutline()).toBe(true);
+ expect(new XBlockInfo({category: 'vertical'}).isEditableOnCourseOutline()).toBe(true);
});
});
describe('XblockInfo actions state and header visibility ', function() {
it('works correct to hide icons e.g. trash icon, drag when actions are not required', function() {
- expect(new XBlockInfo({'category': 'chapter', 'actions': {'deletable': false}})
+ expect(new XBlockInfo({category: 'chapter', actions: {deletable: false}})
.isDeletable()).toBe(false);
- expect(new XBlockInfo({'category': 'chapter', 'actions': {'draggable': false}})
+ expect(new XBlockInfo({category: 'chapter', actions: {draggable: false}})
.isDraggable()).toBe(false);
- expect(new XBlockInfo({'category': 'chapter', 'actions': {'childAddable': false}})
+ expect(new XBlockInfo({category: 'chapter', actions: {childAddable: false}})
.isChildAddable()).toBe(false);
});
it('works correct to show icons e.g. trash icon, drag when actions are required', function() {
- expect(new XBlockInfo({'category': 'chapter', 'actions': {'deletable': true}})
+ expect(new XBlockInfo({category: 'chapter', actions: {deletable: true}})
.isDeletable()).toBe(true);
- expect(new XBlockInfo({'category': 'chapter', 'actions': {'draggable': true}})
+ expect(new XBlockInfo({category: 'chapter', actions: {draggable: true}})
.isDraggable()).toBe(true);
- expect(new XBlockInfo({'category': 'chapter', 'actions': {'childAddable': true}})
+ expect(new XBlockInfo({category: 'chapter', actions: {childAddable: true}})
.isChildAddable()).toBe(true);
});
it('displays icons e.g. trash icon, drag when actions are undefined', function() {
- expect(new XBlockInfo({'category': 'chapter', 'actions': {}})
+ expect(new XBlockInfo({category: 'chapter', actions: {}})
.isDeletable()).toBe(true);
- expect(new XBlockInfo({'category': 'chapter', 'actions': {}})
+ expect(new XBlockInfo({category: 'chapter', actions: {}})
.isDraggable()).toBe(true);
- expect(new XBlockInfo({'category': 'chapter', 'actions': {}})
+ expect(new XBlockInfo({category: 'chapter', actions: {}})
.isChildAddable()).toBe(true);
});
it('works correct to hide header content', function() {
- expect(new XBlockInfo({'category': 'sequential', 'is_header_visible': false})
+ expect(new XBlockInfo({category: 'sequential', is_header_visible: false})
.isHeaderVisible()).toBe(false);
});
it('works correct to show header content when is_header_visible is not defined', function() {
- expect(new XBlockInfo({'category': 'sequential', 'actions': {'deletable': true}})
+ expect(new XBlockInfo({category: 'sequential', actions: {deletable: true}})
.isHeaderVisible()).toBe(true);
});
});
diff --git a/cms/static/js/spec/models/xblock_validation_spec.js b/cms/static/js/spec/models/xblock_validation_spec.js
index 6465849c53..724b56830d 100644
--- a/cms/static/js/spec/models/xblock_validation_spec.js
+++ b/cms/static/js/spec/models/xblock_validation_spec.js
@@ -12,18 +12,18 @@ define(['js/models/xblock_validation'],
describe('XBlockValidationModel', function() {
it('handles empty variable', function() {
verifyModel(new XBlockValidationModel({parse: true}), true, {}, [], null);
- verifyModel(new XBlockValidationModel({'empty': true}, {parse: true}), true, {}, [], null);
+ verifyModel(new XBlockValidationModel({empty: true}, {parse: true}), true, {}, [], null);
// It is assumed that the "empty" state on the JSON object passed in is correct
// (no attempt is made to correct other variables based on empty==true).
verifyModel(
new XBlockValidationModel(
- {'empty': true, 'messages': [{'text': 'Bad JSON case'}], 'xblock_id': 'id'},
+ {empty: true, messages: [{text: 'Bad JSON case'}], xblock_id: 'id'},
{parse: true}
),
true,
{},
- [{'text': 'Bad JSON case'}], 'id'
+ [{text: 'Bad JSON case'}], 'id'
);
});
@@ -31,36 +31,36 @@ define(['js/models/xblock_validation'],
// Single warning message.
verifyModel(
new XBlockValidationModel({
- 'empty': false,
- 'xblock_id': 'id'
+ empty: false,
+ xblock_id: 'id'
}, {parse: true}),
false,
- {'text': 'This component has validation issues.', 'type': 'warning'},
+ {text: 'This component has validation issues.', type: 'warning'},
[],
'id'
);
// Two messages that compute to a "warning" state in the summary.
verifyModel(
new XBlockValidationModel({
- 'empty': false,
- 'messages': [{'text': 'one', 'type': 'not-configured'}, {'text': 'two', 'type': 'warning'}],
- 'xblock_id': 'id'
+ empty: false,
+ messages: [{text: 'one', type: 'not-configured'}, {text: 'two', type: 'warning'}],
+ xblock_id: 'id'
}, {parse: true}),
false,
- {'text': 'This component has validation issues.', 'type': 'warning'},
- [{'text': 'one', 'type': 'not-configured'}, {'text': 'two', 'type': 'warning'}],
+ {text: 'This component has validation issues.', type: 'warning'},
+ [{text: 'one', type: 'not-configured'}, {text: 'two', type: 'warning'}],
'id'
);
// Two messages, with one of them "error", resulting in an "error" state in the summary.
verifyModel(
new XBlockValidationModel({
- 'empty': false,
- 'messages': [{'text': 'one', 'type': 'warning'}, {'text': 'two', 'type': 'error'}],
- 'xblock_id': 'id'
+ empty: false,
+ messages: [{text: 'one', type: 'warning'}, {text: 'two', type: 'error'}],
+ xblock_id: 'id'
}, {parse: true}),
false,
- {'text': 'This component has validation issues.', 'type': 'error'},
- [{'text': 'one', 'type': 'warning'}, {'text': 'two', 'type': 'error'}],
+ {text: 'This component has validation issues.', type: 'error'},
+ [{text: 'one', type: 'warning'}, {text: 'two', type: 'error'}],
'id'
);
});
@@ -69,51 +69,51 @@ define(['js/models/xblock_validation'],
// Summary already present (both text and type), no messages.
verifyModel(
new XBlockValidationModel({
- 'empty': false,
- 'xblock_id': 'id',
- 'summary': {'text': 'my summary', 'type': 'custom type'}
+ empty: false,
+ xblock_id: 'id',
+ summary: {text: 'my summary', type: 'custom type'}
}, {parse: true}),
false,
- {'text': 'my summary', 'type': 'custom type'},
+ {text: 'my summary', type: 'custom type'},
[],
'id'
);
// Summary text present, but not type (will get default value of warning).
verifyModel(
new XBlockValidationModel({
- 'empty': false,
- 'xblock_id': 'id',
- 'summary': {'text': 'my summary'}
+ empty: false,
+ xblock_id: 'id',
+ summary: {text: 'my summary'}
}, {parse: true}),
false,
- {'text': 'my summary', 'type': 'warning'},
+ {text: 'my summary', type: 'warning'},
[],
'id'
);
// Summary type present, but not text.
verifyModel(
new XBlockValidationModel({
- 'empty': false,
- 'summary': {'type': 'custom type'},
- 'messages': [{'text': 'one', 'type': 'not-configured'}, {'text': 'two', 'type': 'warning'}],
- 'xblock_id': 'id'
+ empty: false,
+ summary: {type: 'custom type'},
+ messages: [{text: 'one', type: 'not-configured'}, {text: 'two', type: 'warning'}],
+ xblock_id: 'id'
}, {parse: true}),
false,
- {'text': 'This component has validation issues.', 'type': 'custom type'},
- [{'text': 'one', 'type': 'not-configured'}, {'text': 'two', 'type': 'warning'}],
+ {text: 'This component has validation issues.', type: 'custom type'},
+ [{text: 'one', type: 'not-configured'}, {text: 'two', type: 'warning'}],
'id'
);
// Summary text present, type will be computed as error.
verifyModel(
new XBlockValidationModel({
- 'empty': false,
- 'summary': {'text': 'my summary'},
- 'messages': [{'text': 'one', 'type': 'warning'}, {'text': 'two', 'type': 'error'}],
- 'xblock_id': 'id'
+ empty: false,
+ summary: {text: 'my summary'},
+ messages: [{text: 'one', type: 'warning'}, {text: 'two', type: 'error'}],
+ xblock_id: 'id'
}, {parse: true}),
false,
- {'text': 'my summary', 'type': 'error'},
- [{'text': 'one', 'type': 'warning'}, {'text': 'two', 'type': 'error'}],
+ {text: 'my summary', type: 'error'},
+ [{text: 'one', type: 'warning'}, {text: 'two', type: 'error'}],
'id'
);
});
@@ -121,29 +121,29 @@ define(['js/models/xblock_validation'],
it('clears messages if showSummaryOnly is true', function() {
verifyModel(
new XBlockValidationModel({
- 'empty': false,
- 'xblock_id': 'id',
- 'summary': {'text': 'my summary'},
- 'messages': [{'text': 'one', 'type': 'warning'}, {'text': 'two', 'type': 'error'}],
- 'showSummaryOnly': true
+ empty: false,
+ xblock_id: 'id',
+ summary: {text: 'my summary'},
+ messages: [{text: 'one', type: 'warning'}, {text: 'two', type: 'error'}],
+ showSummaryOnly: true
}, {parse: true}),
false,
- {'text': 'my summary', 'type': 'error'},
+ {text: 'my summary', type: 'error'},
[],
'id'
);
verifyModel(
new XBlockValidationModel({
- 'empty': false,
- 'xblock_id': 'id',
- 'summary': {'text': 'my summary'},
- 'messages': [{'text': 'one', 'type': 'warning'}, {'text': 'two', 'type': 'error'}],
- 'showSummaryOnly': false
+ empty: false,
+ xblock_id: 'id',
+ summary: {text: 'my summary'},
+ messages: [{text: 'one', type: 'warning'}, {text: 'two', type: 'error'}],
+ showSummaryOnly: false
}, {parse: true}),
false,
- {'text': 'my summary', 'type': 'error'},
- [{'text': 'one', 'type': 'warning'}, {'text': 'two', 'type': 'error'}],
+ {text: 'my summary', type: 'error'},
+ [{text: 'one', type: 'warning'}, {text: 'two', type: 'error'}],
'id'
);
});
diff --git a/cms/static/js/spec/utils/drag_and_drop_spec.js b/cms/static/js/spec/utils/drag_and_drop_spec.js
index 194e7766a2..b61313de31 100644
--- a/cms/static/js/spec/utils/drag_and_drop_spec.js
+++ b/cms/static/js/spec/utils/drag_and_drop_spec.js
@@ -1,5 +1,5 @@
define(['sinon', 'js/utils/drag_and_drop', 'common/js/components/views/feedback_notification',
- 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'jquery', 'underscore'],
+ 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'jquery', 'underscore'],
function(sinon, ContentDragger, Notification, AjaxHelpers, $, _) {
'use strict';
describe('Overview drag and drop functionality', function() {
@@ -312,7 +312,7 @@ define(['sinon', 'js/utils/drag_and_drop', 'common/js/components/views/feedback_
});
it('should send an update on reorder from one parent to another', function() {
var requests, request, savingOptions;
- requests = AjaxHelpers['requests'](this);
+ requests = AjaxHelpers.requests(this);
ContentDragger.dragState.dropDestination = $('#unit-4');
ContentDragger.dragState.attachMethod = 'after';
ContentDragger.dragState.parentList = $('#subsection-2');
@@ -343,7 +343,7 @@ define(['sinon', 'js/utils/drag_and_drop', 'common/js/components/views/feedback_
expect($('#subsection-2').data('refresh')).toHaveBeenCalled();
});
it('should send an update on reorder within the same parent', function() {
- var requests = AjaxHelpers['requests'](this),
+ var requests = AjaxHelpers.requests(this),
request;
ContentDragger.dragState.dropDestination = $('#unit-2');
ContentDragger.dragState.attachMethod = 'after';
diff --git a/cms/static/js/spec/video/file_uploader_editor_spec.js b/cms/static/js/spec/video/file_uploader_editor_spec.js
index 9a3b407d00..dda10eccc0 100644
--- a/cms/static/js/spec/video/file_uploader_editor_spec.js
+++ b/cms/static/js/spec/video/file_uploader_editor_spec.js
@@ -191,8 +191,8 @@ function($, _, Squire) {
options = this.uploadSpies.constructor.calls.mostRecent().args[0];
options.onSuccess({
- 'asset': {
- 'url': 'http://example.org/test_3'
+ asset: {
+ url: 'http://example.org/test_3'
}
});
diff --git a/cms/static/js/spec/video/transcripts/editor_spec.js b/cms/static/js/spec/video/transcripts/editor_spec.js
index 7e54b9c03f..199369c33e 100644
--- a/cms/static/js/spec/video/transcripts/editor_spec.js
+++ b/cms/static/js/spec/video/transcripts/editor_spec.js
@@ -51,7 +51,7 @@ function($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCol
object: testData,
string: JSON.stringify(testData)
},
- transcripts, container;
+ transcripts, $container;
var waitsForDisplayName = function(collection) {
return jasmine.waitUntil(function() {
@@ -62,12 +62,12 @@ function($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCol
beforeEach(function() {
var tpl = sandbox({
- 'class': 'wrapper-comp-settings basic_metadata_edit',
- 'data-metadata': JSON.stringify(metadataDict['object'])
+ class: 'wrapper-comp-settings basic_metadata_edit',
+ 'data-metadata': JSON.stringify(metadataDict.object)
});
appendSetFixtures(tpl);
- container = $('.basic_metadata_edit');
+ $container = $('.basic_metadata_edit');
spyOn(Utils, 'command');
});
@@ -81,7 +81,7 @@ function($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCol
spyOn(MetadataView, 'Editor');
transcripts = new Editor({
- el: container
+ el: $container
});
});
@@ -93,7 +93,7 @@ function($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCol
it('MetadataView.Editor is initialized', function() {
expect(MetadataView.Editor).toHaveBeenCalledWith({
- el: container,
+ el: $container,
collection: transcripts.collection
});
});
@@ -161,7 +161,7 @@ function($, Backbone, _, Utils, Editor, MetadataView, MetadataModel, MetadataCol
spyOn(MetadataView, 'Editor');
transcripts = new Editor({
- el: container
+ el: $container
});
metadataCollection = new MetadataCollection(
diff --git a/cms/static/js/spec/video/transcripts/utils_spec.js b/cms/static/js/spec/video/transcripts/utils_spec.js
index f9ca4e6ae9..bfad26e69e 100644
--- a/cms/static/js/spec/video/transcripts/utils_spec.js
+++ b/cms/static/js/spec/video/transcripts/utils_spec.js
@@ -227,7 +227,7 @@ function($, _, Utils, _str) {
describe('Method: parseLink', function() {
var resultDataDict = {
- 'html5': {
+ html5: {
link: html5LinksList.mp4[0],
resp: {
mode: 'html5',
@@ -235,7 +235,7 @@ function($, _, Utils, _str) {
type: 'mp4'
}
},
- 'youtube': {
+ youtube: {
link: ytLinksList[0],
resp: {
mode: 'youtube',
@@ -243,7 +243,7 @@ function($, _, Utils, _str) {
type: 'youtube'
}
},
- 'incorrect': {
+ incorrect: {
link: 'http://example.com',
resp: {
mode: 'incorrect'
diff --git a/cms/static/js/spec/video/transcripts/videolist_spec.js b/cms/static/js/spec/video/transcripts/videolist_spec.js
index 91578e5d6e..2b2a396820 100644
--- a/cms/static/js/spec/video/transcripts/videolist_spec.js
+++ b/cms/static/js/spec/video/transcripts/videolist_spec.js
@@ -68,7 +68,7 @@ function($, _, AjaxHelpers, Utils, VideoList, MetadataModel, AbstractEditor) {
beforeEach(function() {
var tpl = sandbox({
- 'class': 'component',
+ class: 'component',
'data-locator': component_locator
});
diff --git a/cms/static/js/spec/video/translations_editor_spec.js b/cms/static/js/spec/video/translations_editor_spec.js
index dcfc90a86c..14c8b2fafb 100644
--- a/cms/static/js/spec/video/translations_editor_spec.js
+++ b/cms/static/js/spec/video/translations_editor_spec.js
@@ -14,8 +14,8 @@ function($, _, Squire) {
),
modelStub = {
default_value: {
- 'en': 'en.srt',
- 'ru': 'ru.srt'
+ en: 'en.srt',
+ ru: 'ru.srt'
},
display_name: 'Transcript Translation',
explicitly_set: false,
@@ -30,10 +30,10 @@ function($, _, Squire) {
{code: 'uk', label: 'Ukrainian'}
],
value: {
- 'en': 'en.srt',
- 'ru': 'ru.srt',
- 'uk': 'uk.srt',
- 'fr': 'fr.srt'
+ en: 'en.srt',
+ ru: 'ru.srt',
+ uk: 'uk.srt',
+ fr: 'fr.srt'
}
},
self, injector;
@@ -210,10 +210,10 @@ function($, _, Squire) {
it('returns the initial value upon initialization', function() {
expect(this.view).assertValueInView({
- 'en': 'en.srt',
- 'ru': 'ru.srt',
- 'uk': 'uk.srt',
- 'fr': 'fr.srt'
+ en: 'en.srt',
+ ru: 'ru.srt',
+ uk: 'uk.srt',
+ fr: 'fr.srt'
});
expect(this.view).verifyButtons(true, true, true);
@@ -221,9 +221,9 @@ function($, _, Squire) {
it('updates its value correctly', function() {
expect(this.view).assertCanUpdateView({
- 'ru': 'ru.srt',
- 'uk': 'uk.srt',
- 'fr': 'fr.srt'
+ ru: 'ru.srt',
+ uk: 'uk.srt',
+ fr: 'fr.srt'
});
});
@@ -231,11 +231,11 @@ function($, _, Squire) {
var options;
setValue(this.view, {
- 'en': 'en.srt',
- 'ru': 'ru.srt',
- 'uk': 'uk.srt',
- 'fr': 'fr.srt',
- 'zh': ''
+ en: 'en.srt',
+ ru: 'ru.srt',
+ uk: 'uk.srt',
+ fr: 'fr.srt',
+ zh: ''
});
expect(this.view).verifyButtons(true, false, true);
@@ -246,23 +246,23 @@ function($, _, Squire) {
expect(this.uploadSpies.show).toHaveBeenCalled();
options = this.uploadSpies.constructor.calls.mostRecent().args[0];
- options.onSuccess({'filename': 'zh.srt'});
+ options.onSuccess({filename: 'zh.srt'});
expect(this.view).verifyButtons(true, true, true);
expect(this.view.getValueFromEditor()).toEqual({
- 'en': 'en.srt',
- 'ru': 'ru.srt',
- 'uk': 'uk.srt',
- 'fr': 'fr.srt',
- 'zh': 'zh.srt'
+ en: 'en.srt',
+ ru: 'ru.srt',
+ uk: 'uk.srt',
+ fr: 'fr.srt',
+ zh: 'zh.srt'
});
});
it('has a clear method to revert to the model default', function() {
setValue(this.view, {
- 'fr': 'en.srt',
- 'uk': 'ru.srt'
+ fr: 'en.srt',
+ uk: 'ru.srt'
});
this.view.$el.find('.create-setting').click();
@@ -270,15 +270,15 @@ function($, _, Squire) {
this.view.clear();
expect(this.view).assertClear({
- 'en': 'en.srt',
- 'ru': 'ru.srt'
+ en: 'en.srt',
+ ru: 'ru.srt'
});
expect(this.view.$el.find('.create-setting')).not.toHaveClass('is-disabled');
});
it('has an update model method', function() {
- expect(this.view).assertUpdateModel(null, {'fr': 'fr.srt'});
+ expect(this.view).assertUpdateModel(null, {fr: 'fr.srt'});
});
it('can add an entry', function() {
@@ -289,9 +289,9 @@ function($, _, Squire) {
it('can remove an entry', function() {
setValue(this.view, {
- 'en': 'en.srt',
- 'ru': 'ru.srt',
- 'fr': ''
+ en: 'en.srt',
+ ru: 'ru.srt',
+ fr: ''
});
expect(_.keys(this.view.model.get('value')).length).toEqual(3);
this.view.$el.find('.remove-setting').last().click();
@@ -307,15 +307,15 @@ function($, _, Squire) {
it('only allows unique keys', function() {
expect(this.view).verifyKeysUnique(
- {'ru': 'ru.srt'}, {'ru': 'ru.srt'}, {'key': 'ru', 'value': ''}
+ {ru: 'ru.srt'}, {ru: 'ru.srt'}, {key: 'ru', value: ''}
);
expect(this.view).verifyKeysUnique(
- {'ru': 'en.srt'}, {'ru': 'ru.srt'}, {'key': 'ru', 'value': 'ru.srt'}
+ {ru: 'en.srt'}, {ru: 'ru.srt'}, {key: 'ru', value: 'ru.srt'}
);
expect(this.view).verifyKeysUnique(
- {'ru': 'ru.srt'}, {'ru': 'ru.srt'}, {'key': '', 'value': ''}
+ {ru: 'ru.srt'}, {ru: 'ru.srt'}, {key: '', value: ''}
);
});
diff --git a/cms/static/js/spec/views/assets_spec.js b/cms/static/js/spec/views/assets_spec.js
index e103e71259..2bd60deadf 100644
--- a/cms/static/js/spec/views/assets_spec.js
+++ b/cms/static/js/spec/views/assets_spec.js
@@ -1,5 +1,5 @@
define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'URI', 'js/views/assets',
- 'js/collections/asset', 'common/js/spec_helpers/view_helpers'],
+ 'js/collections/asset', 'common/js/spec_helpers/view_helpers'],
function($, AjaxHelpers, URI, AssetsView, AssetCollection, ViewHelpers) {
describe('Assets', function() {
var assetsView, mockEmptyAssetsResponse, mockAssetUploadResponse, mockFileUpload,
@@ -57,34 +57,34 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'URI', 'j
end: 2,
assets: [
{
- 'display_name': 'test.jpg',
- 'url': '/c4x/A/CS102/asset/test.jpg',
- 'date_added': 'Nov 07, 2014 at 17:47 UTC',
- 'id': '/c4x/A/CS102/asset/test.jpg',
- 'portable_url': '/static/test.jpg',
- 'thumbnail': '/c4x/A/CS102/thumbnail/test.jpg',
- 'locked': false,
- 'external_url': 'localhost:8000/c4x/A/CS102/asset/test.jpg'
+ display_name: 'test.jpg',
+ url: '/c4x/A/CS102/asset/test.jpg',
+ date_added: 'Nov 07, 2014 at 17:47 UTC',
+ id: '/c4x/A/CS102/asset/test.jpg',
+ portable_url: '/static/test.jpg',
+ thumbnail: '/c4x/A/CS102/thumbnail/test.jpg',
+ locked: false,
+ external_url: 'localhost:8000/c4x/A/CS102/asset/test.jpg'
},
{
- 'display_name': 'test.pdf',
- 'url': '/c4x/A/CS102/asset/test.pdf',
- 'date_added': 'Oct 20, 2014 at 11:00 UTC',
- 'id': '/c4x/A/CS102/asset/test.pdf',
- 'portable_url': '/static/test.pdf',
- 'thumbnail': null,
- 'locked': false,
- 'external_url': 'localhost:8000/c4x/A/CS102/asset/test.pdf'
+ display_name: 'test.pdf',
+ url: '/c4x/A/CS102/asset/test.pdf',
+ date_added: 'Oct 20, 2014 at 11:00 UTC',
+ id: '/c4x/A/CS102/asset/test.pdf',
+ portable_url: '/static/test.pdf',
+ thumbnail: null,
+ locked: false,
+ external_url: 'localhost:8000/c4x/A/CS102/asset/test.pdf'
},
{
- 'display_name': 'test.odt',
- 'url': '/c4x/A/CS102/asset/test.odt',
- 'date_added': 'Oct 20, 2014 at 11:00 UTC',
- 'id': '/c4x/A/CS102/asset/test.odt',
- 'portable_url': '/static/test.odt',
- 'thumbnail': null,
- 'locked': false,
- 'external_url': 'localhost:8000/c4x/A/CS102/asset/test.odt'
+ display_name: 'test.odt',
+ url: '/c4x/A/CS102/asset/test.odt',
+ date_added: 'Oct 20, 2014 at 11:00 UTC',
+ id: '/c4x/A/CS102/asset/test.odt',
+ portable_url: '/static/test.odt',
+ thumbnail: null,
+ locked: false,
+ external_url: 'localhost:8000/c4x/A/CS102/asset/test.odt'
}
],
pageSize: 2,
@@ -98,14 +98,14 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'URI', 'j
end: 1,
assets: [
{
- 'display_name': 'test.jpg',
- 'url': '/c4x/A/CS102/asset/test.jpg',
- 'date_added': 'Nov 07, 2014 at 17:47 UTC',
- 'id': '/c4x/A/CS102/asset/test.jpg',
- 'portable_url': '/static/test.jpg',
- 'thumbnail': '/c4x/A/CS102/thumbnail/test.jpg',
- 'locked': false,
- 'external_url': 'localhost:8000/c4x/A/CS102/asset/test.jpg'
+ display_name: 'test.jpg',
+ url: '/c4x/A/CS102/asset/test.jpg',
+ date_added: 'Nov 07, 2014 at 17:47 UTC',
+ id: '/c4x/A/CS102/asset/test.jpg',
+ portable_url: '/static/test.jpg',
+ thumbnail: '/c4x/A/CS102/thumbnail/test.jpg',
+ locked: false,
+ external_url: 'localhost:8000/c4x/A/CS102/asset/test.jpg'
}
],
pageSize: 1,
@@ -133,7 +133,7 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'URI', 'j
};
var event = {};
- event.target = {'value': 'dummy.jpg'};
+ event.target = {value: 'dummy.jpg'};
describe('AssetsView', function() {
var setup;
@@ -366,43 +366,44 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'URI', 'j
end: 1,
assets: [
{
- 'display_name': 'test.jpg',
- 'url': '/c4x/A/CS102/asset/test.jpg',
- 'date_added': 'Nov 07, 2014 at 17:47 UTC',
- 'id': '/c4x/A/CS102/asset/test.jpg',
- 'portable_url': '/static/test.jpg',
- 'thumbnail': '/c4x/A/CS102/thumbnail/test.jpg',
- 'locked': false,
- 'external_url': 'localhost:8000/c4x/A/CS102/asset/test.jpg'
+ display_name: 'test.jpg',
+ url: '/c4x/A/CS102/asset/test.jpg',
+ date_added: 'Nov 07, 2014 at 17:47 UTC',
+ id: '/c4x/A/CS102/asset/test.jpg',
+ portable_url: '/static/test.jpg',
+ thumbnail: '/c4x/A/CS102/thumbnail/test.jpg',
+ locked: false,
+ external_url: 'localhost:8000/c4x/A/CS102/asset/test.jpg'
},
{
- 'display_name': 'test.pdf',
- 'url': '/c4x/A/CS102/asset/test.pdf',
- 'date_added': 'Oct 20, 2014 at 11:00 UTC',
- 'id': '/c4x/A/CS102/asset/test.pdf',
- 'portable_url': '/static/test.pdf',
- 'thumbnail': null,
- 'locked': false,
- 'external_url': 'localhost:8000/c4x/A/CS102/asset/test.pdf'
+ display_name: 'test.pdf',
+ url: '/c4x/A/CS102/asset/test.pdf',
+ date_added: 'Oct 20, 2014 at 11:00 UTC',
+ id: '/c4x/A/CS102/asset/test.pdf',
+ portable_url: '/static/test.pdf',
+ thumbnail: null,
+ locked: false,
+ external_url: 'localhost:8000/c4x/A/CS102/asset/test.pdf'
}
],
pageSize: 2,
totalCount: 3,
start: 0,
page: 0
- }, secondPageAssets = {
+ },
+ secondPageAssets = {
sort: 'uploadDate',
end: 2,
assets: [
{
- 'display_name': 'test.odt',
- 'url': '/c4x/A/CS102/asset/test.odt',
- 'date_added': 'Oct 20, 2014 at 11:00 UTC',
- 'id': '/c4x/A/CS102/asset/test.odt',
- 'portable_url': '/static/test.odt',
- 'thumbnail': null,
- 'locked': false,
- 'external_url': 'localhost:8000/c4x/A/CS102/asset/test.odt'
+ display_name: 'test.odt',
+ url: '/c4x/A/CS102/asset/test.odt',
+ date_added: 'Oct 20, 2014 at 11:00 UTC',
+ id: '/c4x/A/CS102/asset/test.odt',
+ portable_url: '/static/test.odt',
+ thumbnail: null,
+ locked: false,
+ external_url: 'localhost:8000/c4x/A/CS102/asset/test.odt'
}
],
pageSize: 2,
diff --git a/cms/static/js/spec/views/container_spec.js b/cms/static/js/spec/views/container_spec.js
index cff5be452f..60d7cafdf1 100644
--- a/cms/static/js/spec/views/container_spec.js
+++ b/cms/static/js/spec/views/container_spec.js
@@ -54,7 +54,7 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'js/spec_
AjaxHelpers.respondWithJson(requests, {
html: mockContainerHTML,
- 'resources': []
+ resources: []
});
$('body').append(containerView.$el);
diff --git a/cms/static/js/spec/views/group_configuration_spec.js b/cms/static/js/spec/views/group_configuration_spec.js
index 612e2ac37d..f53987ba5b 100644
--- a/cms/static/js/spec/views/group_configuration_spec.js
+++ b/cms/static/js/spec/views/group_configuration_spec.js
@@ -80,8 +80,8 @@ define([
};
var setUsageInfo = function(model) {
model.set('usage', [
- {'label': 'label1', 'url': 'url1'},
- {'label': 'label2', 'url': 'url2'}
+ {label: 'label1', url: 'url1'},
+ {label: 'label2', url: 'url2'}
]);
};
var assertHideValidationContent = function(view) {
@@ -193,7 +193,7 @@ define([
compare: function(actual, values) {
var passed = _.every(values, function(value, key) {
return actual.get(key) === value;
- }.bind(this));
+ });
return {
pass: passed
@@ -314,11 +314,11 @@ define([
it('should show validation warning icon and message appropriately', function() {
this.model.set('usage', [
{
- 'label': 'label1',
- 'url': 'url1',
- 'validation': {
- 'text': 'Warning message',
- 'type': 'warning'
+ label: 'label1',
+ url: 'url1',
+ validation: {
+ text: 'Warning message',
+ type: 'warning'
}
}
]);
@@ -332,11 +332,11 @@ define([
it('should show validation error icon and message appropriately', function() {
this.model.set('usage', [
{
- 'label': 'label1',
- 'url': 'url1',
- 'validation': {
- 'text': 'Error message',
- 'type': 'error'
+ label: 'label1',
+ url: 'url1',
+ validation: {
+ text: 'Error message',
+ type: 'error'
}
}
]);
diff --git a/cms/static/js/spec/views/license_spec.js b/cms/static/js/spec/views/license_spec.js
index 75357e4c09..114ecf3e20 100644
--- a/cms/static/js/spec/views/license_spec.js
+++ b/cms/static/js/spec/views/license_spec.js
@@ -51,7 +51,7 @@ define(['js/views/license', 'js/models/license', 'common/js/spec_helpers/templat
var ccBtn = this.view.$('li[data-license=creative-commons] button');
ccBtn.click();
expect(this.model.get('options')).toEqual(
- {'ver': '4.0', 'BY': true, 'NC': true, 'ND': true, 'SA': false}
+ {ver: '4.0', BY: true, NC: true, ND: true, SA: false}
);
var arrBtn = this.view.$('li[data-license=all-rights-reserved] button');
arrBtn.click();
@@ -59,7 +59,7 @@ define(['js/views/license', 'js/models/license', 'common/js/spec_helpers/templat
});
it('renders license options', function() {
- this.model.set({'type': 'creative-commons'});
+ this.model.set({type: 'creative-commons'});
expect(this.view.$('ul.license-options li[data-option=BY]'))
.toContainText('Attribution');
expect(this.view.$('ul.license-options li[data-option=NC]'))
@@ -74,19 +74,19 @@ define(['js/views/license', 'js/models/license', 'common/js/spec_helpers/templat
it('toggles boolean options on click', function() {
this.view.$('li[data-license=creative-commons] button').click();
expect(this.model.get('options')).toEqual(
- {'ver': '4.0', 'BY': true, 'NC': true, 'ND': true, 'SA': false}
+ {ver: '4.0', BY: true, NC: true, ND: true, SA: false}
);
// toggle NC option
this.view.$('li[data-option=NC]').click();
expect(this.model.get('options')).toEqual(
- {'ver': '4.0', 'BY': true, 'NC': false, 'ND': true, 'SA': false}
+ {ver: '4.0', BY: true, NC: false, ND: true, SA: false}
);
});
it("doesn't toggle disabled options", function() {
this.view.$('li[data-license=creative-commons] button').click();
expect(this.model.get('options')).toEqual(
- {'ver': '4.0', 'BY': true, 'NC': true, 'ND': true, 'SA': false}
+ {ver: '4.0', BY: true, NC: true, ND: true, SA: false}
);
var BY = this.view.$('li[data-option=BY]');
expect(BY).toHaveClass('is-disabled');
@@ -94,14 +94,14 @@ define(['js/views/license', 'js/models/license', 'common/js/spec_helpers/templat
BY.click();
// no change
expect(this.model.get('options')).toEqual(
- {'ver': '4.0', 'BY': true, 'NC': true, 'ND': true, 'SA': false}
+ {ver: '4.0', BY: true, NC: true, ND: true, SA: false}
);
});
it("doesn't allow simultaneous conflicting options", function() {
this.view.$('li[data-license=creative-commons] button').click();
expect(this.model.get('options')).toEqual(
- {'ver': '4.0', 'BY': true, 'NC': true, 'ND': true, 'SA': false}
+ {ver: '4.0', BY: true, NC: true, ND: true, SA: false}
);
// SA and ND conflict
var SA = this.view.$('li[data-option=SA]');
@@ -109,14 +109,14 @@ define(['js/views/license', 'js/models/license', 'common/js/spec_helpers/templat
SA.click();
// ND should no longer be selected
expect(this.model.get('options')).toEqual(
- {'ver': '4.0', 'BY': true, 'NC': true, 'ND': false, 'SA': true}
+ {ver: '4.0', BY: true, NC: true, ND: false, SA: true}
);
// try to turn on ND option
ND = this.view.$('li[data-option=ND]');
ND.click();
expect(this.model.get('options')).toEqual(
- {'ver': '4.0', 'BY': true, 'NC': true, 'ND': true, 'SA': false}
+ {ver: '4.0', BY: true, NC: true, ND: true, SA: false}
);
});
diff --git a/cms/static/js/spec/views/login_studio_spec.js b/cms/static/js/spec/views/login_studio_spec.js
index e072fd233b..d20ca233ef 100644
--- a/cms/static/js/spec/views/login_studio_spec.js
+++ b/cms/static/js/spec/views/login_studio_spec.js
@@ -1,32 +1,32 @@
define(['jquery', 'js/factories/login', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers',
- 'common/js/components/utils/view_utils'],
+ 'common/js/components/utils/view_utils'],
function($, LoginFactory, AjaxHelpers, ViewUtils) {
'use strict';
describe('Studio Login Page', function() {
- var submitButton;
+ var $submitButton;
beforeEach(function() {
loadFixtures('mock/login.underscore');
var login_factory = new LoginFactory('/home/');
- submitButton = $('#submit');
+ $submitButton = $('#submit');
});
it('disable the submit button once it is clicked', function() {
spyOn(ViewUtils, 'redirect').and.callFake(function() {});
var requests = AjaxHelpers.requests(this);
- expect(submitButton).not.toHaveClass('is-disabled');
- submitButton.click();
- AjaxHelpers.respondWithJson(requests, {'success': true});
- expect(submitButton).toHaveClass('is-disabled');
+ expect($submitButton).not.toHaveClass('is-disabled');
+ $submitButton.click();
+ AjaxHelpers.respondWithJson(requests, {success: true});
+ expect($submitButton).toHaveClass('is-disabled');
});
it('It will not disable the submit button if there are errors in ajax request', function() {
var requests = AjaxHelpers.requests(this);
- expect(submitButton).not.toHaveClass('is-disabled');
- submitButton.click();
- expect(submitButton).toHaveClass('is-disabled');
+ expect($submitButton).not.toHaveClass('is-disabled');
+ $submitButton.click();
+ expect($submitButton).toHaveClass('is-disabled');
AjaxHelpers.respondWithError(requests, {});
- expect(submitButton).not.toHaveClass('is-disabled');
+ expect($submitButton).not.toHaveClass('is-disabled');
});
});
});
diff --git a/cms/static/js/spec/views/modals/edit_xblock_spec.js b/cms/static/js/spec/views/modals/edit_xblock_spec.js
index b8b8e195ab..cb945b5e33 100644
--- a/cms/static/js/spec/views/modals/edit_xblock_spec.js
+++ b/cms/static/js/spec/views/modals/edit_xblock_spec.js
@@ -5,8 +5,8 @@ define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpe
var model, modal, showModal;
showModal = function(requests, mockHtml, options) {
- var xblockElement = $('.xblock');
- return EditHelpers.showEditModal(requests, xblockElement, model, mockHtml, options);
+ var $xblockElement = $('.xblock');
+ return EditHelpers.showEditModal(requests, $xblockElement, model, mockHtml, options);
};
beforeEach(function() {
diff --git a/cms/static/js/spec/views/modals/move_xblock_modal_spec.js b/cms/static/js/spec/views/modals/move_xblock_modal_spec.js
index f2e8f457b4..72273cb60f 100644
--- a/cms/static/js/spec/views/modals/move_xblock_modal_spec.js
+++ b/cms/static/js/spec/views/modals/move_xblock_modal_spec.js
@@ -1,6 +1,6 @@
define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers',
- 'common/js/spec_helpers/template_helpers', 'common/js/spec_helpers/view_helpers',
- 'js/views/modals/move_xblock_modal', 'js/models/xblock_info'],
+ 'common/js/spec_helpers/template_helpers', 'common/js/spec_helpers/view_helpers',
+ 'js/views/modals/move_xblock_modal', 'js/models/xblock_info'],
function($, _, AjaxHelpers, TemplateHelpers, ViewHelpers, MoveXBlockModal, XBlockInfo) {
'use strict';
describe('MoveXBlockModal', function() {
diff --git a/cms/static/js/spec/views/module_edit_spec.js b/cms/static/js/spec/views/module_edit_spec.js
index 34ad71ea6a..21903b2226 100644
--- a/cms/static/js/spec/views/module_edit_spec.js
+++ b/cms/static/js/spec/views/module_edit_spec.js
@@ -154,7 +154,7 @@
success: jasmine.any(Function)
});
this.moduleEdit.clickEditButton({
- 'preventDefault': jasmine.createSpy('event.preventDefault')
+ preventDefault: jasmine.createSpy('event.preventDefault')
});
mockXBlockEditorHtml = readFixtures('mock/mock-xblock-editor.underscore');
$.ajax.calls.mostRecent().args[0].success({
diff --git a/cms/static/js/spec/views/move_xblock_spec.js b/cms/static/js/spec/views/move_xblock_spec.js
index 3911124f0c..7e7610fdfe 100644
--- a/cms/static/js/spec/views/move_xblock_spec.js
+++ b/cms/static/js/spec/views/move_xblock_spec.js
@@ -1,7 +1,7 @@
define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'js/spec_helpers/edit_helpers',
- 'common/js/spec_helpers/template_helpers', 'common/js/spec_helpers/view_helpers',
- 'js/views/modals/move_xblock_modal', 'js/views/pages/container', 'edx-ui-toolkit/js/utils/html-utils',
- 'edx-ui-toolkit/js/utils/string-utils', 'js/models/xblock_info'],
+ 'common/js/spec_helpers/template_helpers', 'common/js/spec_helpers/view_helpers',
+ 'js/views/modals/move_xblock_modal', 'js/views/pages/container', 'edx-ui-toolkit/js/utils/html-utils',
+ 'edx-ui-toolkit/js/utils/string-utils', 'js/models/xblock_info'],
function($, _, AjaxHelpers, EditHelpers, TemplateHelpers, ViewHelpers, MoveXBlockModal, ContainerPage, HtmlUtils,
StringUtils, XBlockInfo) {
'use strict';
diff --git a/cms/static/js/spec/views/paged_container_spec.js b/cms/static/js/spec/views/paged_container_spec.js
index faafa14699..f1ab83df2a 100644
--- a/cms/static/js/spec/views/paged_container_spec.js
+++ b/cms/static/js/spec/views/paged_container_spec.js
@@ -1,6 +1,6 @@
define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'URI', 'js/models/xblock_info',
- 'js/views/paged_container', 'js/views/paging_header',
- 'common/js/components/views/paging_footer', 'js/views/xblock'],
+ 'js/views/paged_container', 'js/views/paging_header',
+ 'common/js/components/views/paging_footer', 'js/views/xblock'],
function($, _, AjaxHelpers, URI, XBlockInfo, PagedContainer, PagingHeader, PagingFooter, XBlockView) {
var htmlResponseTpl = _.template('' +
'
.outline-content > .add-subsection .button-new').click();
AjaxHelpers.expectJsonRequest(requests, 'POST', '/xblock/', {
- 'category': 'sequential',
- 'display_name': 'Subsection',
- 'parent_locator': 'mock-section'
+ category: 'sequential',
+ display_name: 'Subsection',
+ parent_locator: 'mock-section'
});
AjaxHelpers.respondWithJson(requests, {
- 'locator': 'new-mock-subsection',
- 'courseKey': 'slashes:MockCourse'
+ locator: 'new-mock-subsection',
+ courseKey: 'slashes:MockCourse'
});
// Note: verification of the server response and the UI's handling of it
// is handled in the acceptance tests.
@@ -881,7 +880,7 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
// This is the response for the change operation.
AjaxHelpers.respondWithJson(requests, { });
// This is the response for the subsequent fetch operation.
- AjaxHelpers.respondWithJson(requests, {'display_name': updatedDisplayName});
+ AjaxHelpers.respondWithJson(requests, {display_name: updatedDisplayName});
EditHelpers.verifyInlineEditChange(displayNameWrapper, updatedDisplayName);
sectionModel = outlinePage.model.get('child_info').children[0];
expect(sectionModel.get('display_name')).toBe(updatedDisplayName);
@@ -911,8 +910,8 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
selectBasicSettings();
$('.wrapper-modal-window .action-save').click();
AjaxHelpers.expectJsonRequest(requests, 'POST', '/xblock/mock-section', {
- 'metadata': {
- 'start': '2015-01-02T00:00:00.000Z'
+ metadata: {
+ start: '2015-01-02T00:00:00.000Z'
}
});
expect(requests[0].requestHeaders['X-HTTP-Method-Override']).toBe('PATCH');
@@ -963,16 +962,17 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
createMockVerticalJSON({has_changes: true})
])
])
- ]), modalWindow;
+ ]),
+ modalWindow;
createCourseOutlinePage(this, mockCourseJSON, false);
getItemHeaders('section').first().find('.publish-button').click();
- modalWindow = $('.wrapper-modal-window');
- expect(modalWindow.find('.outline-unit').length).toBe(3);
- expect(_.compact(_.map(modalWindow.find('.outline-unit').text().split('\n'), $.trim))).toEqual(
+ $modalWindow = $('.wrapper-modal-window');
+ expect($modalWindow.find('.outline-unit').length).toBe(3);
+ expect(_.compact(_.map($modalWindow.find('.outline-unit').text().split('\n'), $.trim))).toEqual(
['Unit 100', 'Unit 50', 'Unit 1']
);
- expect(modalWindow.find('.outline-subsection').length).toBe(2);
+ expect($modalWindow.find('.outline-subsection').length).toBe(2);
});
});
@@ -1081,11 +1081,11 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
staff_only_message: true,
is_prereq: false,
show_correctness: 'never',
- 'is_time_limited': true,
- 'is_practice_exam': false,
- 'is_proctored_exam': false,
- 'default_time_limit_minutes': 150,
- 'hide_after_due': true
+ is_time_limited: true,
+ is_practice_exam: false,
+ is_proctored_exam: false,
+ default_time_limit_minutes: 150,
+ hide_after_due: true
}, [
createMockVerticalJSON({
has_changes: true,
@@ -1112,13 +1112,13 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
redirectSpy = spyOn(ViewUtils, 'redirect');
getItemsOfType('subsection').find('> .outline-content > .add-unit .button-new').click();
AjaxHelpers.expectJsonRequest(requests, 'POST', '/xblock/', {
- 'category': 'vertical',
- 'display_name': 'Unit',
- 'parent_locator': 'mock-subsection'
+ category: 'vertical',
+ display_name: 'Unit',
+ parent_locator: 'mock-subsection'
});
AjaxHelpers.respondWithJson(requests, {
- 'locator': 'new-mock-unit',
- 'courseKey': 'slashes:MockCourse'
+ locator: 'new-mock-unit',
+ courseKey: 'slashes:MockCourse'
});
expect(redirectSpy).toHaveBeenCalledWith('/container/new-mock-unit?action=new');
});
@@ -1254,19 +1254,19 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
selectTimedExam('02:30');
$('.wrapper-modal-window .action-save').click();
AjaxHelpers.expectJsonRequest(requests, 'POST', '/xblock/mock-subsection', {
- 'graderType': 'Lab',
- 'publish': 'republish',
- 'isPrereq': false,
- 'metadata': {
- 'visible_to_staff_only': null,
- 'start': '2014-07-09T00:00:00.000Z',
- 'due': '2014-07-10T00:00:00.000Z',
- 'exam_review_rules': '',
- 'is_time_limited': true,
- 'is_practice_exam': false,
- 'is_proctored_enabled': false,
- 'default_time_limit_minutes': 150,
- 'hide_after_due': true
+ graderType: 'Lab',
+ publish: 'republish',
+ isPrereq: false,
+ metadata: {
+ visible_to_staff_only: null,
+ start: '2014-07-09T00:00:00.000Z',
+ due: '2014-07-10T00:00:00.000Z',
+ exam_review_rules: '',
+ is_time_limited: true,
+ is_practice_exam: false,
+ is_proctored_enabled: false,
+ default_time_limit_minutes: 150,
+ hide_after_due: true
}
});
expect(requests[0].requestHeaders['X-HTTP-Method-Override']).toBe('PATCH');
@@ -1383,11 +1383,11 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
}, [
createMockSubsectionJSON({
has_changes: true,
- 'is_time_limited': false,
- 'is_practice_exam': false,
- 'is_proctored_exam': false,
- 'default_time_limit_minutes': 150,
- 'hide_after_due': false
+ is_time_limited: false,
+ is_practice_exam: false,
+ is_proctored_exam: false,
+ default_time_limit_minutes: 150,
+ hide_after_due: false
}, [
])
])
@@ -1412,11 +1412,11 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
}, [
createMockSubsectionJSON({
has_changes: true,
- 'is_time_limited': true,
- 'is_practice_exam': false,
- 'is_proctored_exam': false,
- 'default_time_limit_minutes': 10,
- 'hide_after_due': true
+ is_time_limited: true,
+ is_practice_exam: false,
+ is_proctored_exam: false,
+ default_time_limit_minutes: 10,
+ hide_after_due: true
}, [
])
])
@@ -1441,11 +1441,11 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
}, [
createMockSubsectionJSON({
has_changes: true,
- 'is_time_limited': true,
- 'is_practice_exam': false,
- 'is_proctored_exam': false,
- 'default_time_limit_minutes': 10,
- 'hide_after_due': false
+ is_time_limited: true,
+ is_practice_exam: false,
+ is_proctored_exam: false,
+ default_time_limit_minutes: 10,
+ hide_after_due: false
}, [
])
])
@@ -1471,10 +1471,10 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
}, [
createMockSubsectionJSON({
has_changes: true,
- 'is_time_limited': true,
- 'is_practice_exam': true,
- 'is_proctored_exam': true,
- 'default_time_limit_minutes': 150
+ is_time_limited: true,
+ is_practice_exam: true,
+ is_proctored_exam: true,
+ default_time_limit_minutes: 150
}, [
])
])
@@ -1499,10 +1499,10 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
}, [
createMockSubsectionJSON({
has_changes: true,
- 'is_time_limited': true,
- 'is_practice_exam': false,
- 'is_proctored_exam': true,
- 'default_time_limit_minutes': 150
+ is_time_limited: true,
+ is_practice_exam: false,
+ is_proctored_exam: true,
+ default_time_limit_minutes: 150
}, [
])
])
@@ -1527,11 +1527,11 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
}, [
createMockSubsectionJSON({
has_changes: true,
- 'is_time_limited': true,
- 'is_practice_exam': false,
- 'is_proctored_exam': false,
- 'default_time_limit_minutes': 150,
- 'hide_after_due': true
+ is_time_limited: true,
+ is_practice_exam: false,
+ is_proctored_exam: false,
+ default_time_limit_minutes: 150,
+ hide_after_due: true
}, [
])
])
@@ -1845,16 +1845,17 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
]),
createMockSubsectionJSON({}, [createMockVerticalJSON])
])
- ]), modalWindow;
+ ]),
+ $modalWindow;
createCourseOutlinePage(this, mockCourseJSON, false);
getItemHeaders('subsection').first().find('.publish-button').click();
- modalWindow = $('.wrapper-modal-window');
- expect(modalWindow.find('.outline-unit').length).toBe(2);
- expect(_.compact(_.map(modalWindow.find('.outline-unit').text().split('\n'), $.trim))).toEqual(
+ $modalWindow = $('.wrapper-modal-window');
+ expect($modalWindow.find('.outline-unit').length).toBe(2);
+ expect(_.compact(_.map($modalWindow.find('.outline-unit').text().split('\n'), $.trim))).toEqual(
['Unit 100', 'Unit 50']
);
- expect(modalWindow.find('.outline-subsection')).not.toExist();
+ expect($modalWindow.find('.outline-subsection')).not.toExist();
});
});
diff --git a/cms/static/js/spec/views/pages/course_rerun_spec.js b/cms/static/js/spec/views/pages/course_rerun_spec.js
index 146f3dac7f..fa4f6603a4 100644
--- a/cms/static/js/spec/views/pages/course_rerun_spec.js
+++ b/cms/static/js/spec/views/pages/course_rerun_spec.js
@@ -1,6 +1,6 @@
define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/js/spec_helpers/view_helpers',
- 'js/views/course_rerun', 'js/views/utils/create_course_utils', 'common/js/components/utils/view_utils',
- 'jquery.simulate'],
+ 'js/views/course_rerun', 'js/views/utils/create_course_utils', 'common/js/components/utils/view_utils',
+ 'jquery.simulate'],
function($, AjaxHelpers, ViewHelpers, CourseRerunUtils, CreateCourseUtilsFactory, ViewUtils) {
describe('Create course rerun page', function() {
var selectors = {
@@ -108,34 +108,34 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
});
it('shows an error message when non URL characters are entered', function() {
- var input = $(selectors.org);
- expect(input.parent()).not.toHaveClass(classes.error);
- type(input, '%');
- expect(input.parent()).toHaveClass(classes.error);
+ var $input = $(selectors.org);
+ expect($input.parent()).not.toHaveClass(classes.error);
+ type($input, '%');
+ expect($input.parent()).toHaveClass(classes.error);
});
it('does not show an error message when tabbing into a field', function() {
- var input = $(selectors.number);
- input.val('');
- expect(input.parent()).not.toHaveClass(classes.error);
- input.simulate('keyup', {keyCode: $.simulate.keyCode.TAB});
- expect(input.parent()).not.toHaveClass(classes.error);
+ var $input = $(selectors.number);
+ $input.val('');
+ expect($input.parent()).not.toHaveClass(classes.error);
+ $input.simulate('keyup', {keyCode: $.simulate.keyCode.TAB});
+ expect($input.parent()).not.toHaveClass(classes.error);
});
it('shows an error message when a required field is empty', function() {
- var input = $(selectors.org);
- input.val('');
- expect(input.parent()).not.toHaveClass(classes.error);
- input.simulate('keyup', {keyCode: $.simulate.keyCode.ENTER});
- expect(input.parent()).toHaveClass(classes.error);
+ var $input = $(selectors.org);
+ $input.val('');
+ expect($input.parent()).not.toHaveClass(classes.error);
+ $input.simulate('keyup', {keyCode: $.simulate.keyCode.ENTER});
+ expect($input.parent()).toHaveClass(classes.error);
});
it('shows an error message when spaces are entered and unicode is allowed', function() {
- var input = $(selectors.org);
+ var $input = $(selectors.org);
$(selectors.allowUnicode).val('True');
- expect(input.parent()).not.toHaveClass(classes.error);
- type(input, ' ');
- expect(input.parent()).toHaveClass(classes.error);
+ expect($input.parent()).not.toHaveClass(classes.error);
+ type($input, ' ');
+ expect($input.parent()).toHaveClass(classes.error);
});
it('shows an error message when total length exceeds 65 characters', function() {
@@ -148,10 +148,10 @@ define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/j
describe('Name field', function() {
it('does not show an error message when non URL characters are entered', function() {
- var input = $(selectors.name);
- expect(input.parent()).not.toHaveClass(classes.error);
- type(input, '%');
- expect(input.parent()).not.toHaveClass(classes.error);
+ var $input = $(selectors.name);
+ expect($input.parent()).not.toHaveClass(classes.error);
+ type($input, '%');
+ expect($input.parent()).not.toHaveClass(classes.error);
});
});
});
diff --git a/cms/static/js/spec/views/pages/index_spec.js b/cms/static/js/spec/views/pages/index_spec.js
index a47c9983ef..8533e1b9f2 100644
--- a/cms/static/js/spec/views/pages/index_spec.js
+++ b/cms/static/js/spec/views/pages/index_spec.js
@@ -1,7 +1,7 @@
define(['jquery',
- 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers',
- 'common/js/spec_helpers/view_helpers', 'js/index',
- 'common/js/components/utils/view_utils'],
+ 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers',
+ 'common/js/spec_helpers/view_helpers', 'js/index',
+ 'common/js/components/utils/view_utils'],
function($, AjaxHelpers, ViewHelpers, IndexUtils, ViewUtils) {
describe('Course listing page', function() {
var mockIndexPageHTML = readFixtures('mock/mock-index-page.underscore');
diff --git a/cms/static/js/spec/views/pages/library_users_spec.js b/cms/static/js/spec/views/pages/library_users_spec.js
index 370bf8cb45..bfe3e17bb5 100644
--- a/cms/static/js/spec/views/pages/library_users_spec.js
+++ b/cms/static/js/spec/views/pages/library_users_spec.js
@@ -9,10 +9,10 @@ function($, AjaxHelpers, ViewHelpers, ManageUsersFactory, ViewUtils) {
var team_member_fixture = readFixtures('team-member.underscore');
function setRole(email, role) {
- var user_li = $('li.user-item[data-email="' + email + '"]');
- var role_action = $('li.action-role a.make-' + role, user_li);
- expect(role_action).toBeVisible();
- role_action.click();
+ var $user_li = $('li.user-item[data-email="' + email + '"]');
+ var $role_action = $('li.action-role a.make-' + role, $user_li);
+ expect($role_action).toBeVisible();
+ $role_action.click();
}
function getUrl(email) {
@@ -56,7 +56,7 @@ function($, AjaxHelpers, ViewHelpers, ManageUsersFactory, ViewUtils) {
$('.user-email-input').val(email);
$('.form-create.create-user .action-primary').click();
AjaxHelpers.expectJsonRequest(requests, 'POST', getUrl(email), {role: 'library_user'});
- AjaxHelpers.respondWithJson(requests, {'result': 'ok'});
+ AjaxHelpers.respondWithJson(requests, {result: 'ok'});
expect(reloadSpy).toHaveBeenCalled();
});
@@ -66,7 +66,7 @@ function($, AjaxHelpers, ViewHelpers, ManageUsersFactory, ViewUtils) {
var reloadSpy = spyOn(ViewUtils, 'reload');
setRole('staff@example.com', 'staff');
AjaxHelpers.expectJsonRequest(requests, 'POST', getUrl(email), {role: 'staff'});
- AjaxHelpers.respondWithJson(requests, {'result': 'ok'});
+ AjaxHelpers.respondWithJson(requests, {result: 'ok'});
expect(reloadSpy).toHaveBeenCalled();
});
@@ -109,7 +109,7 @@ function($, AjaxHelpers, ViewHelpers, ManageUsersFactory, ViewUtils) {
ViewHelpers.confirmPrompt(promptSpy);
ViewHelpers.verifyPromptHidden(promptSpy);
AjaxHelpers.expectJsonRequest(requests, 'DELETE', getUrl(email), {role: null});
- AjaxHelpers.respondWithJson(requests, {'result': 'ok'});
+ AjaxHelpers.respondWithJson(requests, {result: 'ok'});
expect(reloadSpy).toHaveBeenCalled();
});
});
diff --git a/cms/static/js/spec/views/previous_video_upload_list_spec.js b/cms/static/js/spec/views/previous_video_upload_list_spec.js
index e5563db519..7202384489 100644
--- a/cms/static/js/spec/views/previous_video_upload_list_spec.js
+++ b/cms/static/js/spec/views/previous_video_upload_list_spec.js
@@ -1,6 +1,6 @@
define(
['jquery', 'underscore', 'backbone', 'js/views/previous_video_upload_list',
- 'common/js/spec_helpers/template_helpers', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers'],
+ 'common/js/spec_helpers/template_helpers', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers'],
function($, _, Backbone, PreviousVideoUploadListView, TemplateHelpers, AjaxHelpers) {
'use strict';
describe('PreviousVideoUploadListView', function() {
diff --git a/cms/static/js/spec/views/previous_video_upload_spec.js b/cms/static/js/spec/views/previous_video_upload_spec.js
index 6698b2dda3..9a9c0041d1 100644
--- a/cms/static/js/spec/views/previous_video_upload_spec.js
+++ b/cms/static/js/spec/views/previous_video_upload_spec.js
@@ -1,6 +1,6 @@
define(
['jquery', 'underscore', 'backbone', 'js/views/previous_video_upload', 'common/js/spec_helpers/template_helpers',
- 'common/js/spec_helpers/view_helpers'],
+ 'common/js/spec_helpers/view_helpers'],
function($, _, Backbone, PreviousVideoUploadView, TemplateHelpers, ViewHelpers) {
'use strict';
describe('PreviousVideoUploadView', function() {
diff --git a/cms/static/js/spec/views/settings/main_spec.js b/cms/static/js/spec/views/settings/main_spec.js
index 372318ee6d..f378879fb1 100644
--- a/cms/static/js/spec/views/settings/main_spec.js
+++ b/cms/static/js/spec/views/settings/main_spec.js
@@ -47,7 +47,7 @@ define([
language: '',
learning_info: [''],
instructor_info: {
- 'instructors': [{'name': '', 'title': '', 'organization': '', 'image': '', 'bio': ''}]
+ instructors: [{name: '', title: '', organization: '', image: '', bio: ''}]
},
self_paced: false
},
@@ -69,7 +69,7 @@ define([
this.model = new CourseDetailsModel($.extend(true, {}, modelData, {
instructor_info: {
- 'instructors': [{'name': '', 'title': '', 'organization': '', 'image': '', 'bio': ''}]
+ instructors: [{name: '', title: '', organization: '', image: '', bio: ''}]
}}), {parse: true});
this.model.urlRoot = urlRoot;
this.view = new MainView({
@@ -326,13 +326,13 @@ define([
expectedJson = $.extend(true, {}, modelData, {
instructor_info: {
instructors:
- [{
- 'name': 'test_name',
- 'title': 'test_title',
- 'organization': 'test_org',
- 'image': 'test_image',
- 'bio': 'test_bio'
- }]
+ [{
+ name: 'test_name',
+ title: 'test_title',
+ organization: 'test_org',
+ image: 'test_image',
+ bio: 'test_bio'
+ }]
}
});
diff --git a/cms/static/js/spec/views/unit_outline_spec.js b/cms/static/js/spec/views/unit_outline_spec.js
index c55c2de5a3..7ad7b3576f 100644
--- a/cms/static/js/spec/views/unit_outline_spec.js
+++ b/cms/static/js/spec/views/unit_outline_spec.js
@@ -1,6 +1,6 @@
define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/js/spec_helpers/template_helpers',
- 'common/js/spec_helpers/view_helpers', 'common/js/components/utils/view_utils', 'js/models/course',
- 'js/views/unit_outline', 'js/models/xblock_info'],
+ 'common/js/spec_helpers/view_helpers', 'common/js/components/utils/view_utils', 'js/models/course',
+ 'js/views/unit_outline', 'js/models/xblock_info'],
function($, AjaxHelpers, TemplateHelpers, ViewHelpers, ViewUtils,
Course, UnitOutlineView, XBlockInfo) {
'use strict';
diff --git a/cms/static/js/spec/views/xblock_editor_spec.js b/cms/static/js/spec/views/xblock_editor_spec.js
index 76e0a5c2eb..f1499752e1 100644
--- a/cms/static/js/spec/views/xblock_editor_spec.js
+++ b/cms/static/js/spec/views/xblock_editor_spec.js
@@ -76,7 +76,8 @@ define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpe
});
it('saves any custom metadata', function() {
- var requests = AjaxHelpers.requests(this), request, response;
+ var requests = AjaxHelpers.requests(this),
+ request, response;
editor.render();
AjaxHelpers.respondWithJson(requests, {
html: mockXModuleEditorHtml,
@@ -92,7 +93,8 @@ define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpe
});
it('can render a module with only settings', function() {
- var requests = AjaxHelpers.requests(this), mockXModuleEditorHtml;
+ var requests = AjaxHelpers.requests(this),
+ mockXModuleEditorHtml;
mockXModuleEditorHtml = readFixtures('mock/mock-xmodule-settings-only-editor.underscore');
editor.render();
diff --git a/cms/static/js/spec/views/xblock_spec.js b/cms/static/js/spec/views/xblock_spec.js
index 9b9f1e5f09..8194461889 100644
--- a/cms/static/js/spec/views/xblock_spec.js
+++ b/cms/static/js/spec/views/xblock_spec.js
@@ -1,5 +1,5 @@
define(['jquery', 'URI', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/js/components/utils/view_utils',
- 'js/views/xblock', 'js/models/xblock_info', 'xmodule', 'cms/js/main', 'xblock/cms.runtime.v1'],
+ 'js/views/xblock', 'js/models/xblock_info', 'xmodule', 'cms/js/main', 'xblock/cms.runtime.v1'],
function($, URI, AjaxHelpers, ViewUtils, XBlockView, XBlockInfo) {
'use strict';
describe('XBlockView', function() {
diff --git a/cms/static/js/spec/views/xblock_string_field_editor_spec.js b/cms/static/js/spec/views/xblock_string_field_editor_spec.js
index a92f0b0fed..c9fa7e0c8c 100644
--- a/cms/static/js/spec/views/xblock_string_field_editor_spec.js
+++ b/cms/static/js/spec/views/xblock_string_field_editor_spec.js
@@ -1,5 +1,5 @@
define(['jquery', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers', 'common/js/spec_helpers/template_helpers',
- 'js/spec_helpers/edit_helpers', 'js/models/xblock_info', 'js/views/xblock_string_field_editor'],
+ 'js/spec_helpers/edit_helpers', 'js/models/xblock_info', 'js/views/xblock_string_field_editor'],
function($, AjaxHelpers, TemplateHelpers, EditHelpers, XBlockInfo, XBlockStringFieldEditor) {
describe('XBlockStringFieldEditorView', function() {
var initialDisplayName, updatedDisplayName, getXBlockInfo, getFieldEditorView;
diff --git a/cms/static/js/spec/views/xblock_validation_spec.js b/cms/static/js/spec/views/xblock_validation_spec.js
index f5e8c551b0..c6fb7b1207 100644
--- a/cms/static/js/spec/views/xblock_validation_spec.js
+++ b/cms/static/js/spec/views/xblock_validation_spec.js
@@ -32,14 +32,15 @@ define(['jquery', 'js/models/xblock_validation', 'js/views/xblock_validation', '
});
it('can add additional classes', function() {
- var noContainerContent = 'no-container-content', notConfiguredModel, nonRootView, rootView;
+ var noContainerContent = 'no-container-content',
+ notConfiguredModel, nonRootView, rootView;
expect(view.getAdditionalClasses()).toBe('');
expect(view.$('.validation')).not.toHaveClass(noContainerContent);
notConfiguredModel = new XBlockValidationModel({
- 'empty': false, 'summary': {'text': 'Not configured', 'type': model.NOT_CONFIGURED},
- 'xblock_id': 'id'
+ empty: false, summary: {text: 'Not configured', type: model.NOT_CONFIGURED},
+ xblock_id: 'id'
},
{parse: true}
);
@@ -60,19 +61,19 @@ define(['jquery', 'js/models/xblock_validation', 'js/views/xblock_validation', '
beforeEach(function() {
model = new XBlockValidationModel({
- 'empty': false,
- 'summary': {
- 'text': 'Summary message', 'type': 'error',
- 'action_label': 'Summary Action', 'action_class': 'edit-button'
+ empty: false,
+ summary: {
+ text: 'Summary message', type: 'error',
+ action_label: 'Summary Action', action_class: 'edit-button'
},
- 'messages': [
+ messages: [
{
- 'text': 'First message', 'type': 'warning',
- 'action_label': 'First Message Action', 'action_runtime_event': 'fix-up'
+ text: 'First message', type: 'warning',
+ action_label: 'First Message Action', action_runtime_event: 'fix-up'
},
- {'text': 'Second message', 'type': 'error'}
+ {text: 'Second message', type: 'error'}
],
- 'xblock_id': 'id'
+ xblock_id: 'id'
});
view = new XBlockValidationView({model: model});
view.render();
@@ -111,10 +112,11 @@ define(['jquery', 'js/models/xblock_validation', 'js/views/xblock_validation', '
it('renders a summary only', function() {
var summaryOnlyModel = new XBlockValidationModel({
- 'empty': false,
- 'summary': {'text': 'Summary message', 'type': 'warning'},
- 'xblock_id': 'id'
- }), summaryOnlyView, details;
+ empty: false,
+ summary: {text: 'Summary message', type: 'warning'},
+ xblock_id: 'id'
+ }),
+ summaryOnlyView, details;
summaryOnlyView = new XBlockValidationView({model: summaryOnlyModel});
summaryOnlyView.render();
diff --git a/cms/static/js/spec_helpers/assertion_helpers.js b/cms/static/js/spec_helpers/assertion_helpers.js
index 9b8f9d79b9..dfb4309118 100644
--- a/cms/static/js/spec_helpers/assertion_helpers.js
+++ b/cms/static/js/spec_helpers/assertion_helpers.js
@@ -2,7 +2,7 @@
* Provides helper methods for invoking Studio modal windows in Jasmine tests.
*/
define(['jquery', 'common/js/components/views/feedback_notification', 'common/js/components/views/feedback_prompt',
- 'common/js/spec_helpers/template_helpers'],
+ 'common/js/spec_helpers/template_helpers'],
function($, NotificationView, Prompt, TemplateHelpers) {
var installViewTemplates, createFeedbackSpy, verifyFeedbackShowing,
verifyFeedbackHidden, createNotificationSpy, verifyNotificationShowing,
@@ -72,17 +72,17 @@ define(['jquery', 'common/js/components/views/feedback_notification', 'common/js
};
return {
- 'installViewTemplates': installViewTemplates,
- 'createNotificationSpy': createNotificationSpy,
- 'verifyNotificationShowing': verifyNotificationShowing,
- 'verifyNotificationHidden': verifyNotificationHidden,
- 'confirmPrompt': confirmPrompt,
- 'createPromptSpy': createPromptSpy,
- 'verifyPromptShowing': verifyPromptShowing,
- 'verifyPromptHidden': verifyPromptHidden,
- 'inlineEdit': inlineEdit,
- 'verifyInlineEditChange': verifyInlineEditChange,
- 'installMockAnalytics': installMockAnalytics,
- 'removeMockAnalytics': removeMockAnalytics
+ installViewTemplates: installViewTemplates,
+ createNotificationSpy: createNotificationSpy,
+ verifyNotificationShowing: verifyNotificationShowing,
+ verifyNotificationHidden: verifyNotificationHidden,
+ confirmPrompt: confirmPrompt,
+ createPromptSpy: createPromptSpy,
+ verifyPromptShowing: verifyPromptShowing,
+ verifyPromptHidden: verifyPromptHidden,
+ inlineEdit: inlineEdit,
+ verifyInlineEditChange: verifyInlineEditChange,
+ installMockAnalytics: installMockAnalytics,
+ removeMockAnalytics: removeMockAnalytics
};
});
diff --git a/cms/static/js/spec_helpers/edit_helpers.js b/cms/static/js/spec_helpers/edit_helpers.js
index b8ea0b053e..5c417aefbe 100644
--- a/cms/static/js/spec_helpers/edit_helpers.js
+++ b/cms/static/js/spec_helpers/edit_helpers.js
@@ -2,8 +2,8 @@
* Provides helper methods for invoking Studio editors in Jasmine tests.
*/
define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers',
- 'common/js/spec_helpers/template_helpers', 'js/spec_helpers/modal_helpers', 'js/views/modals/edit_xblock',
- 'js/collections/component_template', 'xmodule', 'cms/js/main', 'xblock/cms.runtime.v1'],
+ 'common/js/spec_helpers/template_helpers', 'js/spec_helpers/modal_helpers', 'js/views/modals/edit_xblock',
+ 'js/collections/component_template', 'xmodule', 'cms/js/main', 'xblock/cms.runtime.v1'],
function($, _, AjaxHelpers, TemplateHelpers, modal_helpers, EditXBlockModal, ComponentTemplates) {
var installMockXBlock, uninstallMockXBlock, installMockXModule, uninstallMockXModule,
mockComponentTemplates, installEditTemplates, showEditModal, verifyXBlockRequest;
@@ -40,30 +40,30 @@ define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpe
mockComponentTemplates = new ComponentTemplates([
{
- 'templates': [
+ templates: [
{
- 'category': 'discussion',
- 'display_name': 'Discussion'
+ category: 'discussion',
+ display_name: 'Discussion'
}],
- 'type': 'discussion',
- 'support_legend': {'show_legend': false}
+ type: 'discussion',
+ support_legend: {show_legend: false}
}, {
- 'templates': [
+ templates: [
{
- 'category': 'html',
- 'boilerplate_name': null,
- 'display_name': 'Text'
+ category: 'html',
+ boilerplate_name: null,
+ display_name: 'Text'
}, {
- 'category': 'html',
- 'boilerplate_name': 'announcement.yaml',
- 'display_name': 'Announcement'
+ category: 'html',
+ boilerplate_name: 'announcement.yaml',
+ display_name: 'Announcement'
}, {
- 'category': 'html',
- 'boilerplate_name': 'raw.yaml',
- 'display_name': 'Raw HTML'
+ category: 'html',
+ boilerplate_name: 'raw.yaml',
+ display_name: 'Raw HTML'
}],
- 'type': 'html',
- 'support_legend': {'show_legend': false}
+ type: 'html',
+ support_legend: {show_legend: false}
}],
{
parse: true
@@ -95,7 +95,7 @@ define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpe
modal.edit(xblockElement, model, options);
AjaxHelpers.respondWithJson(requests, {
html: mockHtml,
- 'resources': []
+ resources: []
});
return modal;
};
@@ -109,13 +109,13 @@ define(['jquery', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpe
};
return $.extend(modal_helpers, {
- 'installMockXBlock': installMockXBlock,
- 'uninstallMockXBlock': uninstallMockXBlock,
- 'installMockXModule': installMockXModule,
- 'uninstallMockXModule': uninstallMockXModule,
- 'mockComponentTemplates': mockComponentTemplates,
- 'installEditTemplates': installEditTemplates,
- 'showEditModal': showEditModal,
- 'verifyXBlockRequest': verifyXBlockRequest
+ installMockXBlock: installMockXBlock,
+ uninstallMockXBlock: uninstallMockXBlock,
+ installMockXModule: installMockXModule,
+ uninstallMockXModule: uninstallMockXModule,
+ mockComponentTemplates: mockComponentTemplates,
+ installEditTemplates: installEditTemplates,
+ showEditModal: showEditModal,
+ verifyXBlockRequest: verifyXBlockRequest
});
});
diff --git a/cms/static/js/spec_helpers/modal_helpers.js b/cms/static/js/spec_helpers/modal_helpers.js
index 3724fdc4ae..3b6c154cb3 100644
--- a/cms/static/js/spec_helpers/modal_helpers.js
+++ b/cms/static/js/spec_helpers/modal_helpers.js
@@ -13,13 +13,13 @@ define(['jquery', 'common/js/spec_helpers/template_helpers', 'common/js/spec_hel
};
getModalElement = function(modal) {
- var modalElement;
+ var $modalElement;
if (modal) {
- modalElement = modal.$('.wrapper-modal-window');
+ $modalElement = modal.$('.wrapper-modal-window');
} else {
- modalElement = $('.wrapper-modal-window');
+ $modalElement = $('.wrapper-modal-window');
}
- return modalElement;
+ return $modalElement;
};
getModalWindow = function(modal) {
@@ -62,14 +62,14 @@ define(['jquery', 'common/js/spec_helpers/template_helpers', 'common/js/spec_hel
};
return $.extend(ViewHelpers, {
- 'getModalElement': getModalElement,
- 'getModalWindow': getModalWindow,
- 'getModalTitle': getModalTitle,
- 'installModalTemplates': installModalTemplates,
- 'isShowingModal': isShowingModal,
- 'hideModalIfShowing': hideModalIfShowing,
- 'pressModalButton': pressModalButton,
- 'cancelModal': cancelModal,
- 'cancelModalIfShowing': cancelModalIfShowing
+ getModalElement: getModalElement,
+ getModalWindow: getModalWindow,
+ getModalTitle: getModalTitle,
+ installModalTemplates: installModalTemplates,
+ isShowingModal: isShowingModal,
+ hideModalIfShowing: hideModalIfShowing,
+ pressModalButton: pressModalButton,
+ cancelModal: cancelModal,
+ cancelModalIfShowing: cancelModalIfShowing
});
});
diff --git a/cms/static/js/spec_helpers/validation_helpers.js b/cms/static/js/spec_helpers/validation_helpers.js
index 4d254a3858..ea05bfd74b 100644
--- a/cms/static/js/spec_helpers/validation_helpers.js
+++ b/cms/static/js/spec_helpers/validation_helpers.js
@@ -27,8 +27,8 @@ define(['jquery', 'js/spec_helpers/modal_helpers', 'common/js/spec_helpers/templ
};
return $.extend(ModalHelpers, {
- 'installValidationTemplates': installValidationTemplates,
- 'checkErrorContents': checkErrorContents,
- 'undoChanges': undoChanges
+ installValidationTemplates: installValidationTemplates,
+ checkErrorContents: checkErrorContents,
+ undoChanges: undoChanges
});
});
diff --git a/cms/static/js/utils/change_on_enter.js b/cms/static/js/utils/change_on_enter.js
index 7769733b8a..9dc19753a7 100644
--- a/cms/static/js/utils/change_on_enter.js
+++ b/cms/static/js/utils/change_on_enter.js
@@ -1,8 +1,7 @@
define(['jquery'], function($) {
// Trigger "Change" event on "Enter" keyup event
var triggerChangeEventOnEnter = function(e) {
- if (e.which == 13)
- {
+ if (e.which == 13) {
$(this).trigger('change').blur();
}
};
diff --git a/cms/static/js/utils/date_utils.js b/cms/static/js/utils/date_utils.js
index 09c2c6e1ce..4d9d5aaa4e 100644
--- a/cms/static/js/utils/date_utils.js
+++ b/cms/static/js/utils/date_utils.js
@@ -25,7 +25,7 @@ function($, date, TriggerChangeEventOnEnter) {
};
// instrument as date and time pickers
- timefield.timepicker({'timeFormat': 'H:i'});
+ timefield.timepicker({timeFormat: 'H:i'});
datefield.datepicker();
// Using the change event causes setfield to be triggered twice, but it is necessary
@@ -52,7 +52,8 @@ function($, date, TriggerChangeEventOnEnter) {
// given a pair of inputs (datepicker and timepicker), return a JS Date
// object that corresponds to the datetime.js that they represent. Assume
// UTC timezone, NOT the timezone of the user's browser.
- var date = null, time = null;
+ var date = null,
+ time = null;
if (datepickerInput.length > 0) {
date = $(datepickerInput).datepicker('getDate');
}
@@ -97,8 +98,7 @@ function($, date, TriggerChangeEventOnEnter) {
var parseDateFromString = function(stringDate) {
if (stringDate && typeof stringDate === 'string') {
return new Date(stringDate);
- }
- else {
+ } else {
return stringDate;
}
};
diff --git a/cms/static/js/utils/drag_and_drop.js b/cms/static/js/utils/drag_and_drop.js
index 9f51c0184e..f048137f2f 100644
--- a/cms/static/js/utils/drag_and_drop.js
+++ b/cms/static/js/utils/drag_and_drop.js
@@ -1,5 +1,5 @@
define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
- 'js/utils/module', 'common/js/components/views/feedback_notification'],
+ 'js/utils/module', 'common/js/components/views/feedback_notification'],
function($, ui, _, gettext, Draggabilly, ModuleUtils, NotificationView) {
'use strict';
@@ -17,20 +17,20 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
findDestination: function(ele, yChange) {
var eleY = ele.offset().top;
var eleYEnd = eleY + ele.outerHeight();
- var containers = $(ele.data('droppable-class'));
+ var $containers = $(ele.data('droppable-class'));
var isSibling = function() {
return $(this).data('locator') !== undefined && !$(this).is(ele);
};
- for (var i = 0; i < containers.length; i++) {
- var container = $(containers[i]);
+ for (var i = 0; i < $containers.length; i++) {
+ var $container = $($containers[i]);
// Exclude the 'new unit' buttons, and make sure we don't
// prepend an element to itself
- var siblings = container.children().filter(isSibling);
+ var siblings = $container.children().filter(isSibling);
// If the container is collapsed, check to see if the
// element is on top of its parent list -- don't check the
// position of the container
- var parentList = container.parents(ele.data('parent-location-selector')).first();
+ var parentList = $container.parents(ele.data('parent-location-selector')).first();
if (parentList.hasClass(this.collapsedClass)) {
var parentListTop = parentList.offset().top;
// To make it easier to drop subsections into collapsed sections (which have
@@ -42,7 +42,7 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
eleYEnd - collapseFudge <= parentListTop + parentList.outerHeight())
) {
return {
- ele: container,
+ ele: $container,
attachMethod: 'prepend',
parentList: parentList
};
@@ -54,12 +54,12 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
// unless both elements are at the same location --
// this prevents the user from being unable to expand
// a section
- var containerY = container.offset().top;
+ var containerY = $container.offset().top;
if (siblings.length === 0 &&
containerY !== eleY &&
Math.abs(eleY - containerY) < 50) {
return {
- ele: container,
+ ele: $container,
attachMethod: 'prepend'
};
}
@@ -100,8 +100,7 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
attachMethod: 'after'
};
}
- }
- else {
+ } else {
// Dragging up into end of list.
if (j === siblings.length - 1 && yChange < 0 &&
Math.abs(eleY - siblingYEnd) <= fudge) {
@@ -126,8 +125,7 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
ele: $sibling,
attachMethod: 'after'
};
- }
- else if (eleY >= siblingY && eleY <= siblingYEnd) {
+ } else if (eleY >= siblingY && eleY <= siblingYEnd) {
return {
ele: $sibling,
attachMethod: eleY - siblingY <= siblingHeight / 2 ? 'before' : 'after'
@@ -149,7 +147,7 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
dragState: {},
onDragStart: function(draggable) {
- var ele = $(draggable.element);
+ var $ele = $(draggable.element);
this.dragState = {
// Which element will be dropped into/onto on success
dropDestination: null,
@@ -162,18 +160,18 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
// The direction the drag is moving in (negative means up, positive down).
dragDirection: 0
};
- if (!ele.hasClass(this.collapsedClass)) {
- ele.addClass(this.collapsedClass);
- ele.find('.expand-collapse').first().addClass('expand').removeClass('collapse');
+ if (!$ele.hasClass(this.collapsedClass)) {
+ $ele.addClass(this.collapsedClass);
+ $ele.find('.expand-collapse').first().addClass('expand').removeClass('collapse');
// onDragStart gets called again after the collapse, so we can't
// just store a variable in the dragState.
- ele.addClass(this.expandOnDropClass);
+ $ele.addClass(this.expandOnDropClass);
}
// We should remove this class name before start dragging to
// avoid performance issues.
- ele.removeClass('was-dragging');
+ $ele.removeClass('was-dragging');
},
onDragMove: function(draggable, event, pointer) {
@@ -182,8 +180,7 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
var dragBuffer = 10;
if (window.innerHeight - dragBuffer < pointer.clientY) {
scrollAmount = dragBuffer;
- }
- else if (dragBuffer > pointer.clientY) {
+ } else if (dragBuffer > pointer.clientY) {
scrollAmount = -(dragBuffer);
}
if (scrollAmount !== 0) {
@@ -197,8 +194,8 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
}
this.dragState.lastY = draggable.dragPoint.y;
- var ele = $(draggable.element);
- var destinationInfo = this.findDestination(ele, this.dragState.direction);
+ var $ele = $(draggable.element);
+ var destinationInfo = this.findDestination($ele, this.dragState.direction);
var destinationEle = destinationInfo.ele;
this.dragState.parentList = destinationInfo.parentList;
@@ -207,52 +204,51 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
this.dragState.dropDestination.removeClass(this.droppableClasses);
}
// Mark the new destination
- if (destinationEle && this.pointerInBounds(pointer, ele)) {
- ele.addClass(this.validDropClass);
+ if (destinationEle && this.pointerInBounds(pointer, $ele)) {
+ $ele.addClass(this.validDropClass);
destinationEle.addClass('drop-target drop-target-' + destinationInfo.attachMethod);
this.dragState.attachMethod = destinationInfo.attachMethod;
this.dragState.dropDestination = destinationEle;
- }
- else {
- ele.removeClass(this.validDropClass);
+ } else {
+ $ele.removeClass(this.validDropClass);
this.dragState.attachMethod = '';
this.dragState.dropDestination = null;
}
},
onDragEnd: function(draggable, event, pointer) {
- var ele = $(draggable.element);
+ var $ele = $(draggable.element);
var destination = this.dragState.dropDestination;
// Clear dragging state in preparation for the next event.
if (destination) {
destination.removeClass(this.droppableClasses);
}
- ele.removeClass(this.validDropClass);
+ $ele.removeClass(this.validDropClass);
// If the drag succeeded, rearrange the DOM and send the result.
- if (destination && this.pointerInBounds(pointer, ele)) {
+ if (destination && this.pointerInBounds(pointer, $ele)) {
// Make sure we don't drop into a collapsed element
if (this.dragState.parentList) {
this.expandElement(this.dragState.parentList);
}
var method = this.dragState.attachMethod;
- destination[method](ele);
- this.handleReorder(ele);
+ destination[method]($ele);
+ this.handleReorder($ele);
}
// If the drag failed, send it back
else {
$('.was-dragging').removeClass('was-dragging');
- ele.addClass('was-dragging');
+ $ele.addClass('was-dragging');
}
- if (ele.hasClass(this.expandOnDropClass)) {
- this.expandElement(ele);
- ele.removeClass(this.expandOnDropClass);
+ if ($ele.hasClass(this.expandOnDropClass)) {
+ this.expandElement($ele);
+ $ele.removeClass(this.expandOnDropClass);
}
// Everything in its right place
- ele.css({
+ $ele.css({
top: 'auto',
left: 'auto'
});
@@ -371,8 +367,8 @@ define(['jquery', 'jquery.ui', 'underscore', 'gettext', 'draggabilly',
'droppable-class': options.droppableClass,
'parent-location-selector': options.parentLocationSelector,
'child-selector': options.type,
- 'refresh': options.refresh,
- 'ensureChildrenRendered': options.ensureChildrenRendered
+ refresh: options.refresh,
+ ensureChildrenRendered: options.ensureChildrenRendered
});
draggable = new Draggabilly(element, {
diff --git a/cms/static/js/utils/handle_iframe_binding.js b/cms/static/js/utils/handle_iframe_binding.js
index 40fb163ca4..bd874c2865 100644
--- a/cms/static/js/utils/handle_iframe_binding.js
+++ b/cms/static/js/utils/handle_iframe_binding.js
@@ -36,8 +36,7 @@ define(['jquery'], function($) {
$(this).attr('src', ifr_source + '?' + wmode);
}
}
- }
- else {
+ } else {
$(this).attr('wmode', 'transparent');
}
});
diff --git a/cms/static/js/utils/modal.js b/cms/static/js/utils/modal.js
index 8e597aa45f..719ae3ca07 100644
--- a/cms/static/js/utils/modal.js
+++ b/cms/static/js/utils/modal.js
@@ -59,8 +59,7 @@ define(['jquery'], function($) {
$modalCover.unbind('click');
if (clickHandler) {
$modalCover.bind('click', clickHandler);
- }
- else {
+ } else {
$modalCover.bind('click', hideModal);
}
return $modalCover;
diff --git a/cms/static/js/utils/module.js b/cms/static/js/utils/module.js
index f018ca0c22..3d965748c5 100644
--- a/cms/static/js/utils/module.js
+++ b/cms/static/js/utils/module.js
@@ -13,8 +13,7 @@ define(['underscore'], function(_) {
var getUpdateUrl = function(locator) {
if (_.isUndefined(locator)) {
return urlRoot + '/';
- }
- else {
+ } else {
return urlRoot + '/' + locator;
}
};
diff --git a/cms/static/js/views/abstract_editor.js b/cms/static/js/views/abstract_editor.js
index 273a2e4560..81ff65a5e1 100644
--- a/cms/static/js/views/abstract_editor.js
+++ b/cms/static/js/views/abstract_editor.js
@@ -72,8 +72,7 @@ define(['js/views/baseview', 'underscore'], function(BaseView, _) {
if (this.model.isExplicitlySet()) {
this.showClearButton();
- }
- else {
+ } else {
this.$el.removeClass('is-set');
this.getClearButton().addClass('inactive');
this.getClearButton().removeClass('active');
diff --git a/cms/static/js/views/asset.js b/cms/static/js/views/asset.js
index 6c8b1f8bc0..541ffe780c 100644
--- a/cms/static/js/views/asset.js
+++ b/cms/static/js/views/asset.js
@@ -1,5 +1,5 @@
define(['js/views/baseview', 'underscore', 'gettext', 'common/js/components/views/feedback_prompt',
- 'common/js/components/views/feedback_notification'],
+ 'common/js/components/views/feedback_notification'],
function(BaseView, _, gettext, PromptView, NotificationView) {
var AssetView = BaseView.extend({
initialize: function() {
@@ -36,8 +36,7 @@ define(['js/views/baseview', 'underscore', 'gettext', 'common/js/components/view
if (this.model.get('locked')) {
this.$el.addClass(locked_class);
this.$el.find('.lock-checkbox').attr('checked', 'checked');
- }
- else {
+ } else {
this.$el.removeClass(locked_class);
this.$el.find('.lock-checkbox').removeAttr('checked');
}
@@ -45,7 +44,8 @@ define(['js/views/baseview', 'underscore', 'gettext', 'common/js/components/view
confirmDelete: function(e) {
if (e && e.preventDefault) { e.preventDefault(); }
- var asset = this.model, collection = this.model.collection;
+ var asset = this.model,
+ collection = this.model.collection;
new PromptView.Warning({
title: gettext('Delete File Confirmation'),
message: gettext('Are you sure you wish to delete this item. It cannot be reversed!\n\nAlso any content that links/refers to this item will no longer work (e.g. broken images and/or links)'),
@@ -81,7 +81,7 @@ define(['js/views/baseview', 'underscore', 'gettext', 'common/js/components/view
var saving = new NotificationView.Mini({
title: gettext('Saving')
}).show();
- asset.save({'locked': !asset.get('locked')}, {
+ asset.save({locked: !asset.get('locked')}, {
wait: true, // This means we won't re-render until we get back the success state.
success: function() {
saving.hide();
diff --git a/cms/static/js/views/assets.js b/cms/static/js/views/assets.js
index 1e44c61822..80b23378d6 100644
--- a/cms/static/js/views/assets.js
+++ b/cms/static/js/views/assets.js
@@ -132,8 +132,8 @@ define([
handleDestroy: function(model) {
this.collection.fetch({reset: true}); // reload the collection to get a fresh page full of items
analytics.track('Deleted Asset', {
- 'course': course_location_analytics,
- 'id': model.get('url')
+ course: course_location_analytics,
+ id: model.get('url')
});
},
@@ -145,8 +145,8 @@ define([
this.pagingView.setPage(1);
analytics.track('Uploaded a File', {
- 'course': course_location_analytics,
- 'asset_url': model.get('url')
+ course: course_location_analytics,
+ asset_url: model.get('url')
});
},
@@ -207,13 +207,13 @@ define([
}
self.largeFileErrorMsg = new NotificationView.Error({
- 'title': gettext('Your file could not be uploaded'),
- 'message': error
+ title: gettext('Your file could not be uploaded'),
+ message: error
});
self.largeFileErrorMsg.show();
self.displayFailedUpload({
- 'msg': gettext('Max file size exceeded')
+ msg: gettext('Max file size exceeded')
});
},
processdone: function(event, data) {
@@ -281,8 +281,7 @@ define([
if (assettype) {
if (assettype === this.allLabel) {
titleText.text(titleText.data('alllabel'));
- }
- else {
+ } else {
titleText.text(assettype);
}
}
diff --git a/cms/static/js/views/baseview.js b/cms/static/js/views/baseview.js
index da377bebc5..45b5e67492 100644
--- a/cms/static/js/views/baseview.js
+++ b/cms/static/js/views/baseview.js
@@ -1,5 +1,5 @@
define(['jquery', 'underscore', 'backbone', 'gettext', 'js/utils/handle_iframe_binding', 'js/utils/templates',
- 'common/js/components/utils/view_utils'],
+ 'common/js/components/utils/view_utils'],
function($, _, Backbone, gettext, IframeUtils, TemplateUtils, ViewUtils) {
/*
This view is extended from backbone to provide useful functionality for all Studio views.
@@ -58,12 +58,12 @@ define(['jquery', 'underscore', 'backbone', 'gettext', 'js/utils/handle_iframe_b
},
toggleExpandCollapse: function(event) {
- var target = $(event.target);
+ var $target = $(event.target);
// Don't propagate the event as it is possible that two views will both contain
// this element, e.g. clicking on the element of a child view container in a parent.
event.stopPropagation();
event.preventDefault();
- ViewUtils.toggleExpandCollapse(target, this.options.collapsedClass);
+ ViewUtils.toggleExpandCollapse($target, this.options.collapsedClass);
},
/**
diff --git a/cms/static/js/views/components/add_xblock.js b/cms/static/js/views/components/add_xblock.js
index 8f225c9de6..8da194ce49 100644
--- a/cms/static/js/views/components/add_xblock.js
+++ b/cms/static/js/views/components/add_xblock.js
@@ -2,7 +2,7 @@
* This is a simple component that renders add buttons for all available XBlock template types.
*/
define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/components/utils/view_utils',
- 'js/views/components/add_xblock_button', 'js/views/components/add_xblock_menu'],
+ 'js/views/components/add_xblock_button', 'js/views/components/add_xblock_menu'],
function($, _, gettext, BaseView, ViewUtils, AddXBlockButton, AddXBlockMenu) {
var AddXBlockComponent = BaseView.extend({
events: {
@@ -57,14 +57,14 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/compo
createNewComponent: function(event) {
var self = this,
- element = $(event.currentTarget),
- saveData = element.data(),
+ $element = $(event.currentTarget),
+ saveData = $element.data(),
oldOffset = ViewUtils.getScrollOffset(this.$el);
event.preventDefault();
this.closeNewComponent(event);
ViewUtils.runOperationShowingMessage(
gettext('Adding'),
- _.bind(this.options.createComponent, this, saveData, element)
+ _.bind(this.options.createComponent, this, saveData, $element)
).always(function() {
// Restore the scroll position of the buttons so that the new
// component appears above them.
diff --git a/cms/static/js/views/container.js b/cms/static/js/views/container.js
index edb3d0e8e8..b48fa7aabc 100644
--- a/cms/static/js/views/container.js
+++ b/cms/static/js/views/container.js
@@ -14,7 +14,8 @@ define(['jquery', 'underscore', 'js/views/xblock', 'js/utils/module', 'gettext',
xblockReady: function() {
XBlockView.prototype.xblockReady.call(this);
var reorderableClass, reorderableContainer,
- newParent, oldParent, self = this;
+ newParent, oldParent,
+ self = this;
this.requestToken = this.$('div.xblock').first().data('request-token');
reorderableClass = this.makeRequestSpecificSelector('.reorderable-container');
@@ -91,7 +92,8 @@ define(['jquery', 'underscore', 'js/views/xblock', 'js/utils/module', 'gettext',
},
updateChildren: function(targetParent, successCallback) {
- var children, childLocators, xblockInfo = this.model;
+ var children, childLocators,
+ xblockInfo = this.model;
// Find descendants with class "studio-xblock-wrapper" whose parent === targetParent.
// This is necessary to filter our grandchildren, great-grandchildren, etc.
diff --git a/cms/static/js/views/content_group_editor.js b/cms/static/js/views/content_group_editor.js
index 8be838ddcb..6423e700ff 100644
--- a/cms/static/js/views/content_group_editor.js
+++ b/cms/static/js/views/content_group_editor.js
@@ -12,7 +12,7 @@ function(ListItemEditorView, _) {
tagName: 'div',
className: 'content-group-edit collection-edit',
events: {
- 'submit': 'setAndClose',
+ submit: 'setAndClose',
'click .action-cancel': 'cancel'
},
diff --git a/cms/static/js/views/course_info_handout.js b/cms/static/js/views/course_info_handout.js
index 5fe274311f..f2fcc8723f 100644
--- a/cms/static/js/views/course_info_handout.js
+++ b/cms/static/js/views/course_info_handout.js
@@ -22,7 +22,7 @@ define(['js/views/baseview', 'codemirror', 'common/js/components/views/feedback_
render: function() {
CourseInfoHelper.changeContentToPreview(
- this.model, 'data', this.options['base_asset_url']);
+ this.model, 'data', this.options.base_asset_url);
this.$el.html(
$(this.template({
@@ -44,7 +44,7 @@ define(['js/views/baseview', 'codemirror', 'common/js/components/views/feedback_
this.$form.show();
this.$codeMirror = CourseInfoHelper.editWithCodeMirror(
- self.model, 'data', self.options['base_asset_url'], this.$editor.get(0));
+ self.model, 'data', self.options.base_asset_url, this.$editor.get(0));
ModalUtils.showModalCover(false, function() { self.closeEditor(); });
},
@@ -72,7 +72,7 @@ define(['js/views/baseview', 'codemirror', 'common/js/components/views/feedback_
this.closeEditor();
analytics.track('Saved Course Handouts', {
- 'course': course_location_analytics
+ course: course_location_analytics
});
} else {
$('#handout_error').addClass('is-shown');
diff --git a/cms/static/js/views/course_info_helper.js b/cms/static/js/views/course_info_helper.js
index 21ef3c1ea8..1eaaa57eb5 100644
--- a/cms/static/js/views/course_info_helper.js
+++ b/cms/static/js/views/course_info_helper.js
@@ -28,6 +28,6 @@ define(['codemirror', 'js/utils/handle_iframe_binding', 'utility'],
return content;
};
- return {'editWithCodeMirror': editWithCodeMirror, 'changeContentToPreview': changeContentToPreview};
+ return {editWithCodeMirror: editWithCodeMirror, changeContentToPreview: changeContentToPreview};
}
);
diff --git a/cms/static/js/views/course_info_update.js b/cms/static/js/views/course_info_update.js
index d0787bc0fb..03ebecd1fd 100644
--- a/cms/static/js/views/course_info_update.js
+++ b/cms/static/js/views/course_info_update.js
@@ -1,12 +1,12 @@
define(['codemirror',
- 'js/utils/modal',
- 'js/utils/date_utils',
- 'edx-ui-toolkit/js/utils/html-utils',
- 'js/views/course_info_helper',
- 'js/views/validation',
- 'js/models/course_update',
- 'common/js/components/views/feedback_prompt',
- 'common/js/components/views/feedback_notification'],
+ 'js/utils/modal',
+ 'js/utils/date_utils',
+ 'edx-ui-toolkit/js/utils/html-utils',
+ 'js/views/course_info_helper',
+ 'js/views/validation',
+ 'js/models/course_update',
+ 'common/js/components/views/feedback_prompt',
+ 'common/js/components/views/feedback_notification'],
function(CodeMirror, ModalUtils, DateUtils, HtmlUtils, CourseInfoHelper, ValidatingView, CourseUpdateModel,
PromptView, NotificationView) {
'use strict';
@@ -184,9 +184,9 @@ define(['codemirror',
this.closeEditor(false);
analytics.track('Saved Course Update', {
- 'course': course_location_analytics,
- 'date': this.dateEntry(event).val(),
- 'push_notification_selected': this.push_notification_selected(event)
+ course: course_location_analytics,
+ date: this.dateEntry(event).val(),
+ push_notification_selected: this.push_notification_selected(event)
});
},
@@ -214,8 +214,7 @@ define(['codemirror',
// translate long-form date (for viewing) into short-form date (for input)
if (targetModel.get('date') && targetModel.isValid()) {
$(this.dateEntry(event)).val($.datepicker.formatDate('mm/dd/yy', new Date(targetModel.get('date'))));
- }
- else {
+ } else {
$(this.dateEntry(event)).val('MM/DD/YY');
}
this.$codeMirror = CourseInfoHelper.editWithCodeMirror(
@@ -245,8 +244,8 @@ define(['codemirror',
text: gettext('OK'),
click: function() {
analytics.track('Deleted Course Update', {
- 'course': course_location_analytics,
- 'date': self.dateEntry(event).val()
+ course: course_location_analytics,
+ date: self.dateEntry(event).val()
});
self.modelDom(event).remove();
var deleting = new NotificationView.Mini({
diff --git a/cms/static/js/views/course_outline.js b/cms/static/js/views/course_outline.js
index 78172fd655..bd1d2c854d 100644
--- a/cms/static/js/views/course_outline.js
+++ b/cms/static/js/views/course_outline.js
@@ -9,7 +9,7 @@
* - adding units will automatically redirect to the unit page rather than showing them inline
*/
define(['jquery', 'underscore', 'js/views/xblock_outline', 'common/js/components/utils/view_utils', 'js/views/utils/xblock_utils',
- 'js/models/xblock_outline_info', 'js/views/modals/course_outline_modals', 'js/utils/drag_and_drop'],
+ 'js/models/xblock_outline_info', 'js/views/modals/course_outline_modals', 'js/utils/drag_and_drop'],
function(
$, _, XBlockOutlineView, ViewUtils, XBlockViewUtils,
XBlockOutlineInfo, CourseOutlineModalsFactory, ContentDragger
@@ -69,8 +69,7 @@ define(['jquery', 'underscore', 'js/views/xblock_outline', 'common/js/components
var locator = this.model.get('id');
if (isCollapsed) {
this.expandedLocators.remove(locator);
- }
- else {
+ } else {
this.expandedLocators.add(locator);
}
this.refresh();
@@ -239,8 +238,7 @@ define(['jquery', 'underscore', 'js/views/xblock_outline', 'common/js/components
refresh: this.refreshWithCollapsedState.bind(this),
ensureChildrenRendered: this.ensureChildrenRendered.bind(this)
});
- }
- else if ($(element).hasClass('outline-subsection')) {
+ } else if ($(element).hasClass('outline-subsection')) {
ContentDragger.makeDraggable(element, {
type: '.outline-subsection',
handleClass: '.subsection-drag-handle',
@@ -249,8 +247,7 @@ define(['jquery', 'underscore', 'js/views/xblock_outline', 'common/js/components
refresh: this.refreshWithCollapsedState.bind(this),
ensureChildrenRendered: this.ensureChildrenRendered.bind(this)
});
- }
- else if ($(element).hasClass('outline-unit')) {
+ } else if ($(element).hasClass('outline-unit')) {
ContentDragger.makeDraggable(element, {
type: '.outline-unit',
handleClass: '.unit-drag-handle',
diff --git a/cms/static/js/views/edit_chapter.js b/cms/static/js/views/edit_chapter.js
index f29d67ea3b..3845b5857a 100644
--- a/cms/static/js/views/edit_chapter.js
+++ b/cms/static/js/views/edit_chapter.js
@@ -1,7 +1,7 @@
/* global course */
define(['underscore', 'jquery', 'gettext', 'edx-ui-toolkit/js/utils/html-utils',
- 'js/views/baseview', 'js/models/uploads', 'js/views/uploads', 'text!templates/edit-chapter.underscore'],
+ 'js/views/baseview', 'js/models/uploads', 'js/views/uploads', 'text!templates/edit-chapter.underscore'],
function(_, $, gettext, HtmlUtils, BaseView, FileUploadModel, UploadDialogView, editChapterTemplate) {
'use strict';
@@ -31,7 +31,7 @@ define(['underscore', 'jquery', 'gettext', 'edx-ui-toolkit/js/utils/html-utils',
'change .chapter-asset-path': 'changeAssetPath',
'click .action-close': 'removeChapter',
'click .action-upload': 'openUploadDialog',
- 'submit': 'uploadAsset'
+ submit: 'uploadAsset'
},
changeName: function(e) {
if (e && e.preventDefault) { e.preventDefault(); }
diff --git a/cms/static/js/views/edit_textbook.js b/cms/static/js/views/edit_textbook.js
index 24ecff3b6e..53030273f6 100644
--- a/cms/static/js/views/edit_textbook.js
+++ b/cms/static/js/views/edit_textbook.js
@@ -21,7 +21,7 @@ define(['js/views/baseview', 'underscore', 'jquery', 'js/views/edit_chapter', 'c
},
events: {
'change input[name=textbook-name]': 'setName',
- 'submit': 'setAndClose',
+ submit: 'setAndClose',
'click .action-cancel': 'cancel',
'click .action-add-chapter': 'createChapter'
},
@@ -49,8 +49,8 @@ define(['js/views/baseview', 'underscore', 'jquery', 'js/views/edit_chapter', 'c
var chapter = that.model.get('chapters').at(i);
if (!chapter) { return; }
chapter.set({
- 'name': $('.chapter-name', li).val(),
- 'asset_path': $('.chapter-asset-path', li).val()
+ name: $('.chapter-name', li).val(),
+ asset_path: $('.chapter-asset-path', li).val()
});
});
return this;
diff --git a/cms/static/js/views/group_configuration_editor.js b/cms/static/js/views/group_configuration_editor.js
index 13d7e73176..f763a0ed9a 100644
--- a/cms/static/js/views/group_configuration_editor.js
+++ b/cms/static/js/views/group_configuration_editor.js
@@ -16,7 +16,7 @@ function(ListItemEditorView, _, $, gettext, ExperimentGroupEditView) {
'click .action-add-group': 'createGroup',
'focus .input-text': 'onFocus',
'blur .input-text': 'onBlur',
- 'submit': 'setAndClose',
+ submit: 'setAndClose',
'click .action-cancel': 'cancel'
},
@@ -108,7 +108,7 @@ function(ListItemEditorView, _, $, gettext, ExperimentGroupEditView) {
if (group) {
group.set({
- 'name': $('.group-name', li).val()
+ name: $('.group-name', li).val()
});
}
}, this);
diff --git a/cms/static/js/views/group_configuration_item.js b/cms/static/js/views/group_configuration_item.js
index 14cd5ee6be..4f548a1d19 100644
--- a/cms/static/js/views/group_configuration_item.js
+++ b/cms/static/js/views/group_configuration_item.js
@@ -27,8 +27,8 @@ define([
attributes: function() {
return {
- 'id': this.model.get('id'),
- 'tabindex': -1
+ id: this.model.get('id'),
+ tabindex: -1
};
},
diff --git a/cms/static/js/views/license.js b/cms/static/js/views/license.js
index 0583598596..77357431c8 100644
--- a/cms/static/js/views/license.js
+++ b/cms/static/js/views/license.js
@@ -5,48 +5,48 @@ define([
], function(BaseView, _, licenseSelectorTemplate) {
var defaultLicenseInfo = {
'all-rights-reserved': {
- 'name': gettext('All Rights Reserved'),
- 'tooltip': gettext('You reserve all rights for your work')
+ name: gettext('All Rights Reserved'),
+ tooltip: gettext('You reserve all rights for your work')
},
'creative-commons': {
- 'name': gettext('Creative Commons'),
- 'tooltip': gettext('You waive some rights for your work, such that others can use it too'),
- 'url': 'https://creativecommons.org/about',
- 'options': {
- 'ver': {
- 'name': gettext('Version'),
- 'type': 'string',
- 'default': '4.0'
+ name: gettext('Creative Commons'),
+ tooltip: gettext('You waive some rights for your work, such that others can use it too'),
+ url: 'https://creativecommons.org/about',
+ options: {
+ ver: {
+ name: gettext('Version'),
+ type: 'string',
+ default: '4.0'
},
- 'BY': {
- 'name': gettext('Attribution'),
- 'type': 'boolean',
- 'default': true,
- 'help': gettext('Allow others to copy, distribute, display and perform your copyrighted work but only if they give credit the way you request. Currently, this option is required.'),
- 'disabled': true
+ BY: {
+ name: gettext('Attribution'),
+ type: 'boolean',
+ default: true,
+ help: gettext('Allow others to copy, distribute, display and perform your copyrighted work but only if they give credit the way you request. Currently, this option is required.'),
+ disabled: true
},
- 'NC': {
- 'name': gettext('Noncommercial'),
- 'type': 'boolean',
- 'default': true,
- 'help': gettext('Allow others to copy, distribute, display and perform your work - and derivative works based upon it - but for noncommercial purposes only.')
+ NC: {
+ name: gettext('Noncommercial'),
+ type: 'boolean',
+ default: true,
+ help: gettext('Allow others to copy, distribute, display and perform your work - and derivative works based upon it - but for noncommercial purposes only.')
},
- 'ND': {
- 'name': gettext('No Derivatives'),
- 'type': 'boolean',
- 'default': true,
- 'help': gettext('Allow others to copy, distribute, display and perform only verbatim copies of your work, not derivative works based upon it. This option is incompatible with "Share Alike".'),
- 'conflictsWith': ['SA']
+ ND: {
+ name: gettext('No Derivatives'),
+ type: 'boolean',
+ default: true,
+ help: gettext('Allow others to copy, distribute, display and perform only verbatim copies of your work, not derivative works based upon it. This option is incompatible with "Share Alike".'),
+ conflictsWith: ['SA']
},
- 'SA': {
- 'name': gettext('Share Alike'),
- 'type': 'boolean',
- 'default': false,
- 'help': gettext('Allow others to distribute derivative works only under a license identical to the license that governs your work. This option is incompatible with "No Derivatives".'),
- 'conflictsWith': ['ND']
+ SA: {
+ name: gettext('Share Alike'),
+ type: 'boolean',
+ default: false,
+ help: gettext('Allow others to distribute derivative works only under a license identical to the license that governs your work. This option is incompatible with "No Derivatives".'),
+ conflictsWith: ['ND']
}
},
- 'option_order': ['BY', 'NC', 'ND', 'SA']
+ option_order: ['BY', 'NC', 'ND', 'SA']
}
};
@@ -136,7 +136,7 @@ define([
}
}
- this.model.set({'options': licenseOptions});
+ this.model.set({options: licenseOptions});
// Backbone has trouble identifying when objects change, so we'll
// fire the change event manually.
this.model.trigger('change change:options');
diff --git a/cms/static/js/views/manage_users_and_roles.js b/cms/static/js/views/manage_users_and_roles.js
index 83826c505d..76fd8e1632 100644
--- a/cms/static/js/views/manage_users_and_roles.js
+++ b/cms/static/js/views/manage_users_and_roles.js
@@ -2,7 +2,7 @@
Code for editing users and assigning roles within a course or library team context.
*/
define(['jquery', 'underscore', 'gettext', 'js/views/baseview',
- 'common/js/components/views/feedback_prompt', 'common/js/components/utils/view_utils'],
+ 'common/js/components/views/feedback_prompt', 'common/js/components/utils/view_utils'],
function($, _, gettext, BaseView, PromptView, ViewUtils) {
'use strict';
var default_messages = {
@@ -95,7 +95,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview',
'click .create-user-button': 'addUserHandler',
'submit #create-user-form': 'createUserFormSubmit',
'click .action-cancel': 'cancelEditHandler',
- 'keyup': 'keyUpHandler',
+ keyup: 'keyUpHandler',
'click .remove-user': 'removeUserHandler'
};
var roleEvents = {};
@@ -106,7 +106,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview',
(function(role) {
roleEvents[role_selector] = function(event) { self.handleRoleButtonClick(event.target, role); };
- })(role_name);
+ }(role_name));
}
return _.extend(baseEvents, roleEvents);
},
@@ -171,8 +171,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview',
role_names = _.map(this.roles, function(role) { return role.key; });
if (role === this.admin_role.key && adminRoleCount === 1) {
result.push({notoggle: true});
- }
- else {
+ } else {
var currentRoleIdx = _.indexOf(role_names, role);
// in reverse order to show "Add" buttons to the left, "Remove" to the right
for (var i = this.roles.length - 1; i >= 0; i--) {
diff --git a/cms/static/js/views/metadata.js b/cms/static/js/views/metadata.js
index 7b380e5749..97c531064b 100644
--- a/cms/static/js/views/metadata.js
+++ b/cms/static/js/views/metadata.js
@@ -31,9 +31,9 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
model: model
},
conversions = {
- 'Select': 'Option',
- 'Float': 'Number',
- 'Integer': 'Number'
+ Select: 'Option',
+ Float: 'Number',
+ Integer: 'Number'
},
type = model.getType();
@@ -77,7 +77,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
if (model.get('field_name') === 'display_name') {
var displayNameValue = model.get('value');
// It is possible that there is no display name value set. In that case, return empty string.
- displayName = displayNameValue ? displayNameValue : '';
+ displayName = displayNameValue || '';
}
}
);
@@ -151,8 +151,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
if (options.hasOwnProperty(step)) {
// Parse step and convert to String. Polyfill doesn't like float values like ".1" (expects "0.1").
stepValue = numToString(Number(options[step]));
- }
- else if (this.isIntegerField()) {
+ } else if (this.isIntegerField()) {
stepValue = '1';
}
if (stepValue !== undefined) {
@@ -238,9 +237,8 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
_.each(this.model.getOptions(), function(modelValue) {
if (modelValue === selectedText) {
selectedValue = modelValue;
- }
- else if (modelValue['display_name'] === selectedText) {
- selectedValue = modelValue['value'];
+ } else if (modelValue.display_name === selectedText) {
+ selectedValue = modelValue.value;
}
});
return selectedValue;
@@ -250,8 +248,8 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
// Value here is the json value as used by the field. The choice may instead be showing display names.
// Find the display name matching the value passed in.
_.each(this.model.getOptions(), function(modelValue) {
- if (modelValue['value'] === value) {
- value = modelValue['display_name'];
+ if (modelValue.value === value) {
+ value = modelValue.display_name;
}
});
this.$el.find('#' + this.uniqueId + ' option').filter(function() {
@@ -291,7 +289,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
'
' + gettext('Remove') + '' + // eslint-disable-line max-len
''
);
- list.append($(template({'ele': ele, 'index': index})));
+ list.append($(template({ele: ele, index: index})));
});
},
@@ -459,7 +457,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
''
);
- frag.appendChild($(template({'key': key, 'value': value}))[0]);
+ frag.appendChild($(template({key: key, value: value}))[0]);
});
list.html([frag]);
@@ -532,7 +530,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
upload: function(event) {
var self = this,
- target = $(event.currentTarget),
+ $target = $(event.currentTarget),
url = '/assets/' + this.options.courseKey + '/',
model = new FileUpload({
title: gettext('Upload File')
@@ -540,10 +538,10 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
view = new UploadDialog({
model: model,
url: url,
- parentElement: target.closest('.xblock-editor'),
+ parentElement: $target.closest('.xblock-editor'),
onSuccess: function(response) {
- if (response['asset'] && response['asset']['url']) {
- self.model.setValue(response['asset']['url']);
+ if (response.asset && response.asset.url) {
+ self.model.setValue(response.asset.url);
}
}
}).show();
@@ -555,7 +553,7 @@ function(BaseView, _, MetadataModel, AbstractEditor, FileUpload, UploadDialog,
Metadata.License = AbstractEditor.extend({
initialize: function(options) {
- this.licenseModel = new LicenseModel({'asString': this.model.getValue()});
+ this.licenseModel = new LicenseModel({asString: this.model.getValue()});
this.licenseView = new LicenseView({model: this.licenseModel});
// Rerender when the license model changes
diff --git a/cms/static/js/views/modals/course_outline_modals.js b/cms/static/js/views/modals/course_outline_modals.js
index 5a286b82d9..67140eec54 100644
--- a/cms/static/js/views/modals/course_outline_modals.js
+++ b/cms/static/js/views/modals/course_outline_modals.js
@@ -334,10 +334,10 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
afterRender: function() {
AbstractEditor.prototype.afterRender.call(this);
- this.$('input.date').datepicker({'dateFormat': 'm/d/yy'});
+ this.$('input.date').datepicker({dateFormat: 'm/d/yy'});
this.$('input.time').timepicker({
- 'timeFormat': 'H:i',
- 'forceRoundTime': false
+ timeFormat: 'H:i',
+ forceRoundTime: false
});
if (this.model.get(this.fieldName)) {
DateUtils.setDate(
@@ -365,7 +365,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
getRequestData: function() {
return {
metadata: {
- 'due': this.getValue()
+ due: this.getValue()
}
};
}
@@ -400,7 +400,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
}
return {
metadata: {
- 'start': newReleaseDate
+ start: newReleaseDate
}
};
}
@@ -429,8 +429,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
}
if (showRulesField) {
this.$('.field-exam-review-rules').show();
- }
- else {
+ } else {
this.$('.field-exam-review-rules').hide();
}
},
@@ -456,10 +455,10 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
afterRender: function() {
AbstractEditor.prototype.afterRender.call(this);
this.$('input.time').timepicker({
- 'timeFormat': 'H:i',
- 'minTime': '00:30',
- 'maxTime': '24:00',
- 'forceRoundTime': false
+ timeFormat: 'H:i',
+ minTime: '00:30',
+ maxTime: '24:00',
+ forceRoundTime: false
});
this.setExamType(this.model.get('is_time_limited'), this.model.get('is_proctored_exam'),
@@ -546,16 +545,16 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
return {
metadata: {
- 'is_practice_exam': is_practice_exam,
- 'is_time_limited': is_time_limited,
- 'exam_review_rules': exam_review_rules,
+ is_practice_exam: is_practice_exam,
+ is_time_limited: is_time_limited,
+ exam_review_rules: exam_review_rules,
// We have to use the legacy field name
// as the Ajax handler directly populates
// the xBlocks fields. We will have to
// update this call site when we migrate
// seq_module.py to use 'is_proctored_exam'
- 'is_proctored_enabled': is_proctored_exam,
- 'default_time_limit_minutes': this.convertTimeLimitToMinutes(time_limit)
+ is_proctored_enabled: is_proctored_exam,
+ default_time_limit_minutes: this.convertTimeLimitToMinutes(time_limit)
}
};
}
@@ -633,7 +632,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
getRequestData: function() {
return {
- 'graderType': this.getValue()
+ graderType: this.getValue()
};
},
@@ -856,8 +855,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
if (this.currentVisibility() === 'staff_only') {
metadata.visible_to_staff_only = true;
metadata.hide_after_due = null;
- }
- else if (this.currentVisibility() === 'hide_after_due') {
+ } else if (this.currentVisibility() === 'hide_after_due') {
metadata.visible_to_staff_only = null;
metadata.hide_after_due = true;
} else {
@@ -869,8 +867,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
publish: 'republish',
metadata: metadata
};
- }
- else {
+ } else {
return {};
}
},
diff --git a/cms/static/js/views/modals/edit_xblock.js b/cms/static/js/views/modals/edit_xblock.js
index d61ecae86d..de5ca6ca2e 100644
--- a/cms/static/js/views/modals/edit_xblock.js
+++ b/cms/static/js/views/modals/edit_xblock.js
@@ -139,8 +139,8 @@ define(['jquery', 'underscore', 'gettext', 'js/views/modals/base_modal', 'common
changeMode: function(event) {
this.removeCheatsheetVisibility();
- var parent = $(event.target.parentElement),
- mode = parent.data('mode');
+ var $parent = $(event.target.parentElement),
+ mode = $parent.data('mode');
event.preventDefault();
this.selectMode(mode);
},
@@ -196,12 +196,12 @@ define(['jquery', 'underscore', 'gettext', 'js/views/modals/base_modal', 'common
},
removeCheatsheetVisibility: function() {
- var cheatsheet = $('article.simple-editor-open-ended-cheatsheet');
- if (cheatsheet.length === 0) {
- cheatsheet = $('article.simple-editor-cheatsheet');
+ var $cheatsheet = $('article.simple-editor-open-ended-cheatsheet');
+ if ($cheatsheet.length === 0) {
+ $cheatsheet = $('article.simple-editor-cheatsheet');
}
- if (cheatsheet.hasClass('shown')) {
- cheatsheet.removeClass('shown');
+ if ($cheatsheet.hasClass('shown')) {
+ $cheatsheet.removeClass('shown');
$('.modal-content').removeClass('cheatsheet-is-shown');
}
}
diff --git a/cms/static/js/views/module_edit.js b/cms/static/js/views/module_edit.js
index 868da93bcc..fe3bba5821 100644
--- a/cms/static/js/views/module_edit.js
+++ b/cms/static/js/views/module_edit.js
@@ -102,7 +102,7 @@
};
return ModuleEdit;
- })(XBlockView);
+ }(XBlockView));
return ModuleEdit;
});
}).call(this);
diff --git a/cms/static/js/views/paged_container.js b/cms/static/js/views/paged_container.js
index 31df130c2b..b162256e2b 100644
--- a/cms/static/js/views/paged_container.js
+++ b/cms/static/js/views/paged_container.js
@@ -1,5 +1,5 @@
define(['jquery', 'underscore', 'common/js/components/utils/view_utils', 'js/views/container', 'js/utils/module', 'gettext',
- 'common/js/components/views/feedback_notification', 'js/views/paging_header', 'common/js/components/views/paging_footer'],
+ 'common/js/components/views/feedback_notification', 'js/views/paging_header', 'common/js/components/views/paging_footer'],
function($, _, ViewUtils, ContainerView, ModuleUtils, gettext, NotificationView, PagingHeader, PagingFooter) {
var PagedContainerView = ContainerView.extend({
@@ -101,9 +101,9 @@ define(['jquery', 'underscore', 'common/js/components/utils/view_utils', 'js/vie
self.page.updatePreviewButton(self.collection.showChildrenPreviews);
self.page.renderAddXBlockComponents();
if (options.force_render) {
- var target = $('.studio-xblock-wrapper[data-locator="' + options.force_render + '"]');
+ var $target = $('.studio-xblock-wrapper[data-locator="' + options.force_render + '"]');
// Scroll us to the element with a little buffer at the top for context.
- ViewUtils.setScrollOffset(target, ($(window).height() * .10));
+ ViewUtils.setScrollOffset($target, ($(window).height() * 0.10));
}
}
});
@@ -171,10 +171,8 @@ define(['jquery', 'underscore', 'common/js/components/utils/view_utils', 'js/vie
processPagingHeaderAndFooter: function() {
// Rendering the container view detaches the header and footer from the DOM.
// It's just as easy to recreate them as it is to try to shove them back into the tree.
- if (this.pagingHeader)
- this.pagingHeader.undelegateEvents();
- if (this.pagingFooter)
- this.pagingFooter.undelegateEvents();
+ if (this.pagingHeader) { this.pagingHeader.undelegateEvents(); }
+ if (this.pagingFooter) { this.pagingFooter.undelegateEvents(); }
this.pagingHeader = new PagingHeader({
view: this,
diff --git a/cms/static/js/views/pages/container_subviews.js b/cms/static/js/views/pages/container_subviews.js
index 4f3474a93f..ae715c26c3 100644
--- a/cms/static/js/views/pages/container_subviews.js
+++ b/cms/static/js/views/pages/container_subviews.js
@@ -89,8 +89,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/compo
var viewLiveAction = this.$el.find('.button-view');
if (this.model.get('published')) {
viewLiveAction.removeClass(disabledCss).attr('aria-disabled', false);
- }
- else {
+ } else {
viewLiveAction.addClass(disabledCss).attr('aria-disabled', true);
}
}
@@ -175,7 +174,8 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/compo
},
discardChanges: function(e) {
- var xblockInfo = this.model, renderPage = this.renderPage;
+ var xblockInfo = this.model,
+ renderPage = this.renderPage;
if (e && e.preventDefault) {
e.preventDefault();
}
@@ -198,7 +198,9 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/compo
},
toggleStaffLock: function(e) {
- var xblockInfo = this.model, self = this, enableStaffLock, hasInheritedStaffLock,
+ var xblockInfo = this.model,
+ self = this,
+ enableStaffLock, hasInheritedStaffLock,
saveAndPublishStaffLock, revertCheckBox;
if (e && e.preventDefault) {
e.preventDefault();
diff --git a/cms/static/js/views/pages/course_outline.js b/cms/static/js/views/pages/course_outline.js
index b4d35e348b..7e65dd8e3d 100644
--- a/cms/static/js/views/pages/course_outline.js
+++ b/cms/static/js/views/pages/course_outline.js
@@ -40,11 +40,11 @@ define([
setCollapseExpandVisibility: function() {
var has_content = this.hasContent(),
- collapseExpandButton = $('.button-toggle-expand-collapse');
+ $collapseExpandButton = $('.button-toggle-expand-collapse');
if (has_content) {
- collapseExpandButton.removeClass('is-hidden');
+ $collapseExpandButton.removeClass('is-hidden');
} else {
- collapseExpandButton.addClass('is-hidden');
+ $collapseExpandButton.addClass('is-hidden');
}
},
@@ -100,19 +100,18 @@ define([
event.preventDefault();
toggleButton.toggleClass('collapse-all expand-all');
this.$('.list-sections > li').each(function(index, domElement) {
- var element = $(domElement);
+ var $element = $(domElement);
if (collapse) {
- element.addClass('is-collapsed');
+ $element.addClass('is-collapsed');
} else {
- element.removeClass('is-collapsed');
+ $element.removeClass('is-collapsed');
}
});
if (this.model.get('child_info')) {
_.each(this.model.get('child_info').children, function(childXBlockInfo) {
if (collapse) {
this.expandedLocators.remove(childXBlockInfo.get('id'));
- }
- else {
+ } else {
this.expandedLocators.add(childXBlockInfo.get('id'));
}
}, this);
@@ -122,12 +121,12 @@ define([
handleReIndexEvent: function(event) {
var self = this;
event.preventDefault();
- var target = $(event.currentTarget);
- target.css('cursor', 'wait');
- this.startReIndex(target.attr('href'))
+ var $target = $(event.currentTarget);
+ $target.css('cursor', 'wait');
+ this.startReIndex($target.attr('href'))
.done(function(data) { self.onIndexSuccess(data); })
.fail(function(data) { self.onIndexError(data); })
- .always(function() { target.css('cursor', 'pointer'); });
+ .always(function() { $target.css('cursor', 'pointer'); });
},
startReIndex: function(reindex_url) {
diff --git a/cms/static/js/views/pages/paged_container.js b/cms/static/js/views/pages/paged_container.js
index b8317d5fcc..7d7f173834 100644
--- a/cms/static/js/views/pages/paged_container.js
+++ b/cms/static/js/views/pages/paged_container.js
@@ -43,9 +43,9 @@ define(['jquery', 'underscore', 'gettext', 'js/views/pages/container', 'js/views
updatePreviewButton: function(show_previews) {
var text = (show_previews) ? gettext('Hide Previews') : gettext('Show Previews'),
- button = $('.nav-actions .button-toggle-preview');
+ $button = $('.nav-actions .button-toggle-preview');
- this.$('.preview-text', button).text(text);
+ this.$('.preview-text', $button).text(text);
this.$('.toggle-preview-button').removeClass('is-hidden');
}
});
diff --git a/cms/static/js/views/settings/advanced.js b/cms/static/js/views/settings/advanced.js
index e982dde5e6..3ab7ff1a36 100644
--- a/cms/static/js/views/settings/advanced.js
+++ b/cms/static/js/views/settings/advanced.js
@@ -1,10 +1,10 @@
define(['js/views/validation',
- 'jquery',
- 'underscore',
- 'gettext',
- 'codemirror',
- 'js/views/modals/validation_error_modal',
- 'edx-ui-toolkit/js/utils/html-utils'],
+ 'jquery',
+ 'underscore',
+ 'gettext',
+ 'codemirror',
+ 'js/views/modals/validation_error_modal',
+ 'edx-ui-toolkit/js/utils/html-utils'],
function(ValidatingView, $, _, gettext, CodeMirror, ValidationErrorModal, HtmlUtils) {
var AdvancedView = ValidatingView.extend({
error_saving: 'error_saving',
@@ -119,7 +119,7 @@ define(['js/views/validation',
self.render();
self.showSavedBar(title, message);
analytics.track('Saved Advanced Settings', {
- 'course': course_location_analytics
+ course: course_location_analytics
});
},
silent: true,
@@ -152,8 +152,8 @@ define(['js/views/validation',
renderTemplate: function(key, model) {
var newKeyId = _.uniqueId('policy_key_'),
newEle = this.template({key: key, display_name: model.display_name, help: model.help,
- value: JSON.stringify(model.value, null, 4), deprecated: model.deprecated,
- keyUniqueId: newKeyId, valueUniqueId: _.uniqueId('policy_value_')});
+ value: JSON.stringify(model.value, null, 4), deprecated: model.deprecated,
+ keyUniqueId: newKeyId, valueUniqueId: _.uniqueId('policy_value_')});
this.fieldToSelectorMap[key] = newKeyId;
this.selectorToField[newKeyId] = key;
diff --git a/cms/static/js/views/settings/grader.js b/cms/static/js/views/settings/grader.js
index 90947bd561..f467614bd8 100644
--- a/cms/static/js/views/settings/grader.js
+++ b/cms/static/js/views/settings/grader.js
@@ -1,9 +1,9 @@
define(['js/views/validation',
- 'gettext',
- 'edx-ui-toolkit/js/utils/string-utils',
- 'edx-ui-toolkit/js/utils/html-utils',
- 'underscore',
- 'jquery'],
+ 'gettext',
+ 'edx-ui-toolkit/js/utils/string-utils',
+ 'edx-ui-toolkit/js/utils/html-utils',
+ 'underscore',
+ 'jquery'],
function(ValidatingView, gettext, StringUtils, HtmlUtils, _, $) {
var GraderView = ValidatingView.extend({
// Model class is CMS.Models.Settings.CourseGrader
@@ -28,11 +28,11 @@ define(['js/views/validation',
return this;
},
fieldToSelectorMap: {
- 'type': 'course-grading-assignment-name',
- 'short_label': 'course-grading-assignment-shortname',
- 'min_count': 'course-grading-assignment-totalassignments',
- 'drop_count': 'course-grading-assignment-droppable',
- 'weight': 'course-grading-assignment-gradeweight'
+ type: 'course-grading-assignment-name',
+ short_label: 'course-grading-assignment-shortname',
+ min_count: 'course-grading-assignment-totalassignments',
+ drop_count: 'course-grading-assignment-droppable',
+ weight: 'course-grading-assignment-gradeweight'
},
updateModel: function(event) {
// HACK to fix model sometimes losing its pointer to the collection [I think I fixed this but leaving
diff --git a/cms/static/js/views/settings/grading.js b/cms/static/js/views/settings/grading.js
index 70d5abb68e..68ce581e6c 100644
--- a/cms/static/js/views/settings/grading.js
+++ b/cms/static/js/views/settings/grading.js
@@ -1,11 +1,11 @@
define(['js/views/validation',
- 'underscore',
- 'jquery',
- 'jquery.ui',
- 'js/views/settings/grader',
- 'edx-ui-toolkit/js/utils/string-utils',
- 'edx-ui-toolkit/js/utils/html-utils'
- ],
+ 'underscore',
+ 'jquery',
+ 'jquery.ui',
+ 'js/views/settings/grader',
+ 'edx-ui-toolkit/js/utils/string-utils',
+ 'edx-ui-toolkit/js/utils/html-utils'
+],
function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) {
var GradingView = ValidatingView.extend({
// Model class is CMS.Models.Settings.CourseGradingPolicy
@@ -76,7 +76,7 @@ define(['js/views/validation',
HtmlUtils.append(gradelist, self.template({model: gradeModel}));
var newEle = gradelist.children().last();
var newView = new GraderView({el: newEle,
- model: gradeModel, collection: gradeCollection});
+ model: gradeModel, collection: gradeCollection});
// Listen in order to rerender when the 'cancel' button is
// pressed
self.listenTo(newView, 'revert', _.bind(self.render, self));
@@ -92,8 +92,8 @@ define(['js/views/validation',
this.model.get('graders').push({});
},
fieldToSelectorMap: {
- 'grace_period': 'course-grading-graceperiod',
- 'minimum_grade_credit': 'course-minimum_grade_credit'
+ grace_period: 'course-grading-graceperiod',
+ minimum_grade_credit: 'course-minimum_grade_credit'
},
renderGracePeriod: function() {
var format = function(time) {
@@ -215,9 +215,9 @@ define(['js/views/validation',
return function(event, ui) {
var barIndex = ui.element.index();
// min and max represent limits not labels (note, can's make smaller than 3 points wide)
- var min = (barIndex < cachethis.descendingCutoffs.length ? cachethis.descendingCutoffs[barIndex]['cutoff'] + 3 : 3);
+ var min = (barIndex < cachethis.descendingCutoffs.length ? cachethis.descendingCutoffs[barIndex].cutoff + 3 : 3);
// minus 2 b/c minus 1 is the element we're effecting. It's max is just shy of the next one above it
- var max = (barIndex >= 2 ? cachethis.descendingCutoffs[barIndex - 2]['cutoff'] - 3 : 97);
+ var max = (barIndex >= 2 ? cachethis.descendingCutoffs[barIndex - 2].cutoff - 3 : 97);
ui.element.resizable('option', {minWidth: min * widthPerPoint, maxWidth: max * widthPerPoint});
};
},
@@ -228,11 +228,11 @@ define(['js/views/validation',
return function(event, ui) {
var barIndex = ui.element.index();
// min and max represent limits not labels (note, can's make smaller than 3 points wide)
- var min = (barIndex < cachethis.descendingCutoffs.length ? cachethis.descendingCutoffs[barIndex]['cutoff'] + 3 : 3);
+ var min = (barIndex < cachethis.descendingCutoffs.length ? cachethis.descendingCutoffs[barIndex].cutoff + 3 : 3);
// minus 2 b/c minus 1 is the element we're effecting. It's max is just shy of the next one above it
- var max = (barIndex >= 2 ? cachethis.descendingCutoffs[barIndex - 2]['cutoff'] - 3 : 100);
+ var max = (barIndex >= 2 ? cachethis.descendingCutoffs[barIndex - 2].cutoff - 3 : 100);
var percentage = Math.min(Math.max(ui.size.width / cachethis.gradeBarWidth * 100, min), max);
- cachethis.descendingCutoffs[barIndex - 1]['cutoff'] = Math.round(percentage);
+ cachethis.descendingCutoffs[barIndex - 1].cutoff = Math.round(percentage);
cachethis.renderGradeRanges();
};
},
@@ -241,8 +241,8 @@ define(['js/views/validation',
// the labels showing the range e.g., 71-80
var cutoffs = this.descendingCutoffs;
this.$el.find('.range').each(function(i) {
- var min = (i < cutoffs.length ? cutoffs[i]['cutoff'] : 0);
- var max = (i > 0 ? cutoffs[i - 1]['cutoff'] : 100);
+ var min = (i < cutoffs.length ? cutoffs[i].cutoff : 0);
+ var max = (i > 0 ? cutoffs[i - 1].cutoff : 100);
$(this).text(min + '-' + max);
});
},
@@ -258,12 +258,12 @@ define(['js/views/validation',
renderGradeLabels: function() {
// When a grade is removed, keep the remaining grades consistent.
var _this = this;
- if (_this.descendingCutoffs.length === 1 && _this.descendingCutoffs[0]['designation'] === _this.GRADES[0]) {
- _this.descendingCutoffs[0]['designation'] = 'Pass';
+ if (_this.descendingCutoffs.length === 1 && _this.descendingCutoffs[0].designation === _this.GRADES[0]) {
+ _this.descendingCutoffs[0].designation = 'Pass';
_this.setTopGradeLabel();
} else {
_.each(_this.descendingCutoffs, function(cutoff, index) {
- cutoff['designation'] = _this.GRADES[index];
+ cutoff.designation = _this.GRADES[index];
});
_this.updateDomGradeLabels();
}
@@ -281,7 +281,7 @@ define(['js/views/validation',
this.model.set('grade_cutoffs',
_.reduce(this.descendingCutoffs,
function(object, cutoff) {
- object[cutoff['designation']] = cutoff['cutoff'] / 100.0;
+ object[cutoff.designation] = cutoff.cutoff / 100.0;
return object;
},
{}),
@@ -295,12 +295,12 @@ define(['js/views/validation',
// TODO shouldn't we disable the button
return;
}
- var failBarWidth = this.descendingCutoffs[gradeLength - 1]['cutoff'];
+ var failBarWidth = this.descendingCutoffs[gradeLength - 1].cutoff;
// going to split the grade above the insertion point in half leaving fail in same place
- var nextGradeTop = (gradeLength > 1 ? this.descendingCutoffs[gradeLength - 2]['cutoff'] : 100);
+ var nextGradeTop = (gradeLength > 1 ? this.descendingCutoffs[gradeLength - 2].cutoff : 100);
var targetWidth = failBarWidth + ((nextGradeTop - failBarWidth) / 2);
this.descendingCutoffs.push({designation: this.GRADES[gradeLength], cutoff: failBarWidth});
- this.descendingCutoffs[gradeLength - 1]['cutoff'] = Math.round(targetWidth);
+ this.descendingCutoffs[gradeLength - 1].cutoff = Math.round(targetWidth);
var newGradeHtml = this.gradeCutoffTemplate({
descriptor: this.GRADES[gradeLength],
@@ -335,7 +335,7 @@ define(['js/views/validation',
var domElement = $(e.currentTarget).closest('li');
var index = domElement.index();
// copy the boundary up to the next higher grade then remove
- this.descendingCutoffs[index - 1]['cutoff'] = this.descendingCutoffs[index]['cutoff'];
+ this.descendingCutoffs[index - 1].cutoff = this.descendingCutoffs[index].cutoff;
this.descendingCutoffs.splice(index, 1);
domElement.remove();
@@ -347,7 +347,7 @@ define(['js/views/validation',
updateDesignation: function(e) {
var index = $(e.currentTarget).closest('li').index();
- this.descendingCutoffs[index]['designation'] = $(e.currentTarget).html();
+ this.descendingCutoffs[index].designation = $(e.currentTarget).html();
this.saveCutoffs();
},
@@ -369,7 +369,7 @@ define(['js/views/validation',
this.descendingCutoffs.push({designation: cutoff, cutoff: Math.round(modelCutoffs[cutoff] * 100)});
}
this.descendingCutoffs = _.sortBy(this.descendingCutoffs,
- function(gradeEle) { return -gradeEle['cutoff']; });
+ function(gradeEle) { return -gradeEle.cutoff; });
},
revertView: function() {
var self = this;
diff --git a/cms/static/js/views/settings/main.js b/cms/static/js/views/settings/main.js
index 0b9204a8e1..966e3a035c 100644
--- a/cms/static/js/views/settings/main.js
+++ b/cms/static/js/views/settings/main.js
@@ -32,7 +32,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
this.$el.find('#course-organization').val(this.model.get('org'));
this.$el.find('#course-number').val(this.model.get('course_id'));
this.$el.find('#course-name').val(this.model.get('run'));
- this.$el.find('.set-date').datepicker({'dateFormat': 'm/d/yy'});
+ this.$el.find('.set-date').datepicker({dateFormat: 'm/d/yy'});
// Avoid showing broken image on mistyped/nonexistent image
this.$el.find('img').error(function() {
@@ -46,7 +46,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
this.listenTo(this.model, 'change', this.showNotificationBar);
this.selectorToField = _.invert(this.fieldToSelectorMap);
// handle license separately, to avoid reimplementing view logic
- this.licenseModel = new LicenseModel({'asString': this.model.get('license')});
+ this.licenseModel = new LicenseModel({asString: this.model.get('license')});
this.licenseView = new LicenseView({
model: this.licenseModel,
el: this.$('#course-license-selector').get(),
@@ -83,7 +83,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
DateUtils.setupDatePicker('enrollment_start', this);
DateUtils.setupDatePicker('enrollment_end', this);
- this.$el.find('#' + this.fieldToSelectorMap['overview']).val(this.model.get('overview'));
+ this.$el.find('#' + this.fieldToSelectorMap.overview).val(this.model.get('overview'));
this.codeMirrorize(null, $('#course-overview')[0]);
if (this.model.get('title') !== '') {
@@ -96,16 +96,15 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
this.$el.find('#' + this.fieldToSelectorMap.duration).val(this.model.get('duration'));
this.$el.find('#' + this.fieldToSelectorMap.description).val(this.model.get('description'));
- this.$el.find('#' + this.fieldToSelectorMap['short_description']).val(this.model.get('short_description'));
+ this.$el.find('#' + this.fieldToSelectorMap.short_description).val(this.model.get('short_description'));
this.$el.find('.current-course-introduction-video iframe').attr('src', this.model.videosourceSample());
- this.$el.find('#' + this.fieldToSelectorMap['intro_video']).val(this.model.get('intro_video') || '');
+ this.$el.find('#' + this.fieldToSelectorMap.intro_video).val(this.model.get('intro_video') || '');
if (this.model.has('intro_video')) {
this.$el.find('.remove-course-introduction-video').show();
- }
- else this.$el.find('.remove-course-introduction-video').hide();
+ } else this.$el.find('.remove-course-introduction-video').hide();
- this.$el.find('#' + this.fieldToSelectorMap['effort']).val(this.model.get('effort'));
+ this.$el.find('#' + this.fieldToSelectorMap.effort).val(this.model.get('effort'));
var courseImageURL = this.model.get('course_image_asset_path');
this.$el.find('#course-image-url').val(courseImageURL);
@@ -121,17 +120,16 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
var pre_requisite_courses = this.model.get('pre_requisite_courses');
pre_requisite_courses = pre_requisite_courses.length > 0 ? pre_requisite_courses : '';
- this.$el.find('#' + this.fieldToSelectorMap['pre_requisite_courses']).val(pre_requisite_courses);
+ this.$el.find('#' + this.fieldToSelectorMap.pre_requisite_courses).val(pre_requisite_courses);
if (this.model.get('entrance_exam_enabled') == 'true') {
- this.$('#' + this.fieldToSelectorMap['entrance_exam_enabled']).attr('checked', this.model.get('entrance_exam_enabled'));
+ this.$('#' + this.fieldToSelectorMap.entrance_exam_enabled).attr('checked', this.model.get('entrance_exam_enabled'));
this.$('.div-grade-requirements').show();
- }
- else {
- this.$('#' + this.fieldToSelectorMap['entrance_exam_enabled']).removeAttr('checked');
+ } else {
+ this.$('#' + this.fieldToSelectorMap.entrance_exam_enabled).removeAttr('checked');
this.$('.div-grade-requirements').hide();
}
- this.$('#' + this.fieldToSelectorMap['entrance_exam_minimum_score_pct']).val(this.model.get('entrance_exam_minimum_score_pct'));
+ this.$('#' + this.fieldToSelectorMap.entrance_exam_minimum_score_pct).val(this.model.get('entrance_exam_minimum_score_pct'));
var selfPacedButton = this.$('#course-pace-self-paced'),
instructorPacedButton = this.$('#course-pace-instructor-paced'),
@@ -141,8 +139,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
selfPacedButton.removeAttr('disabled');
instructorPacedButton.removeAttr('disabled');
paceToggleTip.text('');
- }
- else {
+ } else {
selfPacedButton.attr('disabled', true);
instructorPacedButton.attr('disabled', true);
paceToggleTip.text(gettext('Course pacing cannot be changed once a course has started.'));
@@ -212,8 +209,8 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
currentTimeText = StringUtils.interpolate(
gettext('{hours}:{minutes} (current UTC time)'),
{
- 'hours': hours,
- 'minutes': minutes
+ hours: hours,
+ minutes: minutes
}
);
@@ -268,8 +265,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
// If the val is an empty string then update model with default value.
if ($(event.currentTarget).val() === '') {
this.model.set('entrance_exam_minimum_score_pct', this.model.defaults.entrance_exam_minimum_score_pct);
- }
- else {
+ } else {
this.setField(event);
}
break;
@@ -288,8 +284,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
this.$el.find('.current-course-introduction-video iframe').attr('src', previewsource);
if (this.model.has('intro_video')) {
this.$el.find('.remove-course-introduction-video').show();
- }
- else {
+ } else {
this.$el.find('.remove-course-introduction-video').hide();
}
}, this), 1000);
@@ -333,7 +328,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
if (this.model.has('intro_video')) {
this.model.set_videosource(null);
this.$el.find('.current-course-introduction-video iframe').attr('src', '');
- this.$el.find('#' + this.fieldToSelectorMap['intro_video']).val('');
+ this.$el.find('#' + this.fieldToSelectorMap.intro_video).val('');
this.$el.find('.remove-course-introduction-video').hide();
}
},
@@ -345,8 +340,7 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
thisTarget.id = $(thisTarget).attr('id');
} else if (e !== null) {
thisTarget = e.currentTarget;
- } else
- {
+ } else {
// e and forcedTarget can be null so don't deference it
// This is because in cases where we have a marketing site
// we don't display the codeMirrors for editing the marketing
@@ -413,7 +407,10 @@ define(['js/views/validation', 'codemirror', 'underscore', 'jquery', 'jquery.ui'
uploadImage: function(event) {
event.preventDefault();
- var title = '', selector = '', image_key = '', image_path_key = '';
+ var title = '',
+ selector = '',
+ image_key = '',
+ image_path_key = '';
switch (event.currentTarget.id) {
case 'upload-course-image':
title = gettext('Upload your course image.');
diff --git a/cms/static/js/views/show_textbook.js b/cms/static/js/views/show_textbook.js
index 310546f942..b3e25a9838 100644
--- a/cms/static/js/views/show_textbook.js
+++ b/cms/static/js/views/show_textbook.js
@@ -1,5 +1,5 @@
define(['js/views/baseview', 'underscore', 'gettext', 'common/js/components/views/feedback_notification',
- 'common/js/components/views/feedback_prompt'],
+ 'common/js/components/views/feedback_prompt'],
function(BaseView, _, gettext, NotificationView, PromptView) {
var ShowTextbook = BaseView.extend({
initialize: function() {
diff --git a/cms/static/js/views/tabs.js b/cms/static/js/views/tabs.js
index 14ca9f96c5..1b1d1ff293 100644
--- a/cms/static/js/views/tabs.js
+++ b/cms/static/js/views/tabs.js
@@ -21,8 +21,8 @@
};
define(['underscore', 'jquery', 'jquery.ui', 'backbone', 'common/js/components/views/feedback_prompt',
- 'common/js/components/views/feedback_notification', 'js/views/module_edit',
- 'js/models/module_info', 'js/utils/module'],
+ 'common/js/components/views/feedback_notification', 'js/views/module_edit',
+ 'js/models/module_info', 'js/utils/module'],
function(_, $, ui, Backbone, PromptView, NotificationView, ModuleEditView, ModuleModel, ModuleUtils) {
var TabsEdit;
TabsEdit = (function(_super) {
@@ -196,7 +196,7 @@
};
return TabsEdit;
- })(Backbone.View);
+ }(Backbone.View));
return TabsEdit;
});
}).call(this, analytics, course_location_analytics);
diff --git a/cms/static/js/views/unit_outline.js b/cms/static/js/views/unit_outline.js
index 77766e7eee..8c6c4605af 100644
--- a/cms/static/js/views/unit_outline.js
+++ b/cms/static/js/views/unit_outline.js
@@ -18,7 +18,8 @@ define(['underscore', 'js/views/xblock_outline', 'js/views/unit_outline_child'],
renderAncestors: function() {
var i, listElement,
- ancestors, ancestor, ancestorView = this,
+ ancestors, ancestor,
+ ancestorView = this,
previousAncestor = null;
if (this.model.get('ancestor_info')) {
ancestors = this.model.get('ancestor_info').ancestors;
diff --git a/cms/static/js/views/uploads.js b/cms/static/js/views/uploads.js
index 8296a3e5af..8a24c7984f 100644
--- a/cms/static/js/views/uploads.js
+++ b/cms/static/js/views/uploads.js
@@ -89,8 +89,8 @@ define(['jquery', 'underscore', 'gettext', 'js/views/modals/base_modal', 'jquery
progress: function(event, position, total) {
this.model.set({
- 'uploadedBytes': position,
- 'totalBytes': total
+ uploadedBytes: position,
+ totalBytes: total
});
},
@@ -110,9 +110,9 @@ define(['jquery', 'underscore', 'gettext', 'js/views/modals/base_modal', 'jquery
error: function() {
this.model.set({
- 'uploading': false,
- 'uploadedBytes': 0,
- 'title': gettext("We're sorry, there was an error")
+ uploading: false,
+ uploadedBytes: 0,
+ title: gettext("We're sorry, there was an error")
});
}
});
diff --git a/cms/static/js/views/utils/create_utils_base.js b/cms/static/js/views/utils/create_utils_base.js
index 51580381c7..46471f7123 100644
--- a/cms/static/js/views/utils/create_utils_base.js
+++ b/cms/static/js/views/utils/create_utils_base.js
@@ -39,8 +39,7 @@ define(['jquery', 'underscore', 'gettext', 'common/js/components/utils/view_util
element.addClass(self.classes.error);
element.children(self.selectors.tipError).addClass(self.classes.showing).removeClass(self.classes.hiding).text(message);
self.toggleSaveButton(false);
- }
- else {
+ } else {
element.removeClass(self.classes.error);
element.children(self.selectors.tipError).addClass(self.classes.hiding).removeClass(self.classes.showing);
// One "error" div is always present, but hidden or shown
diff --git a/cms/static/js/views/utils/xblock_utils.js b/cms/static/js/views/utils/xblock_utils.js
index 970ad6162d..765eb65af9 100644
--- a/cms/static/js/views/utils/xblock_utils.js
+++ b/cms/static/js/views/utils/xblock_utils.js
@@ -2,7 +2,7 @@
* Provides utilities for views to work with xblocks.
*/
define(['jquery', 'underscore', 'gettext', 'common/js/components/utils/view_utils', 'js/utils/module',
- 'js/models/xblock_info', 'edx-ui-toolkit/js/utils/string-utils'],
+ 'js/models/xblock_info', 'edx-ui-toolkit/js/utils/string-utils'],
function($, _, gettext, ViewUtils, ModuleUtils, XBlockInfo, StringUtils) {
'use strict';
var addXBlock, duplicateXBlock, deleteXBlock, createUpdateRequestData, updateXBlockField, VisibilityState,
@@ -52,14 +52,14 @@ define(['jquery', 'underscore', 'gettext', 'common/js/components/utils/view_util
function() {
var addOperation = $.Deferred();
analytics.track('Created a ' + category, {
- 'course': course_location_analytics,
- 'display_name': displayName
+ course: course_location_analytics,
+ display_name: displayName
});
$.postJSON(ModuleUtils.getUpdateUrl(),
{
- 'parent_locator': parentLocator,
- 'category': category,
- 'display_name': displayName
+ parent_locator: parentLocator,
+ category: category,
+ display_name: displayName
}, function(data) {
var locator = data.locator;
addOperation.resolve(locator);
diff --git a/cms/static/js/views/validation.js b/cms/static/js/views/validation.js
index a0a51b8d49..96939a4b68 100644
--- a/cms/static/js/views/validation.js
+++ b/cms/static/js/views/validation.js
@@ -1,12 +1,12 @@
define(['edx-ui-toolkit/js/utils/html-utils',
- 'js/views/baseview',
- 'underscore',
- 'jquery',
- 'gettext',
- 'common/js/components/views/feedback_notification',
- 'common/js/components/views/feedback_alert',
- 'js/views/baseview',
- 'jquery.smoothScroll'],
+ 'js/views/baseview',
+ 'underscore',
+ 'jquery',
+ 'gettext',
+ 'common/js/components/views/feedback_notification',
+ 'common/js/components/views/feedback_alert',
+ 'js/views/baseview',
+ 'jquery.smoothScroll'],
function(HtmlUtils, BaseView, _, $, gettext, NotificationView, AlertView) {
var ValidatingView = BaseView.extend({
// Intended as an abstract class which catches validation errors on the model and
@@ -89,8 +89,7 @@ define(['edx-ui-toolkit/js/utils/html-utils',
var inputElements = 'input, textarea';
if ($(ele).is(inputElements)) {
return $(ele);
- }
- else {
+ } else {
// put error on the contained inputs
return $(ele).find(inputElements);
}
@@ -115,18 +114,18 @@ define(['edx-ui-toolkit/js/utils/html-utils',
message: message,
actions: {
primary: {
- 'text': gettext('Save Changes'),
- 'class': 'action-save',
- 'click': function() {
+ text: gettext('Save Changes'),
+ class: 'action-save',
+ click: function() {
primaryClick();
self.confirmation.hide();
self.notificationBarShowing = false;
}
},
secondary: [{
- 'text': gettext('Cancel'),
- 'class': 'action-cancel',
- 'click': function() {
+ text: gettext('Cancel'),
+ class: 'action-cancel',
+ click: function() {
if (secondaryClick) {
secondaryClick();
}
diff --git a/cms/static/js/views/video/transcripts/metadata_videolist.js b/cms/static/js/views/video/transcripts/metadata_videolist.js
index 61f431eafe..b5d8e93e32 100644
--- a/cms/static/js/views/video/transcripts/metadata_videolist.js
+++ b/cms/static/js/views/video/transcripts/metadata_videolist.js
@@ -20,9 +20,9 @@ function($, Backbone, _, AbstractEditor, Utils, MessageManager) {
// Pre-defined dict of placeholders: "videoType - placeholder" pairs.
placeholders: {
- 'webm': '.webm',
- 'mp4': 'http://somesite.com/video.mp4',
- 'youtube': 'http://youtube.com/'
+ webm: '.webm',
+ mp4: 'http://somesite.com/video.mp4',
+ youtube: 'http://youtube.com/'
},
initialize: function(options) {
diff --git a/cms/static/js/views/video/translations_editor.js b/cms/static/js/views/video/translations_editor.js
index bfc41cee3b..2e776656f4 100644
--- a/cms/static/js/views/video/translations_editor.js
+++ b/cms/static/js/views/video/translations_editor.js
@@ -10,9 +10,9 @@ function($, _, AbstractEditor, FileUpload, UploadDialog) {
var VideoUploadDialog = UploadDialog.extend({
error: function() {
this.model.set({
- 'uploading': false,
- 'uploadedBytes': 0,
- 'title': gettext('Sorry, there was an error parsing the subtitles that you uploaded. Please check the format and try again.')
+ uploading: false,
+ uploadedBytes: 0,
+ title: gettext('Sorry, there was an error parsing the subtitles that you uploaded. Please check the format and try again.')
});
}
});
@@ -41,7 +41,7 @@ function($, _, AbstractEditor, FileUpload, UploadDialog) {
AbstractEditor.prototype.initialize.apply(this, arguments);
},
- getDropdown: function() {
+ getDropdown: (function() {
var dropdown,
disableOptions = function(element, values) {
var dropdown = $(element).clone();
@@ -82,7 +82,7 @@ function($, _, AbstractEditor, FileUpload, UploadDialog) {
return disableOptions(dropdown, values);
};
- }(),
+ }()),
getValueFromEditor: function() {
var dict = {},
@@ -115,9 +115,9 @@ function($, _, AbstractEditor, FileUpload, UploadDialog) {
_.each(values, function(value, key) {
var html = $(self.templateItem({
- 'lang': key,
- 'value': value,
- 'url': self.model.get('urlRoot') + '/' + key
+ lang: key,
+ value: value,
+ url: self.model.get('urlRoot') + '/' + key
})).prepend(dropdown.clone().val(key))[0];
frag.appendChild(html);
@@ -149,8 +149,8 @@ function($, _, AbstractEditor, FileUpload, UploadDialog) {
event.preventDefault();
var self = this,
- target = $(event.currentTarget),
- lang = target.data('lang'),
+ $target = $(event.currentTarget),
+ lang = $target.data('lang'),
model = new FileUpload({
title: gettext('Upload translation'),
fileFormats: ['srt']
@@ -158,13 +158,13 @@ function($, _, AbstractEditor, FileUpload, UploadDialog) {
view = new VideoUploadDialog({
model: model,
url: self.model.get('urlRoot') + '/' + lang,
- parentElement: target.closest('.xblock-editor'),
+ parentElement: $target.closest('.xblock-editor'),
onSuccess: function(response) {
- if (!response['filename']) { return; }
+ if (!response.filename) { return; }
var dict = $.extend(true, {}, self.model.get('value'));
- dict[lang] = response['filename'];
+ dict[lang] = response.filename;
self.model.setValue(dict);
}
});
diff --git a/cms/static/js/views/xblock.js b/cms/static/js/views/xblock.js
index b90554b866..3a9f7be126 100644
--- a/cms/static/js/views/xblock.js
+++ b/cms/static/js/views/xblock.js
@@ -197,26 +197,26 @@ define(['jquery', 'underscore', 'common/js/components/utils/view_utils', 'js/vie
* @returns {Promise} A promise representing the loading of the resource.
*/
loadResource: function(resource) {
- var head = $('head'),
+ var $head = $('head'),
mimetype = resource.mimetype,
kind = resource.kind,
placement = resource.placement,
data = resource.data;
if (mimetype === 'text/css') {
if (kind === 'text') {
- head.append("');
+ $head.append("');
} else if (kind === 'url') {
- head.append("
");
+ $head.append("
");
}
} else if (mimetype === 'application/javascript') {
if (kind === 'text') {
- head.append('');
+ $head.append('');
} else if (kind === 'url') {
return ViewUtils.loadJavaScript(data);
}
} else if (mimetype === 'text/html') {
if (placement === 'head') {
- head.append(data);
+ $head.append(data);
}
}
// Return an already resolved promise for synchronous updates
diff --git a/cms/static/js/views/xblock_editor.js b/cms/static/js/views/xblock_editor.js
index e2a52672ea..50b451ef96 100644
--- a/cms/static/js/views/xblock_editor.js
+++ b/cms/static/js/views/xblock_editor.js
@@ -3,7 +3,7 @@
* the available modes.
*/
define(['jquery', 'underscore', 'gettext', 'js/views/xblock', 'js/views/metadata', 'js/collections/metadata',
- 'jquery.inputnumber'],
+ 'jquery.inputnumber'],
function($, _, gettext, XBlockView, MetadataView, MetadataCollection) {
var XBlockEditorView = XBlockView.extend({
// takes XBlockInfo as a model
diff --git a/cms/static/js/views/xblock_outline.js b/cms/static/js/views/xblock_outline.js
index 28312802ca..badf43dc1f 100644
--- a/cms/static/js/views/xblock_outline.js
+++ b/cms/static/js/views/xblock_outline.js
@@ -14,8 +14,8 @@
* - edit_display_name - true if the shown xblock's display name should be in inline edit mode
*/
define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/components/utils/view_utils',
- 'js/views/utils/xblock_utils', 'js/views/xblock_string_field_editor',
- 'edx-ui-toolkit/js/utils/string-utils', 'edx-ui-toolkit/js/utils/html-utils'],
+ 'js/views/utils/xblock_utils', 'js/views/xblock_string_field_editor',
+ 'edx-ui-toolkit/js/utils/string-utils', 'edx-ui-toolkit/js/utils/html-utils'],
function($, _, gettext, BaseView, ViewUtils, XBlockViewUtils, XBlockStringFieldEditor, StringUtils, HtmlUtils) {
'use strict';
var XBlockOutlineView = BaseView.extend({
@@ -58,8 +58,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/compo
if (this.shouldRenderChildren() && this.shouldExpandChildren()) {
this.renderChildren();
- }
- else {
+ } else {
this.renderedChildren = false;
}
return this;
@@ -167,8 +166,7 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview', 'common/js/compo
var wasExpanded = this.expandedLocators.contains(locator);
if (wasExpanded) {
this.expandedLocators.remove(locator);
- }
- else {
+ } else {
this.expandedLocators.add(locator);
}
}
diff --git a/cms/static/js/views/xblock_validation.js b/cms/static/js/views/xblock_validation.js
index a0e6bcf010..e675b3e80f 100644
--- a/cms/static/js/views/xblock_validation.js
+++ b/cms/static/js/views/xblock_validation.js
@@ -30,8 +30,7 @@ define(['jquery', 'underscore', 'js/views/baseview', 'gettext'],
getIcon: function(messageType) {
if (messageType === this.model.ERROR) {
return 'fa-exclamation-circle';
- }
- else if (messageType === this.model.WARNING || messageType === this.model.NOT_CONFIGURED) {
+ } else if (messageType === this.model.WARNING || messageType === this.model.NOT_CONFIGURED) {
return 'fa-exclamation-triangle';
}
return null;
@@ -47,8 +46,7 @@ define(['jquery', 'underscore', 'js/views/baseview', 'gettext'],
// Translators: This message will be added to the front of messages of type warning,
// e.g. "Warning: this component has not been configured yet".
return gettext('Warning');
- }
- else if (messageType === this.model.ERROR) {
+ } else if (messageType === this.model.ERROR) {
// Translators: This message will be added to the front of messages of type error,
// e.g. "Error: required field is missing".
return gettext('Error');
diff --git a/cms/static/js/xblock/authoring.js b/cms/static/js/xblock/authoring.js
index 36140b6f76..0b220004ca 100644
--- a/cms/static/js/xblock/authoring.js
+++ b/cms/static/js/xblock/authoring.js
@@ -5,7 +5,6 @@
'use strict';
function VisibilityEditorView(runtime, element) {
-
this.getGroupAccess = function() {
var groupAccess = {},
partitionId,
@@ -60,4 +59,4 @@
// XBlock initialization functions must be global
window.VisibilityEditorInit = initializeVisibilityEditor;
-})($);
+}($));
diff --git a/cms/static/js/xblock_asides/structured_tags.js b/cms/static/js/xblock_asides/structured_tags.js
index c4c5418918..e413f77f69 100644
--- a/cms/static/js/xblock_asides/structured_tags.js
+++ b/cms/static/js/xblock_asides/structured_tags.js
@@ -45,4 +45,4 @@
}
window.StructuredTagsInit = initializeStructuredTags;
-})($);
+}($));
diff --git a/common/lib/xmodule/xmodule/assets/word_cloud/public/js/word_cloud_main.js b/common/lib/xmodule/xmodule/assets/word_cloud/public/js/word_cloud_main.js
index ce003c6951..2a251eb30c 100644
--- a/common/lib/xmodule/xmodule/assets/word_cloud/public/js/word_cloud_main.js
+++ b/common/lib/xmodule/xmodule/assets/word_cloud/public/js/word_cloud_main.js
@@ -86,7 +86,7 @@
*/
WordCloudMain.prototype.submitAnswer = function() {
var _this = this,
- data = {'student_words': []};
+ data = {student_words: []};
// Populate the data to be sent to the server with user's words.
this.wordCloudEl.find('input.input-cloud').each(function(index, value) {
diff --git a/common/lib/xmodule/xmodule/js/spec/capa/imageinput_spec.js b/common/lib/xmodule/xmodule/js/spec/capa/imageinput_spec.js
index 770f7814fb..55a77547d6 100644
--- a/common/lib/xmodule/xmodule/js/spec/capa/imageinput_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/capa/imageinput_spec.js
@@ -10,12 +10,12 @@
var state;
beforeEach(function() {
- var el;
+ var $el;
loadFixtures('imageinput.html');
- el = $('#imageinput_12345');
+ $el = $('#imageinput_12345');
- el.append(createTestImage('cross_12345', 300, 400, 'red'));
+ $el.append(createTestImage('cross_12345', 300, 400, 'red'));
state = new ImageInput('12345');
});
diff --git a/common/lib/xmodule/xmodule/js/spec/collapsible_spec.js b/common/lib/xmodule/xmodule/js/spec/collapsible_spec.js
index 31e24a9568..d70e195b90 100644
--- a/common/lib/xmodule/xmodule/js/spec/collapsible_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/collapsible_spec.js
@@ -2,11 +2,11 @@
'use strict';
describe('Collapsible', function() {
- var el, html, html_custom,
+ var $el, html, html_custom,
initialize = function(template) {
setFixtures(template);
- el = $('.collapsible');
- Collapsible.setCollapsibles(el);
+ $el = $('.collapsible');
+ Collapsible.setCollapsibles($el);
},
disableFx = function() {
$.fx.off = true;
@@ -40,19 +40,19 @@
it('Default container initialized correctly', function() {
initialize(html);
- expect(el.find('.shortform')).toContainElement('.full-top');
- expect(el.find('.shortform')).toContainElement('.full-bottom');
- expect(el.find('.longform')).toBeHidden();
- expect(el.find('.full')).toHandle('click');
+ expect($el.find('.shortform')).toContainElement('.full-top');
+ expect($el.find('.shortform')).toContainElement('.full-bottom');
+ expect($el.find('.longform')).toBeHidden();
+ expect($el.find('.full')).toHandle('click');
});
it('Custom container initialized correctly', function() {
initialize(html_custom);
- expect(el.find('.shortform-custom')).toContainElement('.full-custom');
- expect(el.find('.full-custom')).toHaveText('Show shortform-custom');
- expect(el.find('.longform')).toBeHidden();
- expect(el.find('.full-custom')).toHandle('click');
+ expect($el.find('.shortform-custom')).toContainElement('.full-custom');
+ expect($el.find('.full-custom')).toHaveText('Show shortform-custom');
+ expect($el.find('.longform')).toBeHidden();
+ expect($el.find('.full-custom')).toHandle('click');
});
});
@@ -64,15 +64,15 @@
state = 'closed';
}
- anchors = el.find('.' + anchorsElClass);
+ anchors = $el.find('.' + anchorsElClass);
if (state === 'closed') {
- expect(el.find('.longform')).toBeHidden();
- expect(el).not.toHaveClass('open');
+ expect($el.find('.longform')).toBeHidden();
+ expect($el).not.toHaveClass('open');
text = showText;
} else {
- expect(el.find('.longform')).toBeVisible();
- expect(el).toHaveClass('open');
+ expect($el.find('.longform')).toBeVisible();
+ expect($el).toHaveClass('open');
text = hideText;
}
@@ -95,7 +95,7 @@
initialize(html);
event = jQuery.Event('click', {
- target: el.find('.full').get(0)
+ target: $el.find('.full').get(0)
});
Collapsible.toggleFull(event, 'See full output', 'Hide output');
@@ -111,7 +111,7 @@
initialize(html_custom);
event = jQuery.Event('click', {
- target: el.find('.full-custom').get(0)
+ target: $el.find('.full-custom').get(0)
});
Collapsible.toggleFull(event, 'Show shortform-custom', 'Hide shortform-custom');
diff --git a/common/lib/xmodule/xmodule/js/spec/helper.js b/common/lib/xmodule/xmodule/js/spec/helper.js
index 6c3462f8be..c323209f04 100644
--- a/common/lib/xmodule/xmodule/js/spec/helper.js
+++ b/common/lib/xmodule/xmodule/js/spec/helper.js
@@ -82,13 +82,13 @@
duration: 'PT5M0S'
}
},
- 'cogebirgzzM': {
+ cogebirgzzM: {
contentDetails: {
id: 'cogebirgzzM',
duration: 'PT3M20S'
}
},
- 'abcdefghijkl': {
+ abcdefghijkl: {
contentDetails: {
id: 'abcdefghijkl',
duration: 'PT6M40S'
diff --git a/common/lib/xmodule/xmodule/js/spec/main_requirejs.js b/common/lib/xmodule/xmodule/js/spec/main_requirejs.js
index 4b04278962..03220ef0a0 100644
--- a/common/lib/xmodule/xmodule/js/spec/main_requirejs.js
+++ b/common/lib/xmodule/xmodule/js/spec/main_requirejs.js
@@ -18,12 +18,10 @@
if (globalValue) {
if (noShim) {
define(name, {});
- }
- else {
+ } else {
define(name, [], function() { return globalValue; });
}
- }
- else {
+ } else {
console.error('Expected library to be included on page, but not found on window object: ' + name);
}
};
diff --git a/common/lib/xmodule/xmodule/js/spec/split_test/staff_view_spec.js b/common/lib/xmodule/xmodule/js/spec/split_test/staff_view_spec.js
index b221f4eef0..2194099559 100644
--- a/common/lib/xmodule/xmodule/js/spec/split_test/staff_view_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/split_test/staff_view_spec.js
@@ -1,12 +1,12 @@
describe('Tests for split_test staff view switching', function() {
var ab_module;
- var elem;
+ var $elem;
beforeEach(function() {
loadFixtures('split_test_staff.html');
- elem = $('#split-test');
+ $elem = $('#split-test');
window.XBlock = jasmine.createSpyObj('XBlock', ['initializeBlocks']);
- ab_module = ABTestSelector(null, elem);
+ ab_module = ABTestSelector(null, $elem);
});
afterEach(function() {
@@ -14,8 +14,8 @@ describe('Tests for split_test staff view switching', function() {
});
it('test that we have only one visible condition', function() {
- var containers = elem.find('.split-test-child-container').length;
- var conditions_shown = elem.find('.split-test-child-container .condition-text').length;
+ var containers = $elem.find('.split-test-child-container').length;
+ var conditions_shown = $elem.find('.split-test-child-container .condition-text').length;
expect(containers).toEqual(1);
expect(conditions_shown).toEqual(1);
expect(XBlock.initializeBlocks).toHaveBeenCalled();
@@ -26,8 +26,8 @@ describe('Tests for split_test staff view switching', function() {
for (var i = 0; i < groups.length; i++) {
var to_select = groups[i];
- elem.find('.split-test-select').val(to_select).change();
- var child_text = elem.find('.split-test-child-container .condition-text').text();
+ $elem.find('.split-test-select').val(to_select).change();
+ var child_text = $elem.find('.split-test-child-container .condition-text').text();
expect(child_text).toContain(to_select);
expect(XBlock.initializeBlocks).toHaveBeenCalled();
}
diff --git a/common/lib/xmodule/xmodule/js/spec/video/general_spec.js b/common/lib/xmodule/xmodule/js/spec/video/general_spec.js
index 2392fffd65..9a156ecc18 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/general_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/general_spec.js
@@ -172,8 +172,8 @@
function itFabrique(itDescription, data, expectData) {
it(itDescription, function() {
state = jasmine.initializePlayer('video.html', {
- 'start': data.start,
- 'end': data.end
+ start: data.start,
+ end: data.end
});
expect(state.config.startTime).toBe(expectData.start);
@@ -207,8 +207,7 @@
it(
'check for YT availability is performed only once',
- function()
- {
+ function() {
var numAjaxCalls = 0;
// Total ajax calls made.
diff --git a/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js b/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js
index f9775d81aa..28470d1477 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/html5_video_spec.js
@@ -160,8 +160,7 @@
describe('[loadedmetadata]', function() {
it(
'player state was changed, start/end was defined, ' +
- 'onReady called', function(done)
- {
+ 'onReady called', function(done) {
jasmine.fireEvent(state.videoPlayer.player.video, 'loadedmetadata');
jasmine.waitUntil(function() {
return state.videoPlayer.player.getPlayerState() !== STATUS.UNSTARTED;
diff --git a/common/lib/xmodule/xmodule/js/spec/video/initialize_spec.js b/common/lib/xmodule/xmodule/js/spec/video/initialize_spec.js
index 39715d9968..053b2ca452 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/initialize_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/initialize_spec.js
@@ -17,9 +17,9 @@ function(Initialize) {
beforeEach(function() {
state.config = {};
state.config.transcriptLanguages = {
- 'de': 'German',
- 'en': 'English',
- 'uk': 'Ukrainian'
+ de: 'German',
+ en: 'English',
+ uk: 'Ukrainian'
};
});
@@ -47,8 +47,8 @@ function(Initialize) {
state.lang = 'zh';
state.config.transcriptLanguages = {
- 'de': 'German',
- 'uk': 'Ukrainian'
+ de: 'German',
+ uk: 'Ukrainian'
};
expected = Initialize.prototype.getCurrentLanguage.call(state);
expect(expected).toBe('uk');
@@ -69,10 +69,10 @@ function(Initialize) {
state = {
speed: '1.50',
metadata: {
- 'testId': {
+ testId: {
duration: 'PT6M40S'
},
- 'videoId': {
+ videoId: {
duration: 'PT1M40S'
}
},
@@ -182,8 +182,8 @@ function(Initialize) {
it('check mapping', function() {
var map = {
- '0.75': '0.50',
- '1.25': '1.50'
+ 0.75: '0.50',
+ 1.25: '1.50'
};
$.each(map, function(key, expected) {
@@ -223,7 +223,7 @@ function(Initialize) {
it('check mapping', function() {
var map = {
- '0.25': '0.75',
+ 0.25: '0.75',
'0.50': '0.75',
'2.0': '1.50'
};
diff --git a/common/lib/xmodule/xmodule/js/spec/video/resizer_spec.js b/common/lib/xmodule/xmodule/js/spec/video/resizer_spec.js
index 83ec05db6b..366c95cae4 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/resizer_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/resizer_spec.js
@@ -16,16 +16,16 @@ function(Resizer) {
'
',
''
].join(''),
- config, container, element;
+ config, $container, $element;
beforeEach(function() {
setFixtures(html);
- container = $('.rszr-wrapper');
- element = $('.rszr-el');
+ $container = $('.rszr-wrapper');
+ $element = $('.rszr-el');
config = {
- container: container,
- element: element
+ container: $container,
+ element: $element
};
spyOn(console, 'log');
@@ -40,66 +40,66 @@ function(Resizer) {
it('`alignByWidthOnly` works correctly', function() {
var resizer = new Resizer(config).alignByWidthOnly(),
- expectedWidth = container.width(),
- realWidth = element.width();
+ expectedWidth = $container.width(),
+ realWidth = $element.width();
expect(realWidth).toBe(expectedWidth);
});
it('`alignByHeightOnly` works correctly', function() {
var resizer = new Resizer(config).alignByHeightOnly(),
- expectedHeight = container.height(),
- realHeight = element.height();
+ expectedHeight = $container.height(),
+ realHeight = $element.height();
expect(realHeight).toBe(expectedHeight);
});
it('`align` works correctly', function() {
var resizer = new Resizer(config).align(),
- expectedHeight = container.height(),
- realHeight = element.height(),
+ expectedHeight = $container.height(),
+ realHeight = $element.height(),
expectedWidth = 50;
// containerRatio >= elementRatio
expect(realHeight).toBe(expectedHeight);
// containerRatio < elementRatio
- container.width(expectedWidth);
+ $container.width(expectedWidth);
resizer.align();
- realWidth = element.width();
+ realWidth = $element.width();
expect(realWidth).toBe(expectedWidth);
});
it('`setMode` works correctly', function() {
var resizer = new Resizer(config).setMode('height'),
- expectedHeight = container.height(),
- realHeight = element.height(),
+ expectedHeight = $container.height(),
+ realHeight = $element.height(),
expectedWidth = 50;
// containerRatio >= elementRatio
expect(realHeight).toBe(expectedHeight);
// containerRatio < elementRatio
- container.width(expectedWidth);
+ $container.width(expectedWidth);
resizer.setMode('width');
- realWidth = element.width();
+ realWidth = $element.width();
expect(realWidth).toBe(expectedWidth);
});
it('`setElement` works correctly', function() {
- container.append('');
- var newElement = $('#Another-el'),
- expectedHeight = container.height();
+ var $newElement = $('#Another-el'),
+ expectedHeight = $container.height();
- new Resizer(config).setElement(newElement).alignByHeightOnly();
- expect(element.height()).not.toBe(expectedHeight);
- expect(newElement.height()).toBe(expectedHeight);
+ new Resizer(config).setElement($newElement).alignByHeightOnly();
+ expect($element.height()).not.toBe(expectedHeight);
+ expect($newElement.height()).toBe(expectedHeight);
});
describe('Callbacks', function() {
@@ -165,8 +165,7 @@ function(Resizer) {
it(
'Error message is shown when wrong argument type is passed',
- function()
- {
+ function() {
var methods = ['add', 'once'],
errorMessage = '[Video info]: TypeError: Argument is not a function.',
arg = {};
@@ -191,63 +190,63 @@ function(Resizer) {
it('adding delta align correctly by height', function() {
var delta = 100,
- expectedHeight = container.height() + delta,
+ expectedHeight = $container.height() + delta,
realHeight;
resizer
.delta.add(delta, 'height')
.setMode('height');
- realHeight = element.height();
+ realHeight = $element.height();
expect(realHeight).toBe(expectedHeight);
});
it('adding delta align correctly by width', function() {
var delta = 100,
- expectedWidth = container.width() + delta,
+ expectedWidth = $container.width() + delta,
realWidth;
resizer
.delta.add(delta, 'width')
.setMode('width');
- realWidth = element.width();
+ realWidth = $element.width();
expect(realWidth).toBe(expectedWidth);
});
it('substract delta align correctly by height', function() {
var delta = 100,
- expectedHeight = container.height() - delta,
+ expectedHeight = $container.height() - delta,
realHeight;
resizer
.delta.substract(delta, 'height')
.setMode('height');
- realHeight = element.height();
+ realHeight = $element.height();
expect(realHeight).toBe(expectedHeight);
});
it('substract delta align correctly by width', function() {
var delta = 100,
- expectedWidth = container.width() - delta,
+ expectedWidth = $container.width() - delta,
realWidth;
resizer
.delta.substract(delta, 'width')
.setMode('width');
- realWidth = element.width();
+ realWidth = $element.width();
expect(realWidth).toBe(expectedWidth);
});
it('reset delta', function() {
var delta = 100,
- expectedWidth = container.width(),
+ expectedWidth = $container.width(),
realWidth;
resizer
@@ -255,7 +254,7 @@ function(Resizer) {
.delta.reset()
.setMode('width');
- realWidth = element.width();
+ realWidth = $element.width();
expect(realWidth).toBe(expectedWidth);
});
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js
index 64cba5c692..acfbc719ae 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_caption_spec.js
@@ -42,10 +42,10 @@
$('.video .toggle-captions').trigger('click');
expect($('.video .subtitles-menu')).toHaveAttrs({
- 'lang': 'en'
+ lang: 'en'
});
expect($('.video .closed-captions')).toHaveAttrs({
- 'lang': 'en'
+ lang: 'en'
});
});
@@ -56,8 +56,8 @@
it('add ARIA attributes to transcript control', function() {
state = jasmine.initializePlayer();
- var captionControl = $('.toggle-transcript');
- expect(captionControl).toHaveAttrs({
+ var $captionControl = $('.toggle-transcript');
+ expect($captionControl).toHaveAttrs({
'aria-disabled': 'false'
});
});
@@ -161,11 +161,11 @@
'caption:fetch': plugin.fetchCaption,
'caption:resize': plugin.onResize,
'caption:update': plugin.onCaptionUpdate,
- 'ended': plugin.pause,
- 'fullscreen': plugin.onResize,
- 'pause': plugin.pause,
- 'play': plugin.play,
- 'destroy': plugin.destroy
+ ended: plugin.pause,
+ fullscreen: plugin.onResize,
+ pause: plugin.pause,
+ play: plugin.play,
+ destroy: plugin.destroy
});
});
@@ -246,13 +246,13 @@
it('when clicking on link with new language', function() {
state = jasmine.initializePlayer();
var Caption = state.videoCaption,
- link = $('.langs-list li[data-lang-code="de"] .control-lang');
+ $link = $('.langs-list li[data-lang-code="de"] .control-lang');
spyOn(Caption, 'fetchCaption');
spyOn(state.storage, 'setItem');
state.lang = 'en';
- link.trigger('click');
+ $link.trigger('click');
expect(Caption.fetchCaption).toHaveBeenCalled();
expect(state.lang).toBe('de');
@@ -260,31 +260,31 @@
.toHaveBeenCalledWith('language', 'de');
expect($('.langs-list li.is-active').length).toBe(1);
expect($('.subtitles .subtitles-menu')).toHaveAttrs({
- 'lang': 'de'
+ lang: 'de'
});
expect($('.closed-captions')).toHaveAttrs({
- 'lang': 'de'
+ lang: 'de'
});
- expect(link).toHaveAttr('aria-pressed', 'true');
+ expect($link).toHaveAttr('aria-pressed', 'true');
});
it('when clicking on link with current language', function() {
state = jasmine.initializePlayer();
var Caption = state.videoCaption,
- link = $('.langs-list li[data-lang-code="en"] .control-lang');
+ $link = $('.langs-list li[data-lang-code="en"] .control-lang');
spyOn(Caption, 'fetchCaption');
spyOn(state.storage, 'setItem');
state.lang = 'en';
- link.trigger('click');
+ $link.trigger('click');
expect(Caption.fetchCaption).not.toHaveBeenCalled();
expect(state.lang).toBe('en');
expect(state.storage.setItem)
.not.toHaveBeenCalledWith('language', 'en');
expect($('.langs-list li.is-active').length).toBe(1);
- expect(link).toHaveAttr('aria-pressed', 'true');
+ expect($link).toHaveAttr('aria-pressed', 'true');
});
it('open the language toggle on hover', function() {
@@ -316,7 +316,7 @@
describe('is not rendered', function() {
it('if just 1 language', function() {
state = jasmine.initializePlayer(null, {
- 'transcriptLanguages': {'en': 'English'}
+ transcriptLanguages: {en: 'English'}
});
expect($('.langs-list')).not.toExist();
@@ -445,8 +445,8 @@
describe('when no transcripts file was specified', function() {
beforeEach(function() {
state = jasmine.initializePlayer('video_all.html', {
- 'sub': '',
- 'transcriptLanguages': {}
+ sub: '',
+ transcriptLanguages: {}
});
});
@@ -698,7 +698,7 @@
expect(Caption.fetchAvailableTranslations).not.toHaveBeenCalled();
expect($.ajaxWithPrefix.calls.mostRecent().args[0].data)
- .toEqual({'videoId': 'Z5KLxerq05Y'});
+ .toEqual({videoId: 'Z5KLxerq05Y'});
expect(Caption.hideCaptions.calls.mostRecent().args)
.toEqual([true, false]);
expect(Caption.fetchCaption.calls.mostRecent().args[0]).toEqual(true);
@@ -719,7 +719,7 @@
expect(Caption.fetchAvailableTranslations).not.toHaveBeenCalled();
expect($.ajaxWithPrefix.calls.mostRecent().args[0].data)
- .toEqual({'videoId': 'Z5KLxerq05Y'});
+ .toEqual({videoId: 'Z5KLxerq05Y'});
expect(Caption.hideCaptions).toHaveBeenCalledWith(false);
expect(Caption.fetchCaption.calls.mostRecent().args[0]).toEqual(true);
expect(Caption.fetchCaption.calls.count()).toEqual(1);
@@ -734,8 +734,8 @@
});
state.config.transcriptLanguages = {
- 'en': 'English',
- 'uk': 'Ukrainian'
+ en: 'English',
+ uk: 'Ukrainian'
};
spyOn(Caption, 'fetchAvailableTranslations');
@@ -772,28 +772,28 @@
msg = 'on succes: language menu is rendered if translations available';
it(msg, function() {
state.config.transcriptLanguages = {
- 'en': 'English',
- 'uk': 'Ukrainian',
- 'de': 'German'
+ en: 'English',
+ uk: 'Ukrainian',
+ de: 'German'
};
Caption.fetchAvailableTranslations();
expect($.ajaxWithPrefix).toHaveBeenCalled();
expect(state.config.transcriptLanguages).toEqual({
- 'uk': 'Ukrainian',
- 'de': 'German'
+ uk: 'Ukrainian',
+ de: 'German'
});
expect(Caption.renderLanguageMenu).toHaveBeenCalledWith({
- 'uk': 'Ukrainian',
- 'de': 'German'
+ uk: 'Ukrainian',
+ de: 'German'
});
});
msg = 'on succes: language menu isn\'t rendered if translations unavailable';
it(msg, function() {
state.config.transcriptLanguages = {
- 'en': 'English',
- 'ru': 'Russian'
+ en: 'English',
+ ru: 'Russian'
};
Caption.fetchAvailableTranslations();
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_context_menu_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_context_menu_spec.js
index 35db0439f7..75bdaf25d9 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_context_menu_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_context_menu_spec.js
@@ -2,18 +2,18 @@
'use strict';
describe('Video Context Menu', function() {
var state, openMenu, keyPressEvent, openSubmenuMouse, openSubmenuKeyboard, closeSubmenuMouse,
- closeSubmenuKeyboard, menu, menuItems, menuSubmenuItem, submenu, submenuItems, overlay, playButton;
+ closeSubmenuKeyboard, menu, menuItems, menuSubmenuItem, submenu, submenuItems, overlay, $playButton;
openMenu = function() {
- var container = $('.video');
- container.find('video').trigger('contextmenu');
- menu = container.children('.contextmenu');
+ var $container = $('.video');
+ $container.find('video').trigger('contextmenu');
+ menu = $container.children('.contextmenu');
menuItems = menu.children('.menu-item').not('.submenu-item');
menuSubmenuItem = menu.children('.menu-item.submenu-item');
submenu = menuSubmenuItem.children('.submenu');
submenuItems = submenu.children('.menu-item');
- overlay = container.children('.overlay');
- playButton = $('.video_control.play');
+ overlay = $container.children('.overlay');
+ $playButton = $('.video_control.play');
};
keyPressEvent = function(key) {
@@ -106,14 +106,14 @@
menuItems.each(function() {
expect($(this)).toHaveAttrs({
'aria-selected': 'false',
- 'role': 'menuitem'
+ role: 'menuitem'
});
});
expect(menuSubmenuItem).toHaveAttrs({
'aria-expanded': 'false',
'aria-haspopup': 'true',
- 'role': 'menuitem'
+ role: 'menuitem'
});
// Submenu and its items.
@@ -191,14 +191,14 @@
it('mouse left-clicking outside of the context menu will close it', function() {
// Left-click outside of open menu, for example on Play button
- playButton.click();
+ $playButton.click();
expect(menu).not.toHaveClass('is-opened');
expect(overlay).not.toBeInDOM();
});
it('mouse right-clicking outside of video will close it', function() {
// Right-click outside of open menu for example on Play button
- playButton.trigger('contextmenu');
+ $playButton.trigger('contextmenu');
expect(menu).not.toHaveClass('is-opened');
expect(overlay).not.toBeInDOM();
});
@@ -429,4 +429,4 @@
});
});
});
-})();
+}());
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_control_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_control_spec.js
index e96d74d092..f9e5b60622 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_control_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_control_spec.js
@@ -41,8 +41,7 @@
describe('constructor with start-time', function() {
it(
'saved position is 0, timer slider and VCR set to start-time',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -69,8 +68,7 @@
it(
'saved position is after start-time, ' +
'timer slider and VCR set to saved position',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -100,8 +98,7 @@
it(
'saved position is negative, ' +
'timer slider and VCR set to start-time',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -131,8 +128,7 @@
it(
'saved position is not a number, ' +
'timer slider and VCR set to start-time',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -162,8 +158,7 @@
it(
'saved position is greater than end-time, ' +
'timer slider and VCR set to start-time',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -195,8 +190,7 @@
it(
'saved position is 0, timer slider and VCR set to 0:00 ' +
'and ending at specified end-time',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -226,8 +220,7 @@
it(
'saved position is after start-time, ' +
'timer slider and VCR set to saved position',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -257,8 +250,7 @@
// TODO: Fix!
it(
'saved position is negative, timer slider and VCR set to 0:00',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -288,8 +280,7 @@
it(
'saved position is not a number, ' +
'timer slider and VCR set to 0:00',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -320,8 +311,7 @@
it(
'saved position is greater than end-time, ' +
'timer slider and VCR set to 0:00',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -352,8 +342,7 @@
describe('constructor with start-time and end-time', function() {
it(
'saved position is 0, timer slider and VCR set to appropriate start and end times',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -384,8 +373,7 @@
it(
'saved position is after start-time, ' +
'timer slider and VCR set to saved position',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -416,8 +404,7 @@
it(
'saved position is negative, ' +
'timer slider and VCR set to start-time',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -448,8 +435,7 @@
it(
'saved position is not a number, ' +
'timer slider and VCR set to start-time',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
@@ -480,8 +466,7 @@
it(
'saved position is greater than end-time, ' +
'timer slider and VCR set to start-time',
- function(done)
- {
+ function(done) {
var duration, sliderEl, expectedValue;
window.VideoState = {};
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_events_bumper_plugin_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_events_bumper_plugin_spec.js
index 2ffdcf1c07..67116b5da4 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_events_bumper_plugin_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_events_bumper_plugin_spec.js
@@ -141,15 +141,15 @@
plugin.destroy();
expect(state.bumperState.videoEventsBumperPlugin).toBeUndefined();
expect($.fn.off).toHaveBeenCalledWith({
- 'ready': plugin.onReady,
- 'play': plugin.onPlay,
+ ready: plugin.onReady,
+ play: plugin.onPlay,
'ended stop': plugin.onEnded,
- 'skip': plugin.onSkip,
+ skip: plugin.onSkip,
'language_menu:show': plugin.onShowLanguageMenu,
'language_menu:hide': plugin.onHideLanguageMenu,
'captions:show': plugin.onShowCaptions,
'captions:hide': plugin.onHideCaptions,
- 'destroy': plugin.destroy
+ destroy: plugin.destroy
});
});
});
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_events_plugin_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_events_plugin_spec.js
index 938c2a3bee..e0120b165f 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_events_plugin_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_events_plugin_spec.js
@@ -194,20 +194,20 @@
state.videoEventsPlugin.destroy();
expect(state.videoEventsPlugin).toBeUndefined();
expect($.fn.off).toHaveBeenCalledWith({
- 'ready': plugin.onReady,
- 'play': plugin.onPlay,
- 'pause': plugin.onPause,
+ ready: plugin.onReady,
+ play: plugin.onPlay,
+ pause: plugin.onPause,
'ended stop': plugin.onEnded,
- 'seek': plugin.onSeek,
- 'skip': plugin.onSkip,
- 'speedchange': plugin.onSpeedChange,
+ seek: plugin.onSeek,
+ skip: plugin.onSkip,
+ speedchange: plugin.onSpeedChange,
'language_menu:show': plugin.onShowLanguageMenu,
'language_menu:hide': plugin.onHideLanguageMenu,
'transcript:show': plugin.onShowTranscript,
'transcript:hide': plugin.onHideTranscript,
'captions:show': plugin.onShowCaptions,
'captions:hide': plugin.onHideCaptions,
- 'destroy': plugin.destroy
+ destroy: plugin.destroy
});
});
});
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_full_screen_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_full_screen_spec.js
index 57930adbfe..0308f92c30 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_full_screen_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_full_screen_spec.js
@@ -27,9 +27,9 @@
});
it('correctly adds ARIA attributes to fullscreen control', function() {
- var fullScreenControl = $('.add-fullscreen');
+ var $fullScreenControl = $('.add-fullscreen');
- expect(fullScreenControl).toHaveAttrs({
+ expect($fullScreenControl).toHaveAttrs({
'aria-disabled': 'false'
});
});
@@ -48,13 +48,13 @@
});
it('correctly updates ARIA on state change', function() {
- var fullScreenControl = $('.add-fullscreen');
- fullScreenControl.click();
- expect(fullScreenControl).toHaveAttrs({
+ var $fullScreenControl = $('.add-fullscreen');
+ $fullScreenControl.click();
+ expect($fullScreenControl).toHaveAttrs({
'aria-disabled': 'false'
});
- fullScreenControl.click();
- expect(fullScreenControl).toHaveAttrs({
+ $fullScreenControl.click();
+ expect($fullScreenControl).toHaveAttrs({
'aria-disabled': 'false'
});
});
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_play_placeholder_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_play_placeholder_spec.js
index 5871d47a35..f6cf86a8c0 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_play_placeholder_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_play_placeholder_spec.js
@@ -55,7 +55,7 @@
expect(btnPlay).not.toHaveClass('is-hidden');
expect(btnPlay).toHaveAttrs({
'aria-hidden': 'false',
- 'tabindex': '0'
+ tabindex: '0'
});
state.videoPlayPlaceholder.hide();
@@ -63,7 +63,7 @@
expect(btnPlay).toHaveClass('is-hidden');
expect(btnPlay).toHaveAttrs({
'aria-hidden': 'true',
- 'tabindex': '-1'
+ tabindex: '-1'
});
});
@@ -93,8 +93,7 @@
it(
'is shown on paused video on ' + device +
' in HTML5 player',
- function()
- {
+ function() {
var btnPlay;
window.onTouchBasedDevice.and.returnValue([device]);
@@ -109,8 +108,7 @@
it(
'is hidden on playing video on ' + device +
' in HTML5 player',
- function()
- {
+ function() {
var btnPlay;
window.onTouchBasedDevice.and.returnValue([device]);
@@ -124,8 +122,7 @@
it(
'is hidden on paused video on ' + device +
' in YouTube player',
- function()
- {
+ function() {
var btnPlay;
window.onTouchBasedDevice.and.returnValue([device]);
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
index 8950b5bcce..7303a1c539 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js
@@ -12,7 +12,7 @@ function(VideoPlayer, HLS) {
(function() {
emptyArguments = arguments;
- })();
+ }());
beforeEach(function() {
oldOTBD = window.onTouchBasedDevice;
@@ -483,8 +483,7 @@ function(VideoPlayer, HLS) {
describe(
'when the current time is unavailable from the player',
- function()
- {
+ function() {
beforeEach(function() {
state.videoPlayer.player.getCurrentTime = function() {
return NaN;
@@ -500,8 +499,7 @@ function(VideoPlayer, HLS) {
describe(
'when the current time is available from the player',
- function()
- {
+ function() {
beforeEach(function() {
state.videoPlayer.player.getCurrentTime = function() {
return 60;
@@ -518,7 +516,8 @@ function(VideoPlayer, HLS) {
// Disabled 1/13/14 due to flakiness observed in master
xdescribe('update with start & end time', function() {
- var START_TIME = 1, END_TIME = 2;
+ var START_TIME = 1,
+ END_TIME = 2;
beforeEach(function() {
state = jasmine.initializePlayer(
@@ -538,8 +537,7 @@ function(VideoPlayer, HLS) {
it(
'video is paused on first endTime, start & end time are reset',
- function(done)
- {
+ function(done) {
var duration;
state.videoProgressSlider.notifyThroughHandleEnd.calls.reset();
@@ -623,8 +621,7 @@ function(VideoPlayer, HLS) {
// Disabled 1/13/14 due to flakiness observed in master
xdescribe(
'updatePlayTime when start & end times are defined',
- function()
- {
+ function() {
var START_TIME = 1,
END_TIME = 2;
@@ -646,8 +643,7 @@ function(VideoPlayer, HLS) {
it(
'when duration becomes available, updatePlayTime() is called',
- function(done)
- {
+ function(done) {
var duration;
expect(state.videoPlayer.initialSeekToStartTime).toBeTruthy();
@@ -823,8 +819,7 @@ function(VideoPlayer, HLS) {
it('`is-touch` class name is added to container', function() {
$.each(
['iPad', 'Android', 'iPhone'],
- function(index, device)
- {
+ function(index, device) {
window.onTouchBasedDevice.and.returnValue([device]);
state = jasmine.initializePlayer();
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_progress_slider_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_progress_slider_spec.js
index f5149926f3..a904439aa3 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_progress_slider_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_progress_slider_spec.js
@@ -40,15 +40,15 @@
});
it('add ARIA attributes to time control', function() {
- var timeControl = $('div.slider > .progress-handle');
+ var $timeControl = $('div.slider > .progress-handle');
- expect(timeControl).toHaveAttrs({
- 'role': 'slider',
+ expect($timeControl).toHaveAttrs({
+ role: 'slider',
'aria-label': 'Video position. Press space to toggle playback',
'aria-disabled': 'false'
});
- expect(timeControl).toHaveAttr('aria-valuetext');
+ expect($timeControl).toHaveAttr('aria-valuetext');
});
});
@@ -293,15 +293,15 @@
it('getTimeDescription', function() {
var cases = {
- '0': '0 seconds',
- '1': '1 second',
- '10': '10 seconds',
+ 0: '0 seconds',
+ 1: '1 second',
+ 10: '10 seconds',
- '60': '1 minute 0 seconds',
- '121': '2 minutes 1 second',
+ 60: '1 minute 0 seconds',
+ 121: '2 minutes 1 second',
- '3670': '1 hour 1 minute 10 seconds',
- '21541': '5 hours 59 minutes 1 second'
+ 3670: '1 hour 1 minute 10 seconds',
+ 21541: '5 hours 59 minutes 1 second'
},
getTimeDescription;
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_save_state_plugin_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_save_state_plugin_spec.js
index 75fec2555f..cc71901c6c 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_save_state_plugin_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_save_state_plugin_spec.js
@@ -241,11 +241,11 @@
state.videoSaveStatePlugin.destroy();
expect(state.videoSaveStatePlugin).toBeUndefined();
expect($.fn.off).toHaveBeenCalledWith({
- 'speedchange': plugin.onSpeedChange,
- 'play': plugin.bindUnloadHandler,
+ speedchange: plugin.onSpeedChange,
+ play: plugin.bindUnloadHandler,
'pause destroy': plugin.saveStateHandler,
'language_menu:change': plugin.onLanguageChange,
- 'youtube_availability': plugin.onYoutubeAvailability
+ youtube_availability: plugin.onYoutubeAvailability
});
expect($.fn.off).toHaveBeenCalledWith('destroy', plugin.destroy);
expect($.fn.off).toHaveBeenCalledWith('unload', plugin.onUnload);
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js
index 7359be0371..d042f2fd96 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js
@@ -23,12 +23,12 @@
});
it('add the video speed control to player', function() {
- var secondaryControls = $('.secondary-controls'),
- li = secondaryControls.find('.video-speeds li');
+ var $secondaryControls = $('.secondary-controls'),
+ li = $secondaryControls.find('.video-speeds li');
- expect(secondaryControls).toContainElement('.speeds');
- expect(secondaryControls).toContainElement('.video-speeds');
- expect(secondaryControls.find('.value').text())
+ expect($secondaryControls).toContainElement('.speeds');
+ expect($secondaryControls).toContainElement('.video-speeds');
+ expect($secondaryControls.find('.value').text())
.toBe('1.50x');
expect(li.filter('.is-active')).toHaveData(
'speed', state.videoSpeedControl.currentSpeed
@@ -56,7 +56,7 @@
});
describe('when running on non-touch based device', function() {
- var speedControl, speedEntries, speedButton, speedsContainer,
+ var $speedControl, speedEntries, $speedButton, $speedsContainer,
KEY = $.ui.keyCode,
keyPressEvent = function(key) {
@@ -65,55 +65,55 @@
beforeEach(function() {
state = jasmine.initializePlayer();
- speedControl = $('.speeds');
- speedButton = $('.speed-button');
- speedsContainer = $('.video-speeds');
- speedEntries = speedsContainer.find('.speed-option');
+ $speedControl = $('.speeds');
+ $speedButton = $('.speed-button');
+ $speedsContainer = $('.video-speeds');
+ speedEntries = $speedsContainer.find('.speed-option');
});
it('open/close the speed menu on mouseenter/mouseleave',
function() {
- speedControl.mouseenter();
- expect(speedControl).toHaveClass('is-opened');
- speedControl.mouseleave();
- expect(speedControl).not.toHaveClass('is-opened');
+ $speedControl.mouseenter();
+ expect($speedControl).toHaveClass('is-opened');
+ $speedControl.mouseleave();
+ expect($speedControl).not.toHaveClass('is-opened');
});
it('do not close the speed menu on mouseleave if a speed ' +
'entry has focus', function() {
// Open speed meenu. Focus is on last speed entry.
- speedControl.trigger(keyPressEvent(KEY.ENTER));
- speedControl.mouseenter().mouseleave();
- expect(speedControl).toHaveClass('is-opened');
+ $speedControl.trigger(keyPressEvent(KEY.ENTER));
+ $speedControl.mouseenter().mouseleave();
+ expect($speedControl).toHaveClass('is-opened');
});
it('close the speed menu on outside click', function() {
- speedControl.trigger(keyPressEvent(KEY.ENTER));
+ $speedControl.trigger(keyPressEvent(KEY.ENTER));
$(window).click();
- expect(speedControl).not.toHaveClass('is-opened');
+ expect($speedControl).not.toHaveClass('is-opened');
});
it('open the speed menu on ENTER keydown', function() {
- speedControl.trigger(keyPressEvent(KEY.ENTER));
- expect(speedControl).toHaveClass('is-opened');
+ $speedControl.trigger(keyPressEvent(KEY.ENTER));
+ expect($speedControl).toHaveClass('is-opened');
expect(speedEntries.last()).toBeFocused();
});
it('open the speed menu on SPACE keydown', function() {
- speedControl.trigger(keyPressEvent(KEY.SPACE));
- expect(speedControl).toHaveClass('is-opened');
+ $speedControl.trigger(keyPressEvent(KEY.SPACE));
+ expect($speedControl).toHaveClass('is-opened');
expect(speedEntries.last()).toBeFocused();
});
it('open the speed menu on UP keydown', function() {
- speedControl.trigger(keyPressEvent(KEY.UP));
- expect(speedControl).toHaveClass('is-opened');
+ $speedControl.trigger(keyPressEvent(KEY.UP));
+ expect($speedControl).toHaveClass('is-opened');
expect(speedEntries.last()).toBeFocused();
});
it('close the speed menu on ESCAPE keydown', function() {
- speedControl.trigger(keyPressEvent(KEY.ESCAPE));
- expect(speedControl).not.toHaveClass('is-opened');
+ $speedControl.trigger(keyPressEvent(KEY.ESCAPE));
+ expect($speedControl).not.toHaveClass('is-opened');
});
it('UP and DOWN keydown function as expected on speed entries',
@@ -122,7 +122,7 @@
speed_1_0 = speedEntries.filter(':contains("1.0x")');
// First open menu
- speedControl.trigger(keyPressEvent(KEY.UP));
+ $speedControl.trigger(keyPressEvent(KEY.UP));
expect(speed_0_75).toBeFocused();
speed_0_75.trigger(keyPressEvent(KEY.UP));
@@ -134,26 +134,26 @@
it('ESC keydown on speed entry closes menu', function() {
// First open menu. Focus is on last speed entry.
- speedControl.trigger(keyPressEvent(KEY.UP));
+ $speedControl.trigger(keyPressEvent(KEY.UP));
speedEntries.last().trigger(keyPressEvent(KEY.ESCAPE));
// Menu is closed and focus has been returned to speed
// control.
- expect(speedControl).not.toHaveClass('is-opened');
- expect(speedButton).toBeFocused();
+ expect($speedControl).not.toHaveClass('is-opened');
+ expect($speedButton).toBeFocused();
});
it('ENTER keydown on speed entry selects speed and closes menu',
function() {
// First open menu.
- speedControl.trigger(keyPressEvent(KEY.UP));
+ $speedControl.trigger(keyPressEvent(KEY.UP));
// Focus on 1.50x speed
speedEntries.eq(0).focus();
speedEntries.eq(0).trigger(keyPressEvent(KEY.ENTER));
// Menu is closed, focus has been returned to speed
// control and video speed is 1.50x.
- expect(speedButton).toBeFocused();
+ expect($speedButton).toBeFocused();
expect($('.video-speeds li[data-speed="1.50"]'))
.toHaveClass('is-active');
expect($('.speeds .value')).toHaveHtml('1.50x');
@@ -162,14 +162,14 @@
it('SPACE keydown on speed entry selects speed and closes menu',
function() {
// First open menu.
- speedControl.trigger(keyPressEvent(KEY.UP));
+ $speedControl.trigger(keyPressEvent(KEY.UP));
// Focus on 1.50x speed
speedEntries.eq(0).focus();
speedEntries.eq(0).trigger(keyPressEvent(KEY.SPACE));
// Menu is closed, focus has been returned to speed
// control and video speed is 1.50x.
- expect(speedButton).toBeFocused();
+ expect($speedButton).toBeFocused();
expect($('.video-speeds li[data-speed="1.50"]'))
.toHaveClass('is-active');
expect($('.speeds .value')).toHaveHtml('1.50x');
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_storage_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_storage_spec.js
index 1de049649d..51fd0b2edb 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_storage_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_storage_spec.js
@@ -45,7 +45,7 @@ function(VideoStorage) {
it('setItem', function() {
var expected = $.extend(true, {}, data, {item_4: 'value_4'});
- expected[id]['item_3'] = 'value_3';
+ expected[id].item_3 = 'value_3';
storage.setItem('item_3', 'value_3', true);
storage.setItem('item_4', 'value_4');
expect(window[namespace]).toEqual(expected);
@@ -55,8 +55,8 @@ function(VideoStorage) {
var data = window[namespace],
getItem = storage.getItem;
- expect(getItem('item_1', true)).toBe(data[id]['item_1']);
- expect(getItem('item_2')).toBe(data['item_2']);
+ expect(getItem('item_1', true)).toBe(data[id].item_1);
+ expect(getItem('item_2')).toBe(data.item_2);
expect(getItem('item_3')).toBeUndefined();
});
@@ -66,8 +66,8 @@ function(VideoStorage) {
removeItem('item_1', true);
removeItem('item_2');
- expect(data[id]['item_1']).toBeUndefined();
- expect(data['item_2']).toBeUndefined();
+ expect(data[id].item_1).toBeUndefined();
+ expect(data.item_2).toBeUndefined();
});
it('clear', function() {
diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_volume_control_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_volume_control_spec.js
index 0ffb35f363..88e38796aa 100644
--- a/common/lib/xmodule/xmodule/js/spec/video/video_volume_control_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/video/video_volume_control_spec.js
@@ -59,26 +59,26 @@
});
it('add ARIA attributes to live region', function() {
- var liveRegion = $('.video-live-region');
+ var $liveRegion = $('.video-live-region');
- expect(liveRegion).toHaveAttrs({
+ expect($liveRegion).toHaveAttrs({
'aria-live': 'polite'
});
});
it('add ARIA attributes to volume control', function() {
- var button = $('.volume .control');
+ var $button = $('.volume .control');
- expect(button).toHaveAttrs({
+ expect($button).toHaveAttrs({
'aria-disabled': 'false'
});
});
it('bind the volume control', function() {
- var button = $('.volume .control');
+ var $button = $('.volume .control');
- expect(button).toHandle('keydown');
- expect(button).toHandle('mousedown');
+ expect($button).toHandle('keydown');
+ expect($button).toHandle('mousedown');
expect($('.volume')).not.toHaveClass('is-opened');
$('.volume').mouseenter();
@@ -98,7 +98,7 @@
assertLiveRegionState: function() {
return {
compare: function(actual, volume, expectation) {
- var region = $('.video-live-region');
+ var $region = $('.video-live-region');
var getExpectedText = function(text) {
return text + ' Volume.';
@@ -106,7 +106,7 @@
actual.setVolume(volume, true, true);
return {
- pass: region.text() === getExpectedText(expectation)
+ pass: $region.text() === getExpectedText(expectation)
};
}
};
@@ -199,12 +199,12 @@
});
it('volume is increased correctly', function() {
- var button = $('.volume .control');
+ var $button = $('.volume .control');
volumeControl.volume = 60;
// adjust the volume
- button.focus();
- button.trigger(keyPressEvent(KEY.UP));
+ $button.focus();
+ $button.trigger(keyPressEvent(KEY.UP));
expect(volumeControl.volume).toEqual(80);
});
@@ -222,12 +222,12 @@
});
it('volume is decreased correctly', function() {
- var button = $('.volume .control');
+ var $button = $('.volume .control');
volumeControl.volume = 60;
// adjust the volume
- button.focus();
- button.trigger(keyPressEvent(KEY.DOWN));
+ $button.focus();
+ $button.trigger(keyPressEvent(KEY.DOWN));
expect(volumeControl.volume).toEqual(40);
});
diff --git a/common/lib/xmodule/xmodule/js/spec/xmodule_spec.js b/common/lib/xmodule/xmodule/js/spec/xmodule_spec.js
index 8dd3efdf16..6a59098894 100644
--- a/common/lib/xmodule/xmodule/js/spec/xmodule_spec.js
+++ b/common/lib/xmodule/xmodule/js/spec/xmodule_spec.js
@@ -9,9 +9,9 @@
});
describe('implementation', function() {
- var el,
+ var $el,
videoModule = {
- 'module': 'video_module'
+ module: 'video_module'
},
editCallback,
displayCallback,
@@ -19,7 +19,7 @@
removeVideo;
beforeEach(function() {
- el = $('
');
+ $el = $('
');
if (window.None) {
spyOn(window, 'None');
@@ -48,7 +48,7 @@
});
afterEach(function() {
- el = null;
+ $el = null;
if (removeNone) {
window.None = undefined;
@@ -59,16 +59,16 @@
});
it('if element module is of type None, nothing happens', function() {
- el.data('type', 'None');
+ $el.data('type', 'None');
- expect(XBlockToXModuleShim(null, el)).toBeUndefined();
+ expect(XBlockToXModuleShim(null, $el)).toBeUndefined();
expect(window.None).not.toHaveBeenCalled();
});
it('if element module is of type Video, Video module constructor is called', function() {
- el.data('type', 'Video');
+ $el.data('type', 'Video');
- expect(XBlockToXModuleShim(null, el)).toEqual(videoModule);
+ expect(XBlockToXModuleShim(null, $el)).toEqual(videoModule);
expect(window.Video).toHaveBeenCalled();
expect('XModule.loaded.edit').not.toHaveBeenTriggeredOn(document);
@@ -76,28 +76,28 @@
});
it('if element has class "xmodule_edit"', function() {
- el.data('type', 'Video')
+ $el.data('type', 'Video')
.addClass('xmodule_edit');
- XBlockToXModuleShim(null, el);
+ XBlockToXModuleShim(null, $el);
expect('XModule.loaded.edit').toHaveBeenTriggeredOn($(document));
- expect(editCallback).toHaveBeenCalledWith(jasmine.any($.Event), el, videoModule);
+ expect(editCallback).toHaveBeenCalledWith(jasmine.any($.Event), $el, videoModule);
expect('XModule.loaded.display').not.toHaveBeenTriggeredOn($(document));
});
it('if element has class "xmodule_display"', function() {
- el.data('type', 'Video')
+ $el.data('type', 'Video')
.addClass('xmodule_display');
- XBlockToXModuleShim(null, el);
+ XBlockToXModuleShim(null, $el);
expect('XModule.loaded.edit').not.toHaveBeenTriggeredOn($(document));
expect('XModule.loaded.display').toHaveBeenTriggeredOn($(document));
- expect(displayCallback).toHaveBeenCalledWith(jasmine.any($.Event), el, videoModule);
+ expect(displayCallback).toHaveBeenCalledWith(jasmine.any($.Event), $el, videoModule);
});
it('if element has classes "xmodule_edit", and "xmodule_display"', function() {
- el.data('type', 'Video')
+ $el.data('type', 'Video')
.addClass('xmodule_edit')
.addClass('xmodule_display');
- XBlockToXModuleShim(null, el);
+ XBlockToXModuleShim(null, $el);
expect('XModule.loaded.edit').toHaveBeenTriggeredOn($(document));
expect('XModule.loaded.display').toHaveBeenTriggeredOn($(document));
});
@@ -111,8 +111,8 @@
window.console = jasmine.createSpy('console.error');
}
- el.data('type', 'UnknownModule');
- expect(XBlockToXModuleShim(null, el)).toBeUndefined();
+ $el.data('type', 'UnknownModule');
+ expect(XBlockToXModuleShim(null, $el)).toBeUndefined();
expect(console.error).toHaveBeenCalledWith(
'Unable to load UnknownModule: window[moduleType] is not a constructor'
@@ -124,7 +124,7 @@
it('element is of an unknown Module type, JavaScript throws if console.error() is not defined', function() {
var oldConsole = window.console,
testFunction = function() {
- return XBlockToXModuleShim(null, el);
+ return XBlockToXModuleShim(null, $el);
};
@@ -132,7 +132,7 @@
window.console = undefined;
}
- el.data('type', 'UnknownModule');
+ $el.data('type', 'UnknownModule');
expect(testFunction).toThrow();
window.console = oldConsole;
diff --git a/common/lib/xmodule/xmodule/js/src/capa/display.js b/common/lib/xmodule/xmodule/js/src/capa/display.js
index e5acc1e375..e696c9d448 100644
--- a/common/lib/xmodule/xmodule/js/src/capa/display.js
+++ b/common/lib/xmodule/xmodule/js/src/capa/display.js
@@ -767,7 +767,6 @@
this.gentleAlertNotification.hide();
this.saveNotification.hide();
this.showAnswerNotification.hide();
-
};
Problem.prototype.gentle_alert = function(msg) {
diff --git a/common/lib/xmodule/xmodule/js/src/collapsible.js b/common/lib/xmodule/xmodule/js/src/collapsible.js
index 73d737f098..767ca8c96e 100644
--- a/common/lib/xmodule/xmodule/js/src/collapsible.js
+++ b/common/lib/xmodule/xmodule/js/src/collapsible.js
@@ -70,7 +70,7 @@
// close_text: text that should be displayed when the collapsible
// is closed.
function toggleFull(event, open_text, close_text) {
- var el, new_text, parent;
+ var $el, new_text, parent;
event.preventDefault();
@@ -85,12 +85,12 @@
}
if ($(event.target).hasClass('full')) {
- el = parent.find('.full');
+ $el = parent.find('.full');
} else {
- el = $(event.target);
+ $el = $(event.target);
}
- el.text(new_text);
+ $el.text(new_text);
}
// [function toggleHint]
diff --git a/common/lib/xmodule/xmodule/js/src/html/imageModal.js b/common/lib/xmodule/xmodule/js/src/html/imageModal.js
index e9288bd37d..dccabf5388 100644
--- a/common/lib/xmodule/xmodule/js/src/html/imageModal.js
+++ b/common/lib/xmodule/xmodule/js/src/html/imageModal.js
@@ -8,9 +8,9 @@ var setupFullScreenModal = function() {
// if contents of zoomable link is image and large image link exists: setup modal
if (smallImageObject.is('img') && largeImageSRC) {
var data = {
- 'smallHTML': $(this).html(),
- 'largeALT': smallImageObject.attr('alt'),
- 'largeSRC': largeImageSRC
+ smallHTML: $(this).html(),
+ largeALT: smallImageObject.attr('alt'),
+ largeSRC: largeImageSRC
};
var html = _.template($('#image-modal-tpl').text())(data);
$(this).replaceWith(html);
diff --git a/common/lib/xmodule/xmodule/js/src/poll/poll_main.js b/common/lib/xmodule/xmodule/js/src/poll/poll_main.js
index 18b34c4cef..e97a1356f1 100644
--- a/common/lib/xmodule/xmodule/js/src/poll/poll_main.js
+++ b/common/lib/xmodule/xmodule/js/src/poll/poll_main.js
@@ -2,7 +2,7 @@
define('PollMain', [], function() {
PollMain.prototype = {
- 'showAnswerGraph': function(poll_answers, total) {
+ showAnswerGraph: function(poll_answers, total) {
var _this, totalValue;
totalValue = parseFloat(total);
@@ -25,12 +25,12 @@
_this.answersObj[index].statsEl.show();
_this.answersObj[index].numberEl.html('' + value + ' (' + percentValue.toFixed(1) + '%)');
_this.answersObj[index].percentEl.css({
- 'width': '' + percentValue.toFixed(1) + '%'
+ width: '' + percentValue.toFixed(1) + '%'
});
});
},
- 'submitAnswer': function(answer, answerObj) {
+ submitAnswer: function(answer, answerObj) {
var _this;
// Make sure that the user can answer a question only once.
@@ -70,7 +70,7 @@
}, // End-of: 'submitAnswer': function (answer, answerEl) {
- 'submitReset': function() {
+ submitReset: function() {
var _this;
_this = this;
@@ -109,7 +109,7 @@
);
}, // End-of: 'submitAnswer': function (answer, answerEl) {
- 'postInit': function() {
+ postInit: function() {
var _this;
// Access this object inside inner functions.
diff --git a/common/lib/xmodule/xmodule/js/src/video/00_component.js b/common/lib/xmodule/xmodule/js/src/video/00_component.js
index 1f72ef72f0..0b1c07bd9f 100644
--- a/common/lib/xmodule/xmodule/js/src/video/00_component.js
+++ b/common/lib/xmodule/xmodule/js/src/video/00_component.js
@@ -28,7 +28,7 @@ function() {
return new F();
};
- })();
+ }());
/**
* Component module.
diff --git a/common/lib/xmodule/xmodule/js/src/video/00_i18n.js b/common/lib/xmodule/xmodule/js/src/video/00_i18n.js
index c923a9be9e..435c420565 100644
--- a/common/lib/xmodule/xmodule/js/src/video/00_i18n.js
+++ b/common/lib/xmodule/xmodule/js/src/video/00_i18n.js
@@ -11,28 +11,28 @@ function() {
*/
return {
- 'Play': gettext('Play'),
- 'Pause': gettext('Pause'),
- 'Mute': gettext('Mute'),
- 'Unmute': gettext('Unmute'),
+ Play: gettext('Play'),
+ Pause: gettext('Pause'),
+ Mute: gettext('Mute'),
+ Unmute: gettext('Unmute'),
'Exit full browser': gettext('Exit full browser'),
'Fill browser': gettext('Fill browser'),
- 'Speed': gettext('Speed'),
- 'Volume': gettext('Volume'),
+ Speed: gettext('Speed'),
+ Volume: gettext('Volume'),
// Translators: Volume level equals 0%.
- 'Muted': gettext('Muted'),
+ Muted: gettext('Muted'),
// Translators: Volume level in range ]0,20]%
'Very low': gettext('Very low'),
// Translators: Volume level in range ]20,40]%
- 'Low': gettext('Low'),
+ Low: gettext('Low'),
// Translators: Volume level in range ]40,60]%
- 'Average': gettext('Average'),
+ Average: gettext('Average'),
// Translators: Volume level in range ]60,80]%
- 'Loud': gettext('Loud'),
+ Loud: gettext('Loud'),
// Translators: Volume level in range ]80,99]%
'Very loud': gettext('Very loud'),
// Translators: Volume level equals 100%.
- 'Maximum': gettext('Maximum')
+ Maximum: gettext('Maximum')
};
});
}(RequireJS.define));
diff --git a/common/lib/xmodule/xmodule/js/src/video/00_resizer.js b/common/lib/xmodule/xmodule/js/src/video/00_resizer.js
index d477c593f5..060214238d 100644
--- a/common/lib/xmodule/xmodule/js/src/video/00_resizer.js
+++ b/common/lib/xmodule/xmodule/js/src/video/00_resizer.js
@@ -36,12 +36,12 @@ function() {
};
var getData = function() {
- var container = $(config.container),
- containerWidth = container.width() + delta.width,
- containerHeight = container.height() + delta.height,
+ var $container = $(config.container),
+ containerWidth = $container.width() + delta.width,
+ containerHeight = $container.height() + delta.height,
containerRatio = config.containerRatio,
- element = $(config.element),
+ $element = $(config.element),
elementRatio = config.elementRatio;
if (!containerRatio) {
@@ -49,14 +49,14 @@ function() {
}
if (!elementRatio) {
- elementRatio = element.width() / element.height();
+ elementRatio = $element.width() / $element.height();
}
return {
containerWidth: containerWidth,
containerHeight: containerHeight,
containerRatio: containerRatio,
- element: element,
+ element: $element,
elementRatio: elementRatio
};
};
@@ -92,10 +92,10 @@ function() {
height = data.containerWidth / data.elementRatio;
data.element.css({
- 'height': height,
- 'width': data.containerWidth,
- 'top': 0.5 * (data.containerHeight - height),
- 'left': 0
+ height: height,
+ width: data.containerWidth,
+ top: 0.5 * (data.containerHeight - height),
+ left: 0
});
return module;
@@ -106,10 +106,10 @@ function() {
width = data.containerHeight * data.elementRatio;
data.element.css({
- 'height': data.containerHeight,
- 'width': data.containerHeight * data.elementRatio,
- 'top': 0,
- 'left': 0.5 * (data.containerWidth - width)
+ height: data.containerHeight,
+ width: data.containerHeight * data.elementRatio,
+ top: 0,
+ left: 0.5 * (data.containerWidth - width)
});
return module;
@@ -176,7 +176,7 @@ function() {
};
var resetDelta = function() {
- delta['height'] = delta['width'] = 0;
+ delta.height = delta.width = 0;
return module;
};
@@ -200,7 +200,7 @@ function() {
var destroy = function() {
var data = getData();
data.element.css({
- 'height': '', 'width': '', 'top': '', 'left': ''
+ height: '', width: '', top: '', left: ''
});
removeCallbacks();
resetDelta();
diff --git a/common/lib/xmodule/xmodule/js/src/video/00_sjson.js b/common/lib/xmodule/xmodule/js/src/video/00_sjson.js
index 954313c278..9d376c89f8 100644
--- a/common/lib/xmodule/xmodule/js/src/video/00_sjson.js
+++ b/common/lib/xmodule/xmodule/js/src/video/00_sjson.js
@@ -96,8 +96,8 @@ function() {
});
return {
- 'start': filteredTimes,
- 'captions': filteredCaptions
+ start: filteredTimes,
+ captions: filteredCaptions
};
}
diff --git a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js
index 825976e808..2f7d99a075 100644
--- a/common/lib/xmodule/xmodule/js/src/video/01_initialize.js
+++ b/common/lib/xmodule/xmodule/js/src/video/01_initialize.js
@@ -325,7 +325,7 @@ function(VideoPlayer, i18n, moment, _) {
.find('.spinner')
.attr({
'aria-hidden': 'true',
- 'tabindex': -1
+ tabindex: -1
});
}
@@ -367,33 +367,33 @@ function(VideoPlayer, i18n, moment, _) {
// Compatibility keys used to change names of some parameters in
// the final configuration.
compatKeys = {
- 'start': 'startTime',
- 'end': 'endTime'
+ start: 'startTime',
+ end: 'endTime'
},
// Conversions used to pre-process some configuration data.
conversions = {
- 'showCaptions': isBoolean,
- 'autoplay': isBoolean,
- 'autohideHtml5': isBoolean,
- 'savedVideoPosition': function(value) {
+ showCaptions: isBoolean,
+ autoplay: isBoolean,
+ autohideHtml5: isBoolean,
+ savedVideoPosition: function(value) {
return storage.getItem('savedVideoPosition', true) ||
Number(value) ||
0;
},
- 'speed': function(value) {
+ speed: function(value) {
return storage.getItem('speed', true) || value;
},
- 'generalSpeed': function(value) {
+ generalSpeed: function(value) {
return storage.getItem('general_speed') ||
value ||
'1.0';
},
- 'transcriptLanguage': function(value) {
+ transcriptLanguage: function(value) {
return storage.getItem('language') ||
value ||
'en';
},
- 'ytTestTimeout': function(value) {
+ ytTestTimeout: function(value) {
value = parseInt(value, 10);
if (!isFinite(value)) {
@@ -402,7 +402,7 @@ function(VideoPlayer, i18n, moment, _) {
return value;
},
- 'startTime': function(value) {
+ startTime: function(value) {
value = parseInt(value, 10);
if (!isFinite(value) || value < 0) {
return 0;
@@ -410,7 +410,7 @@ function(VideoPlayer, i18n, moment, _) {
return value;
},
- 'endTime': function(value) {
+ endTime: function(value) {
value = parseInt(value, 10);
if (!isFinite(value) || value === 0) {
@@ -689,10 +689,10 @@ function(VideoPlayer, i18n, moment, _) {
// Youtube Flash = [0.75, 1, 1.25, 1.5]
// Youtube HTML5 = [0.25, 0.5, 1, 1.5, 2]
var map = {
- '0.25': '0.75', // Youtube HTML5 -> HTML5 or Youtube Flash
+ 0.25: '0.75', // Youtube HTML5 -> HTML5 or Youtube Flash
'0.50': '0.75', // Youtube HTML5 -> HTML5 or Youtube Flash
- '0.75': '0.50', // HTML5 or Youtube Flash -> Youtube HTML5
- '1.25': '1.50', // HTML5 or Youtube Flash -> Youtube HTML5
+ 0.75: '0.50', // HTML5 or Youtube Flash -> Youtube HTML5
+ 1.25: '1.50', // HTML5 or Youtube Flash -> Youtube HTML5
'2.0': '1.50' // Youtube HTML5 -> HTML5 or Youtube Flash
};
diff --git a/common/lib/xmodule/xmodule/js/src/video/04_video_control.js b/common/lib/xmodule/xmodule/js/src/video/04_video_control.js
index 0b6084d1af..84c3de6649 100644
--- a/common/lib/xmodule/xmodule/js/src/video/04_video_control.js
+++ b/common/lib/xmodule/xmodule/js/src/video/04_video_control.js
@@ -41,10 +41,10 @@ function() {
function destroy() {
this.el.off({
- 'mousemove': this.videoControl.showControls,
- 'keydown': this.videoControl.showControls,
- 'destroy': this.videoControl.destroy,
- 'initialize': this.videoControl.focusFirst
+ mousemove: this.videoControl.showControls,
+ keydown: this.videoControl.showControls,
+ destroy: this.videoControl.destroy,
+ initialize: this.videoControl.focusFirst
});
this.el.off('controls:show');
@@ -77,8 +77,8 @@ function() {
function _bindHandlers(state) {
if ((state.videoType === 'html5') && (state.config.autohideHtml5)) {
state.el.on({
- 'mousemove': state.videoControl.showControls,
- 'keydown': state.videoControl.showControls
+ mousemove: state.videoControl.showControls,
+ keydown: state.videoControl.showControls
});
}
diff --git a/common/lib/xmodule/xmodule/js/src/video/04_video_full_screen.js b/common/lib/xmodule/xmodule/js/src/video/04_video_full_screen.js
index 3912fb118d..590e057cf1 100644
--- a/common/lib/xmodule/xmodule/js/src/video/04_video_full_screen.js
+++ b/common/lib/xmodule/xmodule/js/src/video/04_video_full_screen.js
@@ -50,8 +50,8 @@
$(document).off('keyup', this.videoFullScreen.exitHandler);
this.videoFullScreen.fullScreenEl.remove();
this.el.off({
- 'fullscreen': this.videoFullScreen.onFullscreenChange,
- 'destroy': this.videoFullScreen.destroy
+ fullscreen: this.videoFullScreen.onFullscreenChange,
+ destroy: this.videoFullScreen.destroy
});
if (this.isFullScreen) {
this.videoFullScreen.exit();
@@ -78,8 +78,8 @@
function _bindHandlers(state) {
state.videoFullScreen.fullScreenEl.on('click', state.videoFullScreen.toggleHandler);
state.el.on({
- 'fullscreen': state.videoFullScreen.onFullscreenChange,
- 'destroy': state.videoFullScreen.destroy
+ fullscreen: state.videoFullScreen.onFullscreenChange,
+ destroy: state.videoFullScreen.destroy
});
$(document).on('keyup', state.videoFullScreen.exitHandler);
}
@@ -142,8 +142,8 @@
this.el.trigger('fullscreen', [this.isFullScreen]);
$(closedCaptionsEl).css({
- 'top': '70%',
- 'left': '5%'
+ top: '70%',
+ left: '5%'
});
}
@@ -164,8 +164,8 @@
this.el.trigger('fullscreen', [this.isFullScreen]);
$(closedCaptionsEl).css({
- 'top': '70%',
- 'left': '5%'
+ top: '70%',
+ left: '5%'
});
}
diff --git a/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js b/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js
index c9604fe2ca..a091537b9a 100644
--- a/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js
+++ b/common/lib/xmodule/xmodule/js/src/video/05_video_quality_control.js
@@ -66,8 +66,8 @@ function(HtmlUtils) {
function destroy() {
this.videoQualityControl.el.off({
- 'click': this.videoQualityControl.toggleQuality,
- 'destroy': this.videoQualityControl.destroy
+ click: this.videoQualityControl.toggleQuality,
+ destroy: this.videoQualityControl.destroy
});
this.el.off('.quality');
this.videoQualityControl.el.remove();
@@ -164,7 +164,8 @@ function(HtmlUtils) {
// This function toggles the quality of video only if HD qualities are
// available.
function toggleQuality(event) {
- var newQuality, value = this.videoQualityControl.quality,
+ var newQuality,
+ value = this.videoQualityControl.quality,
isHD = _.contains(this.config.availableHDQualities, value);
event.preventDefault();
diff --git a/common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js b/common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js
index 8c87b6b387..af04bbe164 100644
--- a/common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js
+++ b/common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js
@@ -96,14 +96,14 @@ function() {
// Let screen readers know that this div, representing the slider
// handle, behaves as a slider named 'video position'.
state.videoProgressSlider.handle.attr({
- 'role': 'slider',
+ role: 'slider',
'aria-disabled': false,
'aria-valuetext': getTimeDescription(state.videoProgressSlider
.slider.slider('option', 'value')),
'aria-valuemax': state.videoPlayer.duration(),
'aria-valuemin': '0',
'aria-valuenow': state.videoPlayer.currentTime,
- 'tabindex': '0',
+ tabindex: '0',
'aria-label': gettext('Video position. Press space to toggle playback')
});
}
@@ -217,7 +217,7 @@ function() {
this.trigger(
'videoPlayer.onSlideSeek',
- {'type': 'onSlideSeek', 'time': time}
+ {type: 'onSlideSeek', time: time}
);
// ARIA
@@ -238,7 +238,7 @@ function() {
if (this.videoProgressSlider.lastSeekValue !== ui.value) {
this.trigger(
'videoPlayer.onSlideSeek',
- {'type': 'onSlideSeek', 'time': ui.value}
+ {type: 'onSlideSeek', time: ui.value}
);
}
@@ -327,7 +327,7 @@ function() {
msg = ngettext('%(value)s second', '%(value)s seconds', value);
break;
}
- return interpolate(msg, {'value': value}, true);
+ return interpolate(msg, {value: value}, true);
};
seconds = seconds % 60;
diff --git a/common/lib/xmodule/xmodule/js/src/video/07_video_volume_control.js b/common/lib/xmodule/xmodule/js/src/video/07_video_volume_control.js
index 63d7b7ee35..8500f219db 100644
--- a/common/lib/xmodule/xmodule/js/src/video/07_video_volume_control.js
+++ b/common/lib/xmodule/xmodule/js/src/video/07_video_volume_control.js
@@ -80,18 +80,18 @@ function(HtmlUtils) {
this.state.el
.off('play.volume')
.off({
- 'keydown': this.keyDownHandler,
- 'volumechange': this.onVolumeChangeHandler
+ keydown: this.keyDownHandler,
+ volumechange: this.onVolumeChangeHandler
});
this.el.off({
- 'mouseenter': this.openMenu,
- 'mouseleave': this.closeMenu
+ mouseenter: this.openMenu,
+ mouseleave: this.closeMenu
});
this.button.off({
- 'mousedown': this.toggleMuteHandler,
- 'keydown': this.keyDownButtonHandler,
- 'focus': this.openMenu,
- 'blur': this.closeMenu
+ mousedown: this.toggleMuteHandler,
+ keydown: this.keyDownButtonHandler,
+ focus: this.openMenu,
+ blur: this.closeMenu
});
this.el.remove();
delete this.state.videoVolumeControl;
@@ -157,18 +157,18 @@ function(HtmlUtils) {
bindHandlers: function() {
this.state.el.on({
'play.volume': _.once(this.updateVolumeSilently),
- 'volumechange': this.onVolumeChangeHandler
+ volumechange: this.onVolumeChangeHandler
});
this.state.el.find('.volume').on({
- 'mouseenter': this.openMenu,
- 'mouseleave': this.closeMenu
+ mouseenter: this.openMenu,
+ mouseleave: this.closeMenu
});
this.button.on({
- 'keydown': this.keyDownHandler,
- 'click': false,
- 'mousedown': this.toggleMuteHandler,
- 'focus': this.openMenu,
- 'blur': this.closeMenu
+ keydown: this.keyDownHandler,
+ click: false,
+ mousedown: this.toggleMuteHandler,
+ focus: this.openMenu,
+ blur: this.closeMenu
});
this.state.el.on('destroy', this.destroy);
},
@@ -455,7 +455,7 @@ function(HtmlUtils) {
/** Initializes the module. */
initialize: function() {
this.liveRegion = $('
', {
- 'class': 'sr video-live-region',
+ class: 'sr video-live-region',
'aria-hidden': 'false',
'aria-live': 'polite'
});
@@ -470,7 +470,7 @@ function(HtmlUtils) {
update: function(volume) {
this.liveRegion.text([
this.getVolumeDescription(volume),
- this.i18n['Volume'] + '.'
+ this.i18n.Volume + '.'
].join(' '));
$(this.button).parent().find('.volume-slider')
@@ -483,20 +483,20 @@ function(HtmlUtils) {
*/
getVolumeDescription: function(volume) {
if (volume === 0) {
- return this.i18n['Muted'];
+ return this.i18n.Muted;
} else if (volume <= 20) {
return this.i18n['Very low'];
} else if (volume <= 40) {
- return this.i18n['Low'];
+ return this.i18n.Low;
} else if (volume <= 60) {
- return this.i18n['Average'];
+ return this.i18n.Average;
} else if (volume <= 80) {
- return this.i18n['Loud'];
+ return this.i18n.Loud;
} else if (volume <= 99) {
return this.i18n['Very loud'];
}
- return this.i18n['Maximum'];
+ return this.i18n.Maximum;
}
};
diff --git a/common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js b/common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js
index f953f1d772..fffc121b53 100644
--- a/common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js
+++ b/common/lib/xmodule/xmodule/js/src/video/08_video_speed_control.js
@@ -52,10 +52,10 @@
destroy: function() {
this.el.off({
- 'mouseenter': this.mouseEnterHandler,
- 'mouseleave': this.mouseLeaveHandler,
- 'click': this.clickMenuHandler,
- 'keydown': this.keyDownMenuHandler
+ mouseenter: this.mouseEnterHandler,
+ mouseleave: this.mouseLeaveHandler,
+ click: this.clickMenuHandler,
+ keydown: this.keyDownMenuHandler
});
this.state.el.off({
@@ -139,10 +139,10 @@
bindHandlers: function() {
// Attach various events handlers to the speed menu button.
this.el.on({
- 'mouseenter': this.mouseEnterHandler,
- 'mouseleave': this.mouseLeaveHandler,
- 'click': this.openMenu,
- 'keydown': this.keyDownMenuHandler
+ mouseenter: this.mouseEnterHandler,
+ mouseleave: this.mouseLeaveHandler,
+ click: this.openMenu,
+ keydown: this.keyDownMenuHandler
});
// Attach click and keydown event handlers to the individual speed
@@ -341,7 +341,7 @@
// We do not stop propagation and default behavior on a TAB
// keypress.
return event.keyCode === KEY.TAB;
- },
+ },
/**
* Keydown event handler for speed links.
@@ -409,7 +409,7 @@
}
return true;
- }
+ }
};
return SpeedControl;
diff --git a/common/lib/xmodule/xmodule/js/src/video/095_video_context_menu.js b/common/lib/xmodule/xmodule/js/src/video/095_video_context_menu.js
index cfffa0a6de..dadce7945d 100644
--- a/common/lib/xmodule/xmodule/js/src/video/095_video_context_menu.js
+++ b/common/lib/xmodule/xmodule/js/src/video/095_video_context_menu.js
@@ -44,7 +44,8 @@ function(Component) {
return this.element;
},
addChild: function(child) {
- var firstChild = null, lastChild = null;
+ var firstChild = null,
+ lastChild = null;
if (this.hasChildren()) {
lastChild = this.getLastChild();
lastChild.next = child;
@@ -188,9 +189,9 @@ function(Component) {
createElement: function() {
return $('
', {
- 'class': ['contextmenu', this.options.prefix + 'contextmenu'].join(' '),
- 'role': 'menu',
- 'tabindex': -1
+ class: ['contextmenu', this.options.prefix + 'contextmenu'].join(' '),
+ role: 'menu',
+ tabindex: -1
});
},
@@ -325,14 +326,14 @@ function(Component) {
}
return false;
- }
+ }
});
Overlay = Component.extend({
ns: '.overlay',
initialize: function(clickHandler, contextmenuHandler) {
this.element = $('
', {
- 'class': 'overlay'
+ class: 'overlay'
});
this.clickHandler = clickHandler;
this.contextmenuHandler = contextmenuHandler;
@@ -389,26 +390,26 @@ function(Component) {
},
createElement: function() {
- var element = $('
', {
- 'class': ['submenu-item', 'menu-item', this.options.prefix + 'submenu-item'].join(' '),
+ var $element = $('
', {
+ class: ['submenu-item', 'menu-item', this.options.prefix + 'submenu-item'].join(' '),
'aria-expanded': 'false',
'aria-haspopup': 'true',
'aria-labelledby': 'submenu-item-label-' + this.id,
- 'role': 'menuitem',
- 'tabindex': -1
+ role: 'menuitem',
+ tabindex: -1
});
this.label = $('
', {
- 'id': 'submenu-item-label-' + this.id,
- 'text': this.options.label
- }).appendTo(element);
+ id: 'submenu-item-label-' + this.id,
+ text: this.options.label
+ }).appendTo($element);
this.list = $('
', {
- 'class': ['submenu', this.options.prefix + 'submenu'].join(' '),
- 'role': 'menu'
- }).appendTo(element);
+ class: ['submenu', this.options.prefix + 'submenu'].join(' '),
+ role: 'menu'
+ }).appendTo($element);
- return element;
+ return $element;
},
appendContent: function(content) {
@@ -447,7 +448,7 @@ function(Component) {
}
return false;
- },
+ },
open: function() {
AbstractMenu.prototype.open.call(this);
@@ -494,11 +495,11 @@ function(Component) {
].join(' ');
return $('
', {
- 'class': classNames,
+ class: classNames,
'aria-selected': this.options.isSelected ? 'true' : 'false',
- 'role': 'menuitem',
- 'tabindex': -1,
- 'text': this.options.label
+ role: 'menuitem',
+ tabindex: -1,
+ text: this.options.label
});
},
@@ -567,7 +568,7 @@ function(Component) {
}
return false;
- }
+ }
});
// VideoContextMenu() function - what this module 'exports'.
@@ -584,10 +585,10 @@ function(Component) {
},
initialize: function(menuitem) {
state.el.on({
- 'play': function() {
+ play: function() {
menuitem.setLabel(i18n.Pause);
},
- 'pause': function() {
+ pause: function() {
menuitem.setLabel(i18n.Play);
}
});
@@ -599,7 +600,7 @@ function(Component) {
},
initialize: function(menuitem) {
state.el.on({
- 'volumechange': function() {
+ volumechange: function() {
if (state.videoVolumeControl.getMuteStatus()) {
menuitem.setLabel(i18n.Unmute);
} else {
@@ -615,7 +616,7 @@ function(Component) {
},
initialize: function(menuitem) {
state.el.on({
- 'fullscreen': function(event, isFullscreen) {
+ fullscreen: function(event, isFullscreen) {
if (isFullscreen) {
menuitem.setLabel(i18n['Exit full browser']);
} else {
@@ -632,7 +633,7 @@ function(Component) {
}),
initialize: function(menuitem) {
state.el.on({
- 'speedchange': function(event, speed) {
+ speedchange: function(event, speed) {
var item = menuitem.getChildren().filter(function(item) {
return item.options.speed === speed;
})[0];
@@ -643,7 +644,7 @@ function(Component) {
});
}
}
- ]
+ ]
};
$.fn.contextmenu = function(container, options) {
diff --git a/common/lib/xmodule/xmodule/js/src/video/09_bumper.js b/common/lib/xmodule/xmodule/js/src/video/09_bumper.js
index 1a6f5ddce2..0312095bf8 100644
--- a/common/lib/xmodule/xmodule/js/src/video/09_bumper.js
+++ b/common/lib/xmodule/xmodule/js/src/video/09_bumper.js
@@ -95,8 +95,8 @@
var events = ['ended', 'error'].join(' ');
this.element.off(events, this.showMainVideoHandler);
this.element.off({
- 'timeupdate': this.skipByDuration,
- 'initialize': this.destroyAndResolve
+ timeupdate: this.skipByDuration,
+ initialize: this.destroyAndResolve
});
this.element.removeClass('is-bumper');
if (_.isFunction(this.state.videoPlayer.destroy)) {
diff --git a/common/lib/xmodule/xmodule/js/src/video/09_events_bumper_plugin.js b/common/lib/xmodule/xmodule/js/src/video/09_events_bumper_plugin.js
index 3eb205101b..a6067f02a2 100644
--- a/common/lib/xmodule/xmodule/js/src/video/09_events_bumper_plugin.js
+++ b/common/lib/xmodule/xmodule/js/src/video/09_events_bumper_plugin.js
@@ -35,15 +35,15 @@
initialize: function() {
this.events = {
- 'ready': this.onReady,
- 'play': this.onPlay,
+ ready: this.onReady,
+ play: this.onPlay,
'ended stop': this.onEnded,
- 'skip': this.onSkip,
+ skip: this.onSkip,
'language_menu:show': this.onShowLanguageMenu,
'language_menu:hide': this.onHideLanguageMenu,
'captions:show': this.onShowCaptions,
'captions:hide': this.onHideCaptions,
- 'destroy': this.destroy
+ destroy: this.destroy
};
this.bindHandlers();
},
diff --git a/common/lib/xmodule/xmodule/js/src/video/09_events_plugin.js b/common/lib/xmodule/xmodule/js/src/video/09_events_plugin.js
index c07e91b81c..ab8fbfccbf 100644
--- a/common/lib/xmodule/xmodule/js/src/video/09_events_plugin.js
+++ b/common/lib/xmodule/xmodule/js/src/video/09_events_plugin.js
@@ -38,20 +38,20 @@
initialize: function() {
this.events = {
- 'ready': this.onReady,
- 'play': this.onPlay,
- 'pause': this.onPause,
+ ready: this.onReady,
+ play: this.onPlay,
+ pause: this.onPause,
'ended stop': this.onEnded,
- 'seek': this.onSeek,
- 'skip': this.onSkip,
- 'speedchange': this.onSpeedChange,
+ seek: this.onSeek,
+ skip: this.onSkip,
+ speedchange: this.onSpeedChange,
'language_menu:show': this.onShowLanguageMenu,
'language_menu:hide': this.onHideLanguageMenu,
'transcript:show': this.onShowTranscript,
'transcript:hide': this.onHideTranscript,
'captions:show': this.onShowCaptions,
'captions:hide': this.onHideCaptions,
- 'destroy': this.destroy
+ destroy: this.destroy
};
this.bindHandlers();
this.emitPlayVideoEvent = true;
diff --git a/common/lib/xmodule/xmodule/js/src/video/09_play_pause_control.js b/common/lib/xmodule/xmodule/js/src/video/09_play_pause_control.js
index 85d6e1870a..557df34996 100644
--- a/common/lib/xmodule/xmodule/js/src/video/09_play_pause_control.js
+++ b/common/lib/xmodule/xmodule/js/src/video/09_play_pause_control.js
@@ -56,12 +56,12 @@
/** Bind any necessary function callbacks to DOM events. */
bindHandlers: function() {
this.el.on({
- 'click': this.onClick
+ click: this.onClick
});
this.state.el.on({
- 'play': this.play,
+ play: this.play,
'pause ended': this.pause,
- 'destroy': this.destroy
+ destroy: this.destroy
});
},
diff --git a/common/lib/xmodule/xmodule/js/src/video/09_play_placeholder.js b/common/lib/xmodule/xmodule/js/src/video/09_play_placeholder.js
index 053068e95e..f2557da5b6 100644
--- a/common/lib/xmodule/xmodule/js/src/video/09_play_placeholder.js
+++ b/common/lib/xmodule/xmodule/js/src/video/09_play_placeholder.js
@@ -27,8 +27,8 @@
destroy: function() {
this.el.off('click', this.onClick);
this.state.el.on({
- 'destroy': this.destroy,
- 'play': this.hide,
+ destroy: this.destroy,
+ play: this.hide,
'ended pause': this.show
});
this.hide();
@@ -59,8 +59,8 @@
bindHandlers: function() {
this.el.on('click', this.onClick);
this.state.el.on({
- 'destroy': this.destroy,
- 'play': this.hide,
+ destroy: this.destroy,
+ play: this.hide,
'ended pause': this.show
});
},
@@ -72,13 +72,13 @@
hide: function() {
this.el
.addClass('is-hidden')
- .attr({'aria-hidden': 'true', 'tabindex': -1});
+ .attr({'aria-hidden': 'true', tabindex: -1});
},
show: function() {
this.el
.removeClass('is-hidden')
- .attr({'aria-hidden': 'false', 'tabindex': 0});
+ .attr({'aria-hidden': 'false', tabindex: 0});
}
};
diff --git a/common/lib/xmodule/xmodule/js/src/video/09_play_skip_control.js b/common/lib/xmodule/xmodule/js/src/video/09_play_skip_control.js
index 003167ef0b..9db0ecef75 100644
--- a/common/lib/xmodule/xmodule/js/src/video/09_play_skip_control.js
+++ b/common/lib/xmodule/xmodule/js/src/video/09_play_skip_control.js
@@ -57,8 +57,8 @@
bindHandlers: function() {
this.el.on('click', this.onClick);
this.state.el.on({
- 'play': this.play,
- 'destroy': this.destroy
+ play: this.play,
+ destroy: this.destroy
});
},
diff --git a/common/lib/xmodule/xmodule/js/src/video/09_save_state_plugin.js b/common/lib/xmodule/xmodule/js/src/video/09_save_state_plugin.js
index f817c7eb85..8210c60ec7 100644
--- a/common/lib/xmodule/xmodule/js/src/video/09_save_state_plugin.js
+++ b/common/lib/xmodule/xmodule/js/src/video/09_save_state_plugin.js
@@ -37,11 +37,11 @@
initialize: function() {
this.events = {
- 'speedchange': this.onSpeedChange,
- 'play': this.bindUnloadHandler,
+ speedchange: this.onSpeedChange,
+ play: this.bindUnloadHandler,
'pause destroy': this.saveStateHandler,
'language_menu:change': this.onLanguageChange,
- 'youtube_availability': this.onYoutubeAvailability
+ youtube_availability: this.onYoutubeAvailability
};
this.bindHandlers();
},
@@ -111,7 +111,7 @@
$.ajax({
url: this.state.config.saveStateUrl,
type: 'POST',
- async: async ? true : false,
+ async: !!async,
dataType: 'json',
data: data
});
diff --git a/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js b/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
index 40599c255a..91e53e0246 100644
--- a/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
+++ b/common/lib/xmodule/xmodule/js/src/video/09_video_caption.js
@@ -53,11 +53,11 @@
'caption:fetch': this.fetchCaption,
'caption:resize': this.onResize,
'caption:update': this.onCaptionUpdate,
- 'ended': this.pause,
- 'fullscreen': this.onResize,
- 'pause': this.pause,
- 'play': this.play,
- 'destroy': this.destroy
+ ended: this.pause,
+ fullscreen: this.onResize,
+ pause: this.pause,
+ play: this.play,
+ destroy: this.destroy
})
.removeClass('is-captions-rendered');
if (this.fetchXHR && this.fetchXHR.abort) {
@@ -181,11 +181,11 @@
'caption:fetch': this.fetchCaption,
'caption:resize': this.onResize,
'caption:update': this.onCaptionUpdate,
- 'ended': this.pause,
- 'fullscreen': this.onResize,
- 'pause': this.pause,
- 'play': this.play,
- 'destroy': this.destroy
+ ended: this.pause,
+ fullscreen: this.onResize,
+ pause: this.pause,
+ play: this.play,
+ destroy: this.destroy
});
if ((state.videoType === 'html5') && (state.config.autohideHtml5)) {
@@ -476,8 +476,8 @@
var captions = results.captions;
return {
- 'start': start,
- 'captions': captions
+ start: start,
+ captions: captions
};
},
@@ -737,10 +737,10 @@
buildCaptions: function(container, start, captions) {
var process = function(text, index) {
var $spanEl = $('
', {
- 'role': 'link',
+ role: 'link',
'data-index': index,
'data-start': start[index],
- 'tabindex': 0
+ tabindex: 0
});
HtmlUtils.setHtml($($spanEl), HtmlUtils.HTML(text.toString()));
@@ -863,15 +863,14 @@
*
*/
captionMouseOverOut: function(event) {
- var caption = $(event.target),
- captionIndex = parseInt(caption.attr('data-index'), 10);
+ var $caption = $(event.target),
+ captionIndex = parseInt($caption.attr('data-index'), 10);
if (captionIndex === this.currentCaptionIndex) {
if (event.type === 'mouseover') {
- caption.removeClass('focused');
- }
- else { // mouseout
- caption.addClass('focused');
+ $caption.removeClass('focused');
+ } else { // mouseout
+ $caption.addClass('focused');
}
}
},
@@ -883,11 +882,11 @@
*
*/
captionMouseDown: function(event) {
- var caption = $(event.target);
+ var $caption = $(event.target);
this.isMouseFocus = true;
this.autoScrolling = true;
- caption.removeClass('focused');
+ $caption.removeClass('focused');
this.currentCaptionIndex = -1;
},
@@ -908,9 +907,9 @@
*
*/
captionFocus: function(event) {
- var caption = $(event.target),
- container = caption.parent(),
- captionIndex = parseInt(caption.attr('data-index'), 10);
+ var $caption = $(event.target),
+ container = $caption.parent(),
+ captionIndex = parseInt($caption.attr('data-index'), 10);
// If the focus comes from a mouse click, hide the outline, turn on
// automatic scrolling and set currentCaptionIndex to point outside of
// caption list (ie -1) to disable mouseenter, mouseleave behavior.
@@ -942,9 +941,9 @@
*
*/
captionBlur: function(event) {
- var caption = $(event.target),
- container = caption.parent(),
- captionIndex = parseInt(caption.attr('data-index'), 10);
+ var $caption = $(event.target),
+ container = $caption.parent(),
+ captionIndex = parseInt($caption.attr('data-index'), 10);
container.removeClass('focused');
// If we are on first or last index, we have to turn automatic scroll
@@ -1084,8 +1083,8 @@
state.trigger(
'videoPlayer.onCaptionSeek',
{
- 'type': 'onCaptionSeek',
- 'time': time / 1000
+ type: 'onCaptionSeek',
+ time: time / 1000
}
);
@@ -1243,7 +1242,8 @@
*/
hideCaptions: function(hide_captions, update_cookie, trigger_event) {
var transcriptControlEl = this.transcriptControlEl,
- state = this.state, text;
+ state = this.state,
+ text;
if (typeof update_cookie === 'undefined') {
update_cookie = true;
diff --git a/common/lib/xmodule/xmodule/js/src/video/10_main.js b/common/lib/xmodule/xmodule/js/src/video/10_main.js
index 4870b60b4c..c351390bad 100644
--- a/common/lib/xmodule/xmodule/js/src/video/10_main.js
+++ b/common/lib/xmodule/xmodule/js/src/video/10_main.js
@@ -120,7 +120,8 @@
new VideoPoster(el, {
poster: el.data('poster'),
onClick: _.once(function() {
- var mainVideoPlayer = player(state), bumper, bumperState;
+ var mainVideoPlayer = player(state),
+ bumper, bumperState;
if (storage.getItem('isBumperShown')) {
mainVideoPlayer();
} else {
diff --git a/common/static/common/js/components/utils/view_utils.js b/common/static/common/js/components/utils/view_utils.js
index 73a1ebbc0e..fd48b835bf 100644
--- a/common/static/common/js/components/utils/view_utils.js
+++ b/common/static/common/js/components/utils/view_utils.js
@@ -5,7 +5,7 @@
'use strict';
define(['jquery', 'underscore', 'gettext', 'common/js/components/views/feedback_notification',
- 'common/js/components/views/feedback_prompt'],
+ 'common/js/components/views/feedback_prompt'],
function($, _, gettext, NotificationView, PromptView) {
var toggleExpandCollapse, showLoadingIndicator, hideLoadingIndicator, confirmThenRunOperation,
runOperationShowingMessage, withDisabledElement, disableElementWhileRunning,
@@ -189,7 +189,8 @@
* @returns {boolean} Returns true if attribute changes are found.
*/
hasChangedAttributes = function(model, attributes) {
- var i, changedAttributes = model.changedAttributes();
+ var i,
+ changedAttributes = model.changedAttributes();
if (!changedAttributes) {
return false;
}
@@ -221,8 +222,7 @@
if (/\s/g.test(item)) {
return gettext('Please do not use any spaces in this field.');
}
- }
- else {
+ } else {
if (item !== encodeURIComponent(item) || item.match(/[!'()*]/)) {
return gettext('Please do not use any spaces or special characters in this field.');
}
@@ -270,25 +270,25 @@
};
return {
- 'toggleExpandCollapse': toggleExpandCollapse,
- 'showLoadingIndicator': showLoadingIndicator,
- 'hideLoadingIndicator': hideLoadingIndicator,
- 'confirmThenRunOperation': confirmThenRunOperation,
- 'runOperationShowingMessage': runOperationShowingMessage,
- 'withDisabledElement': withDisabledElement,
- 'disableElementWhileRunning': disableElementWhileRunning,
- 'deleteNotificationHandler': deleteNotificationHandler,
- 'setScrollTop': setScrollTop,
- 'getScrollOffset': getScrollOffset,
- 'setScrollOffset': setScrollOffset,
- 'redirect': redirect,
- 'reload': reload,
- 'hasChangedAttributes': hasChangedAttributes,
- 'validateRequiredField': validateRequiredField,
- 'validateURLItemEncoding': validateURLItemEncoding,
- 'validateTotalKeyLength': validateTotalKeyLength,
- 'checkTotalKeyLengthViolations': checkTotalKeyLengthViolations,
- 'loadJavaScript': loadJavaScript
+ toggleExpandCollapse: toggleExpandCollapse,
+ showLoadingIndicator: showLoadingIndicator,
+ hideLoadingIndicator: hideLoadingIndicator,
+ confirmThenRunOperation: confirmThenRunOperation,
+ runOperationShowingMessage: runOperationShowingMessage,
+ withDisabledElement: withDisabledElement,
+ disableElementWhileRunning: disableElementWhileRunning,
+ deleteNotificationHandler: deleteNotificationHandler,
+ setScrollTop: setScrollTop,
+ getScrollOffset: getScrollOffset,
+ setScrollOffset: setScrollOffset,
+ redirect: redirect,
+ reload: reload,
+ hasChangedAttributes: hasChangedAttributes,
+ validateRequiredField: validateRequiredField,
+ validateURLItemEncoding: validateURLItemEncoding,
+ validateTotalKeyLength: validateTotalKeyLength,
+ checkTotalKeyLengthViolations: checkTotalKeyLengthViolations,
+ loadJavaScript: loadJavaScript
};
});
}).call(this, define || RequireJS.define, require || RequireJS.require);
diff --git a/common/static/common/js/components/views/tabbed_view.js b/common/static/common/js/components/views/tabbed_view.js
index 1b51164dd6..f9ade4688d 100644
--- a/common/static/common/js/components/views/tabbed_view.js
+++ b/common/static/common/js/components/views/tabbed_view.js
@@ -84,14 +84,14 @@
var self = this;
this.$el.html(this.template);
_.each(this.tabs, function(tabInfo, index) {
- var tabEl = $(_.template(tabTemplate)({
+ var $tabEl = $(_.template(tabTemplate)({
index: index,
title: tabInfo.title,
url: tabInfo.url,
tabPanelId: getTabPanelId(tabInfo.url)
})),
tabContainerEl = this.$('.tabs');
- self.$('.page-content-nav').append(tabEl);
+ self.$('.page-content-nav').append($tabEl);
// Render and append the current tab panel
tabContainerEl.append(tabInfo.view.render().$el);
@@ -119,7 +119,7 @@
.attr({
'aria-expanded': 'false',
'aria-selected': 'false',
- 'tabindex': '-1'
+ tabindex: '-1'
});
this.$('.tabpanel[aria-hidden="false"]')
@@ -138,7 +138,7 @@
.attr({
'aria-expanded': 'true',
'aria-selected': 'true',
- 'tabindex': '0'
+ tabindex: '0'
});
view.$el
@@ -187,22 +187,22 @@
keydownHandler: function(event) {
var key = event.which,
- focused = $(event.currentTarget),
- index = $(focused).parent().find('.tab').index(focused),
- total = $(focused).parent().find('.tab').size() - 1,
- $tab = $(focused).data('index');
+ $focused = $(event.currentTarget),
+ index = $($focused).parent().find('.tab').index($focused),
+ total = $($focused).parent().find('.tab').size() - 1,
+ $tab = $($focused).data('index');
switch (key) {
case Constants.keyCodes.left:
case Constants.keyCodes.up:
event.preventDefault();
- this.previousTab(focused, index);
+ this.previousTab($focused, index);
break;
case Constants.keyCodes.right:
case Constants.keyCodes.down:
event.preventDefault();
- this.nextTab(focused, index, total);
+ this.nextTab($focused, index, total);
break;
case Constants.keyCodes.enter:
@@ -229,7 +229,7 @@
tab = this.tabs[tabNameOrIndex];
$element = this.$('button[data-index=' + tabNameOrIndex + ']');
}
- return {'tab': tab, 'element': $element};
+ return {tab: tab, element: $element};
}
});
return TabbedView;
diff --git a/common/static/common/js/discussion/content.js b/common/static/common/js/discussion/content.js
index 028ceb1d14..3b35aa3adc 100644
--- a/common/static/common/js/discussion/content.js
+++ b/common/static/common/js/discussion/content.js
@@ -78,7 +78,7 @@
Content.prototype.addComment = function(comment, options) {
var comments_count, model, thread;
- options = (options) ? options : {};
+ options = (options) || {};
if (!options.silent) {
thread = this.get('thread');
comments_count = parseInt(thread.get('comments_count'));
@@ -221,7 +221,7 @@
};
return Content;
- })(Backbone.Model);
+ }(Backbone.Model));
this.Thread = (function(_super) {
__extends(Thread, _super);
@@ -230,46 +230,46 @@
}
Thread.prototype.urlMappers = {
- 'retrieve': function() {
+ retrieve: function() {
return DiscussionUtil.urlFor('retrieve_single_thread', this.get('commentable_id'), this.id);
},
- 'reply': function() {
+ reply: function() {
return DiscussionUtil.urlFor('create_comment', this.id);
},
- 'unvote': function() {
+ unvote: function() {
return DiscussionUtil.urlFor('undo_vote_for_' + (this.get('type')), this.id);
},
- 'upvote': function() {
+ upvote: function() {
return DiscussionUtil.urlFor('upvote_' + (this.get('type')), this.id);
},
- 'downvote': function() {
+ downvote: function() {
return DiscussionUtil.urlFor('downvote_' + (this.get('type')), this.id);
},
- 'close': function() {
+ close: function() {
return DiscussionUtil.urlFor('openclose_thread', this.id);
},
- 'update': function() {
+ update: function() {
return DiscussionUtil.urlFor('update_thread', this.id);
},
- '_delete': function() {
+ _delete: function() {
return DiscussionUtil.urlFor('delete_thread', this.id);
},
- 'follow': function() {
+ follow: function() {
return DiscussionUtil.urlFor('follow_thread', this.id);
},
- 'unfollow': function() {
+ unfollow: function() {
return DiscussionUtil.urlFor('unfollow_thread', this.id);
},
- 'flagAbuse': function() {
+ flagAbuse: function() {
return DiscussionUtil.urlFor('flagAbuse_' + (this.get('type')), this.id);
},
- 'unFlagAbuse': function() {
+ unFlagAbuse: function() {
return DiscussionUtil.urlFor('unFlagAbuse_' + (this.get('type')), this.id);
},
- 'pinThread': function() {
+ pinThread: function() {
return DiscussionUtil.urlFor('pin_thread', this.id);
},
- 'unPinThread': function() {
+ unPinThread: function() {
return DiscussionUtil.urlFor('un_pin_thread', this.id);
}
};
@@ -333,7 +333,7 @@
};
return Thread;
- })(this.Content);
+ }(this.Content));
this.Comment = (function(_super) {
__extends(Comment, _super);
@@ -346,31 +346,31 @@
}
Comment.prototype.urlMappers = {
- 'reply': function() {
+ reply: function() {
return DiscussionUtil.urlFor('create_sub_comment', this.id);
},
- 'unvote': function() {
+ unvote: function() {
return DiscussionUtil.urlFor('undo_vote_for_' + (this.get('type')), this.id);
},
- 'upvote': function() {
+ upvote: function() {
return DiscussionUtil.urlFor('upvote_' + (this.get('type')), this.id);
},
- 'downvote': function() {
+ downvote: function() {
return DiscussionUtil.urlFor('downvote_' + (this.get('type')), this.id);
},
- 'endorse': function() {
+ endorse: function() {
return DiscussionUtil.urlFor('endorse_comment', this.id);
},
- 'update': function() {
+ update: function() {
return DiscussionUtil.urlFor('update_comment', this.id);
},
- '_delete': function() {
+ _delete: function() {
return DiscussionUtil.urlFor('delete_comment', this.id);
},
- 'flagAbuse': function() {
+ flagAbuse: function() {
return DiscussionUtil.urlFor('flagAbuse_' + (this.get('type')), this.id);
},
- 'unFlagAbuse': function() {
+ unFlagAbuse: function() {
return DiscussionUtil.urlFor('unFlagAbuse_' + (this.get('type')), this.id);
}
};
@@ -397,7 +397,7 @@
};
return Comment;
- })(this.Content);
+ }(this.Content));
this.Comments = (function(_super) {
__extends(Comments, _super);
@@ -422,6 +422,6 @@
};
return Comments;
- })(Backbone.Collection);
+ }(Backbone.Collection));
}
}).call(window);
diff --git a/common/static/common/js/discussion/discussion.js b/common/static/common/js/discussion/discussion.js
index bdd9f25956..5e245d1464 100644
--- a/common/static/common/js/discussion/discussion.js
+++ b/common/static/common/js/discussion/discussion.js
@@ -136,7 +136,7 @@
_results.push(new Thread(data));
}
return _results;
- })()
+ }())
][0];
new_collection = _.union(models, new_threads);
Content.loadContentInfos(response.annotated_content_info);
@@ -220,6 +220,6 @@
};
return Discussion;
- })(Backbone.Collection);
+ }(Backbone.Collection));
}
}).call(window);
diff --git a/common/static/common/js/discussion/models/discussion_course_settings.js b/common/static/common/js/discussion/models/discussion_course_settings.js
index fea243d2e1..a0a6fe4228 100644
--- a/common/static/common/js/discussion/models/discussion_course_settings.js
+++ b/common/static/common/js/discussion/models/discussion_course_settings.js
@@ -26,6 +26,6 @@
}
return DiscussionCourseSettings;
- })(Backbone.Model);
+ }(Backbone.Model));
}
}).call(this);
diff --git a/common/static/common/js/discussion/models/discussion_user.js b/common/static/common/js/discussion/models/discussion_user.js
index 85dea60ed7..8a4f31cf2b 100644
--- a/common/static/common/js/discussion/models/discussion_user.js
+++ b/common/static/common/js/discussion/models/discussion_user.js
@@ -44,6 +44,6 @@
};
return DiscussionUser;
- })(Backbone.Model);
+ }(Backbone.Model));
}
}).call(this);
diff --git a/common/static/common/js/discussion/utils.js b/common/static/common/js/discussion/utils.js
index b7af3dc425..d29248d64c 100644
--- a/common/static/common/js/discussion/utils.js
+++ b/common/static/common/js/discussion/utils.js
@@ -111,9 +111,9 @@
user_profile: '/courses/' + $$course_id + '/discussion/forum/users/' + param,
followed_threads: '/courses/' + $$course_id + '/discussion/forum/users/' + param + '/followed',
threads: '/courses/' + $$course_id + '/discussion/forum',
- 'enable_notifications': '/notification_prefs/enable/',
- 'disable_notifications': '/notification_prefs/disable/',
- 'notifications_status': '/notification_prefs/status/'
+ enable_notifications: '/notification_prefs/enable/',
+ disable_notifications: '/notification_prefs/disable/',
+ notifications_status: '/notification_prefs/status/'
}[name];
};
diff --git a/common/static/common/js/discussion/views/discussion_content_view.js b/common/static/common/js/discussion/views/discussion_content_view.js
index 8b318fbe75..9baeeb1be8 100644
--- a/common/static/common/js/discussion/views/discussion_content_view.js
+++ b/common/static/common/js/discussion/views/discussion_content_view.js
@@ -179,7 +179,7 @@
};
return DiscussionContentView;
- })(Backbone.View);
+ }(Backbone.View));
this.DiscussionContentShowView = (function(_super) {
__extends(DiscussionContentShowView, _super);
diff --git a/common/static/common/js/discussion/views/discussion_thread_edit_view.js b/common/static/common/js/discussion/views/discussion_thread_edit_view.js
index 950b24db68..b512ded2f7 100644
--- a/common/static/common/js/discussion/views/discussion_thread_edit_view.js
+++ b/common/static/common/js/discussion/views/discussion_thread_edit_view.js
@@ -5,12 +5,12 @@
this.DiscussionThreadEditView = Backbone.View.extend({
tagName: 'form',
events: {
- 'submit': 'updateHandler',
+ submit: 'updateHandler',
'click .post-cancel': 'cancelHandler'
},
attributes: {
- 'class': 'discussion-post edit-post-form'
+ class: 'discussion-post edit-post-form'
},
initialize: function(options) {
diff --git a/common/static/common/js/discussion/views/discussion_thread_profile_view.js b/common/static/common/js/discussion/views/discussion_thread_profile_view.js
index 5d6b65c928..f7bfa2953a 100644
--- a/common/static/common/js/discussion/views/discussion_thread_profile_view.js
+++ b/common/static/common/js/discussion/views/discussion_thread_profile_view.js
@@ -62,6 +62,6 @@
};
return DiscussionThreadProfileView;
- })(Backbone.View);
+ }(Backbone.View));
}
}).call(window);
diff --git a/common/static/common/js/discussion/views/discussion_thread_show_view.js b/common/static/common/js/discussion/views/discussion_thread_show_view.js
index 787a5dba2b..f9b70fe672 100644
--- a/common/static/common/js/discussion/views/discussion_thread_show_view.js
+++ b/common/static/common/js/discussion/views/discussion_thread_show_view.js
@@ -77,6 +77,6 @@
};
return DiscussionThreadShowView;
- })(DiscussionContentShowView);
+ }(DiscussionContentShowView));
}
}).call(window);
diff --git a/common/static/common/js/discussion/views/discussion_thread_view.js b/common/static/common/js/discussion/views/discussion_thread_view.js
index 77fd92258c..21325a09f9 100644
--- a/common/static/common/js/discussion/views/discussion_thread_view.js
+++ b/common/static/common/js/discussion/views/discussion_thread_view.js
@@ -121,17 +121,17 @@
};
DiscussionThreadView.prototype.renderTemplate = function() {
- var container,
+ var $container,
templateData;
this.template = _.template($('#thread-template').html());
- container = $('#discussion-container');
- if (!container.length) {
- container = $('.discussion-module');
+ $container = $('#discussion-container');
+ if (!$container.length) {
+ $container = $('.discussion-module');
}
templateData = _.extend(this.model.toJSON(), {
readOnly: this.readOnly,
startHeader: this.startHeader + 1, // this is a child so headers should be increased
- can_create_comment: container.data('user-create-comment')
+ can_create_comment: $container.data('user-create-comment')
});
return this.template(templateData);
};
@@ -187,7 +187,7 @@
),
data: {
resp_skip: this.responses.size(),
- resp_limit: responseLimit ? responseLimit : void 0
+ resp_limit: responseLimit || void 0
},
$elem: $elem,
$loading: $elem,
@@ -241,7 +241,8 @@
DiscussionThreadView.prototype.renderResponseCountAndPagination = function(responseTotal) {
var buttonText, $loadMoreButton, responseCountFormat, responseLimit, responsePagination,
- responsesRemaining, showingResponsesText, self = this;
+ responsesRemaining, showingResponsesText,
+ self = this;
if (this.isQuestion() && this.markedAnswers.length !== 0) {
responseCountFormat = ngettext(
'{numResponses} other response', '{numResponses} other responses', responseTotal
@@ -264,8 +265,7 @@
responsesRemaining = responseTotal - this.responses.size();
if (responsesRemaining === 0) {
showingResponsesText = gettext('Showing all responses');
- }
- else {
+ } else {
showingResponsesText = edx.StringUtils.interpolate(
ngettext(
'Showing first response', 'Showing first {numResponses} responses',
@@ -465,6 +465,6 @@
};
return DiscussionThreadView;
- })(DiscussionContentView);
+ }(DiscussionContentView));
}
}).call(window);
diff --git a/common/static/common/js/discussion/views/new_post_view.js b/common/static/common/js/discussion/views/new_post_view.js
index 9667eff8aa..2ba9c63db1 100644
--- a/common/static/common/js/discussion/views/new_post_view.js
+++ b/common/static/common/js/discussion/views/new_post_view.js
@@ -258,6 +258,6 @@
};
return NewPostView;
- })(Backbone.View);
+ }(Backbone.View));
}
}).call(window);
diff --git a/common/static/common/js/discussion/views/response_comment_edit_view.js b/common/static/common/js/discussion/views/response_comment_edit_view.js
index 7bd873122a..34cfa4153a 100644
--- a/common/static/common/js/discussion/views/response_comment_edit_view.js
+++ b/common/static/common/js/discussion/views/response_comment_edit_view.js
@@ -59,6 +59,6 @@
};
return ResponseCommentEditView;
- })(Backbone.View);
+ }(Backbone.View));
}
}).call(window);
diff --git a/common/static/common/js/discussion/views/response_comment_show_view.js b/common/static/common/js/discussion/views/response_comment_show_view.js
index bba177d851..da66d28315 100644
--- a/common/static/common/js/discussion/views/response_comment_show_view.js
+++ b/common/static/common/js/discussion/views/response_comment_show_view.js
@@ -83,6 +83,6 @@
};
return ResponseCommentShowView;
- })(DiscussionContentShowView);
+ }(DiscussionContentShowView));
}
}).call(window);
diff --git a/common/static/common/js/discussion/views/response_comment_view.js b/common/static/common/js/discussion/views/response_comment_view.js
index 09149a1860..c45c4166f2 100644
--- a/common/static/common/js/discussion/views/response_comment_view.js
+++ b/common/static/common/js/discussion/views/response_comment_view.js
@@ -156,6 +156,6 @@
};
return ResponseCommentView;
- })(DiscussionContentView);
+ }(DiscussionContentView));
}
}).call(window);
diff --git a/common/static/common/js/discussion/views/thread_response_edit_view.js b/common/static/common/js/discussion/views/thread_response_edit_view.js
index 13d2308be1..13da03e001 100644
--- a/common/static/common/js/discussion/views/thread_response_edit_view.js
+++ b/common/static/common/js/discussion/views/thread_response_edit_view.js
@@ -59,6 +59,6 @@
};
return ThreadResponseEditView;
- })(Backbone.View);
+ }(Backbone.View));
}
}).call(window);
diff --git a/common/static/common/js/discussion/views/thread_response_show_view.js b/common/static/common/js/discussion/views/thread_response_show_view.js
index 896b05b837..4ff566e53d 100644
--- a/common/static/common/js/discussion/views/thread_response_show_view.js
+++ b/common/static/common/js/discussion/views/thread_response_show_view.js
@@ -64,6 +64,6 @@
};
return ThreadResponseShowView;
- })(DiscussionContentShowView);
+ }(DiscussionContentShowView));
}
}).call(window);
diff --git a/common/static/common/js/discussion/views/thread_response_view.js b/common/static/common/js/discussion/views/thread_response_view.js
index 077c6cdefd..080f233108 100644
--- a/common/static/common/js/discussion/views/thread_response_view.js
+++ b/common/static/common/js/discussion/views/thread_response_view.js
@@ -66,15 +66,15 @@
};
ThreadResponseView.prototype.renderTemplate = function() {
- var container, templateData, _ref;
+ var $container, templateData, _ref;
this.template = _.template($('#thread-response-template').html());
- container = $('#discussion-container');
- if (!container.length) {
- container = $('.discussion-module');
+ $container = $('#discussion-container');
+ if (!$container.length) {
+ $container = $('.discussion-module');
}
templateData = _.extend(this.model.toJSON(), {
wmdId: typeof(this.model.id) !== 'undefined' ? this.model.id : (new Date()).getTime(),
- create_sub_comment: container.data('user-create-subcomment'),
+ create_sub_comment: $container.data('user-create-subcomment'),
readOnly: this.readOnly
});
return this.template(templateData);
@@ -347,6 +347,6 @@
};
return ThreadResponseView;
- })(DiscussionContentView);
+ }(DiscussionContentView));
}
}).call(window);
diff --git a/common/static/common/js/spec/components/feedback_spec.js b/common/static/common/js/spec/components/feedback_spec.js
index e3c0139dbb..50a2a590f8 100644
--- a/common/static/common/js/spec/components/feedback_spec.js
+++ b/common/static/common/js/spec/components/feedback_spec.js
@@ -2,8 +2,8 @@
(function() {
'use strict';
define(['jquery', 'common/js/components/views/feedback', 'common/js/components/views/feedback_notification',
- 'common/js/components/views/feedback_alert', 'common/js/components/views/feedback_prompt',
- 'common/js/spec_helpers/view_helpers', 'sinon', 'jquery.simulate'],
+ 'common/js/components/views/feedback_alert', 'common/js/components/views/feedback_prompt',
+ 'common/js/spec_helpers/view_helpers', 'sinon', 'jquery.simulate'],
function($, SystemFeedback, NotificationView, AlertView, PromptView, ViewHelpers, sinon) {
var tpl;
tpl = readFixtures('common/templates/components/system-feedback.underscore');
@@ -123,11 +123,11 @@
actions: {
primary: {
text: "Yes, I'm sure.",
- 'class': 'confirm-button'
+ class: 'confirm-button'
},
secondary: {
text: 'Cancel',
- 'class': 'cancel-button'
+ class: 'cancel-button'
}
}
};
@@ -207,12 +207,12 @@
actions: {
primary: {
text: 'Save',
- 'class': 'save-button',
+ class: 'save-button',
click: this.primaryClickSpy
},
secondary: {
text: 'Revert',
- 'class': 'cancel-button',
+ class: 'cancel-button',
click: this.secondaryClickSpy
}
}
@@ -280,11 +280,11 @@
secondary: [
{
text: 'Option One',
- 'class': 'option-one',
+ class: 'option-one',
click: this.secondarySpyOne
}, {
text: 'Option Two',
- 'class': 'option-two',
+ class: 'option-two',
click: this.secondarySpyTwo
}
]
diff --git a/common/static/common/js/spec/components/tabbed_view_spec.js b/common/static/common/js/spec/components/tabbed_view_spec.js
index da53f30daf..ec1c74ddc0 100644
--- a/common/static/common/js/spec/components/tabbed_view_spec.js
+++ b/common/static/common/js/spec/components/tabbed_view_spec.js
@@ -2,11 +2,11 @@
'use strict';
define(['jquery',
- 'underscore',
- 'backbone',
- 'common/js/components/views/tabbed_view',
- 'jquery.simulate'
- ],
+ 'underscore',
+ 'backbone',
+ 'common/js/components/views/tabbed_view',
+ 'jquery.simulate'
+ ],
function($, _, Backbone, TabbedView) {
var keys = $.simulate.keyCode;
@@ -68,23 +68,23 @@
expect(view.$('.nav-item[data-index=0]')).toHaveAttr({
'aria-expanded': 'true',
'aria-selected': 'true',
- 'tabindex': '0'
+ tabindex: '0'
});
expect(view.$('.nav-item[data-index=1]')).toHaveAttr({
'aria-expanded': 'false',
'aria-selected': 'false',
- 'tabindex': '-1'
+ tabindex: '-1'
});
view.$('.nav-item[data-index=1]').click();
expect(view.$('.nav-item[data-index=0]')).toHaveAttr({
'aria-expanded': 'false',
'aria-selected': 'false',
- 'tabindex': '-1'
+ tabindex: '-1'
});
expect(view.$('.nav-item[data-index=1]')).toHaveAttr({
'aria-expanded': 'true',
'aria-selected': 'true',
- 'tabindex': '0'
+ tabindex: '0'
});
});
@@ -97,12 +97,12 @@
expect(view.$('.nav-item[data-index=0]')).toHaveAttr({
'aria-expanded': 'false',
'aria-selected': 'false',
- 'tabindex': '-1'
+ tabindex: '-1'
});
expect(view.$('.nav-item[data-index=1]')).toHaveAttr({
'aria-expanded': 'true',
'aria-selected': 'true',
- 'tabindex': '0'
+ tabindex: '0'
});
});
@@ -115,12 +115,12 @@
expect(view.$('.nav-item[data-index=0]')).toHaveAttr({
'aria-expanded': 'false',
'aria-selected': 'false',
- 'tabindex': '-1'
+ tabindex: '-1'
});
expect(view.$('.nav-item[data-index=1]')).toHaveAttr({
'aria-expanded': 'true',
'aria-selected': 'true',
- 'tabindex': '0'
+ tabindex: '0'
});
});
@@ -133,12 +133,12 @@
expect(view.$('.nav-item[data-index=1]')).toHaveAttr({
'aria-expanded': 'false',
'aria-selected': 'false',
- 'tabindex': '-1'
+ tabindex: '-1'
});
expect(view.$('.nav-item[data-index=0]')).toHaveAttr({
'aria-expanded': 'true',
'aria-selected': 'true',
- 'tabindex': '0'
+ tabindex: '0'
});
});
@@ -151,12 +151,12 @@
expect(view.$('.nav-item[data-index=1]')).toHaveAttr({
'aria-expanded': 'false',
'aria-selected': 'false',
- 'tabindex': '-1'
+ tabindex: '-1'
});
expect(view.$('.nav-item[data-index=0]')).toHaveAttr({
'aria-expanded': 'true',
'aria-selected': 'true',
- 'tabindex': '0'
+ tabindex: '0'
});
});
});
diff --git a/common/static/common/js/spec/components/view_utils_spec.js b/common/static/common/js/spec/components/view_utils_spec.js
index c738a8c3fa..7027ef61b4 100644
--- a/common/static/common/js/spec/components/view_utils_spec.js
+++ b/common/static/common/js/spec/components/view_utils_spec.js
@@ -1,25 +1,25 @@
(function(define) {
'use strict';
define(['jquery', 'underscore', 'backbone', 'common/js/components/utils/view_utils',
- 'common/js/spec_helpers/view_helpers'],
+ 'common/js/spec_helpers/view_helpers'],
function($, _, Backbone, ViewUtils, ViewHelpers) {
describe('ViewUtils', function() {
describe('disabled element while running', function() {
it("adds 'is-disabled' class to element while action is running and removes it after", function() {
- var link,
+ var $link,
deferred = new $.Deferred(),
promise = deferred.promise();
setFixtures("ripe apples drop about my head");
- link = $('#link');
- expect(link).not.toHaveClass('is-disabled');
- ViewUtils.disableElementWhileRunning(link, function() { return promise; });
- expect(link).toHaveClass('is-disabled');
+ $link = $('#link');
+ expect($link).not.toHaveClass('is-disabled');
+ ViewUtils.disableElementWhileRunning($link, function() { return promise; });
+ expect($link).toHaveClass('is-disabled');
deferred.resolve();
- expect(link).not.toHaveClass('is-disabled');
+ expect($link).not.toHaveClass('is-disabled');
});
it('disables elements within withDisabledElement', function() {
- var link,
+ var $link,
eventCallback,
event,
deferred = new $.Deferred(),
@@ -31,14 +31,14 @@
}),
testView = new MockView();
setFixtures("ripe apples drop about my head");
- link = $('#link');
- expect(link).not.toHaveClass('is-disabled');
+ $link = $('#link');
+ expect($link).not.toHaveClass('is-disabled');
eventCallback = ViewUtils.withDisabledElement('testFunction');
- event = {currentTarget: link};
+ event = {currentTarget: $link};
eventCallback.apply(testView, [event]);
- expect(link).toHaveClass('is-disabled');
+ expect($link).toHaveClass('is-disabled');
deferred.resolve();
- expect(link).not.toHaveClass('is-disabled');
+ expect($link).not.toHaveClass('is-disabled');
});
});
diff --git a/common/static/common/js/spec/discussion/content_spec.js b/common/static/common/js/spec/discussion/content_spec.js
index 7e7b3e7936..427126637d 100644
--- a/common/static/common/js/spec/discussion/content_spec.js
+++ b/common/static/common/js/spec/discussion/content_spec.js
@@ -8,8 +8,8 @@
describe('Staff and TA Content', function() {
beforeEach(function() {
return DiscussionUtil.loadRoles({
- 'Moderator': [567],
- 'Administrator': [567],
+ Moderator: [567],
+ Administrator: [567],
'Community TA': [567]
});
});
@@ -54,13 +54,13 @@
it('can update info', function() {
this.content.updateInfo({
ability: {
- 'can_edit': true
+ can_edit: true
},
voted: true,
subscribed: true
});
expect(this.content.get('ability')).toEqual({
- 'can_edit': true
+ can_edit: true
});
expect(this.content.get('voted')).toEqual(true);
return expect(this.content.get('subscribed')).toEqual(true);
@@ -104,8 +104,8 @@
});
return it('can be endorsed', function() {
DiscussionUtil.loadRoles({
- 'Moderator': [111],
- 'Administrator': [222],
+ Moderator: [111],
+ Administrator: [222],
'Community TA': [333]
});
this.discussionThread = new Thread({
diff --git a/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js
index ef1f711067..00a02bde6f 100644
--- a/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js
+++ b/common/static/common/js/spec/discussion/view/discussion_thread_edit_view_spec.js
@@ -12,8 +12,8 @@
DiscussionSpecHelper.setUnderscoreFixtures();
spyOn(DiscussionUtil, 'makeWmdEditor');
this.threadData = DiscussionViewSpecHelper.makeThreadWithProps({
- 'commentable_id': 'test_topic',
- 'title': 'test thread title'
+ commentable_id: 'test_topic',
+ title: 'test thread title'
});
this.thread = new Thread(this.threadData);
this.course_settings = DiscussionSpecHelper.createTestCourseSettings();
@@ -74,7 +74,7 @@
});
it('can save new data correctly in inline mode', function() {
- this.createEditView({'mode': 'inline'});
+ this.createEditView({mode: 'inline'});
testUpdate(this.view, this.thread, 'other_topic', 'Other Topic', 'inline');
});
@@ -89,7 +89,7 @@
});
it('can close the view in inline mode', function() {
- this.createEditView({'mode': 'inline'});
+ this.createEditView({mode: 'inline'});
testCancel(this.view);
});
diff --git a/common/static/common/js/spec/discussion/view/discussion_thread_profile_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_thread_profile_view_spec.js
index 6fd71e343a..47e5cf6dc6 100644
--- a/common/static/common/js/spec/discussion/view/discussion_thread_profile_view_spec.js
+++ b/common/static/common/js/spec/discussion/view/discussion_thread_profile_view_spec.js
@@ -53,8 +53,8 @@
// I really have no idea what it is supposed to mean - probably just iteration, but better be safe
for (
i = _i = 0, _ref = numberOfImages - 1;
- 0 <= _ref ? _i <= _ref : _i >= _ref;
- i = 0 <= _ref ? ++_i : --_i
+ _ref >= 0 ? _i <= _ref : _i >= _ref;
+ i = _ref >= 0 ? ++_i : --_i
) {
threadData.body = threadData.body + imageTag;
if (i === 0) {
diff --git a/common/static/common/js/spec/discussion/view/discussion_thread_view_spec.js b/common/static/common/js/spec/discussion/view/discussion_thread_view_spec.js
index 5735c76aa0..d1212ccd61 100644
--- a/common/static/common/js/spec/discussion/view/discussion_thread_view_spec.js
+++ b/common/static/common/js/spec/discussion/view/discussion_thread_view_spec.js
@@ -46,11 +46,11 @@
children: count > 0 ? (function() {
var _i, _results;
_results = [];
- for (index = _i = 1; 1 <= count ? _i <= count : _i >= count; index = 1 <= count ? ++_i : --_i) {
+ for (index = _i = 1; count >= 1 ? _i <= count : _i >= count; index = count >= 1 ? ++_i : --_i) {
_results.push(createTestResponseJson(index));
}
return _results;
- })() : []
+ }()) : []
}, options));
};
createTestResponseJson = function(index) {
@@ -305,14 +305,14 @@
);
};
_.each({
- 'no': 0,
- 'one': 1,
- 'many': 5
+ no: 0,
+ one: 1,
+ many: 5
}, function(numEndorsed, endorsedDesc) {
return _.each({
- 'no': 0,
- 'one': 1,
- 'many': 5
+ no: 0,
+ one: 1,
+ many: 5
}, function(numNonEndorsed, nonEndorsedDesc) {
it(
'renders correctly with ' + endorsedDesc + ' marked answer(s) and ' + nonEndorsedDesc +
diff --git a/common/static/common/js/spec/discussion/view/discussion_view_spec_helper.js b/common/static/common/js/spec/discussion/view/discussion_view_spec_helper.js
index a9ae129e66..1e679990b0 100644
--- a/common/static/common/js/spec/discussion/view/discussion_view_spec_helper.js
+++ b/common/static/common/js/spec/discussion/view/discussion_view_spec_helper.js
@@ -132,7 +132,7 @@
DiscussionViewSpecHelper.setNextResponseContent = function(content) {
return $.ajax.and.callFake(function(params) {
params.success({
- 'content': content
+ content: content
});
return {
always: function() {
@@ -142,5 +142,5 @@
};
return DiscussionViewSpecHelper;
- })();
+ }());
}).call(this);
diff --git a/common/static/common/js/spec/discussion/view/response_comment_show_view_spec.js b/common/static/common/js/spec/discussion/view/response_comment_show_view_spec.js
index 2fadaa05d6..a538e9f742 100644
--- a/common/static/common/js/spec/discussion/view/response_comment_show_view_spec.js
+++ b/common/static/common/js/spec/discussion/view/response_comment_show_view_spec.js
@@ -49,7 +49,7 @@
DiscussionUtil.loadRoles([]);
this.comment.updateInfo({
ability: {
- 'can_delete': true
+ can_delete: true
}
});
this.view.render();
@@ -68,7 +68,7 @@
DiscussionUtil.loadRoles([]);
this.comment.updateInfo({
ability: {
- 'can_edit': true
+ can_edit: true
}
});
this.view.render();
diff --git a/common/static/common/js/spec/discussion/view/response_comment_view_spec.js b/common/static/common/js/spec/discussion/view/response_comment_view_spec.js
index 35ba510892..28c88ba5e1 100644
--- a/common/static/common/js/spec/discussion/view/response_comment_view_spec.js
+++ b/common/static/common/js/spec/discussion/view/response_comment_view_spec.js
@@ -82,7 +82,7 @@
it('does not delete a comment if the permission is false', function() {
this.comment.updateInfo({
ability: {
- 'can_delete': false
+ can_delete: false
}
});
spyOn(window, 'confirm');
diff --git a/common/static/common/js/spec/discussion/view/thread_response_show_view_spec.js b/common/static/common/js/spec/discussion/view/thread_response_show_view_spec.js
index a177a9ec9f..b3a8440f35 100644
--- a/common/static/common/js/spec/discussion/view/thread_response_show_view_spec.js
+++ b/common/static/common/js/spec/discussion/view/thread_response_show_view_spec.js
@@ -7,7 +7,7 @@
DiscussionSpecHelper.setUnderscoreFixtures();
this.user = DiscussionUtil.getUser();
this.thread = new Thread({
- 'thread_type': 'discussion'
+ thread_type: 'discussion'
});
this.commentData = {
id: 'dummy',
@@ -59,14 +59,14 @@
it('renders endorsement correctly for a marked answer in a question thread', function() {
var endorsement;
endorsement = {
- 'username': 'test_endorser',
- 'user_id': 'test_id',
- 'time': new Date().toISOString()
+ username: 'test_endorser',
+ user_id: 'test_id',
+ time: new Date().toISOString()
};
this.thread.set('thread_type', 'question');
this.comment.set({
- 'endorsed': true,
- 'endorsement': endorsement
+ endorsed: true,
+ endorsement: endorsement
});
this.view.render();
expect(this.view.$('.posted-details').text().replace(/\s+/g, ' '))
@@ -77,13 +77,13 @@
it('renders anonymous endorsement correctly for a marked answer in a question thread', function() {
var endorsement;
endorsement = {
- 'username': null,
- 'time': new Date().toISOString()
+ username: null,
+ time: new Date().toISOString()
};
this.thread.set('thread_type', 'question');
this.comment.set({
- 'endorsed': true,
- 'endorsement': endorsement
+ endorsed: true,
+ endorsement: endorsement
});
this.view.render();
expect(this.view.$('.posted-details').text()).toMatch('marked as answer less than a minute ago');
@@ -92,14 +92,14 @@
it('renders endorsement correctly for an endorsed response in a discussion thread', function() {
var endorsement;
endorsement = {
- 'username': 'test_endorser',
- 'user_id': 'test_id',
- 'time': new Date().toISOString()
+ username: 'test_endorser',
+ user_id: 'test_id',
+ time: new Date().toISOString()
};
this.thread.set('thread_type', 'discussion');
this.comment.set({
- 'endorsed': true,
- 'endorsement': endorsement
+ endorsed: true,
+ endorsement: endorsement
});
this.view.render();
expect(this.view.$('.posted-details').text().replace(/\s+/g, ' '))
@@ -110,13 +110,13 @@
it('renders anonymous endorsement correctly for an endorsed response in a discussion thread', function() {
var endorsement;
endorsement = {
- 'username': null,
- 'time': new Date().toISOString()
+ username: null,
+ time: new Date().toISOString()
};
this.thread.set('thread_type', 'discussion');
this.comment.set({
- 'endorsed': true,
- 'endorsement': endorsement
+ endorsed: true,
+ endorsement: endorsement
});
this.view.render();
expect(this.view.$('.posted-details').text()).toMatch('endorsed less than a minute ago');
@@ -125,7 +125,7 @@
it('re-renders correctly when endorsement changes', function() {
spyOn($, 'ajax').and.returnValue($.Deferred());
DiscussionUtil.loadRoles({
- 'Moderator': [parseInt(window.user.id)]
+ Moderator: [parseInt(window.user.id)]
});
this.thread.set('thread_type', 'question');
this.view.render();
@@ -143,11 +143,11 @@
var endorseButton;
spyOn($, 'ajax').and.returnValue($.Deferred());
DiscussionUtil.loadRoles({
- 'Moderator': [parseInt(window.user.id)]
+ Moderator: [parseInt(window.user.id)]
});
this.thread.set({
- 'thread_type': 'question',
- 'user_id': (parseInt(window.user.id) + 1).toString()
+ thread_type: 'question',
+ user_id: (parseInt(window.user.id) + 1).toString()
});
this.view.render();
endorseButton = this.view.$('.action-answer');
@@ -160,8 +160,8 @@
var endorseButton;
spyOn($, 'ajax').and.returnValue($.Deferred());
this.thread.set({
- 'thread_type': 'question',
- 'user_id': window.user.id
+ thread_type: 'question',
+ user_id: window.user.id
});
this.view.render();
endorseButton = this.view.$('.action-answer');
@@ -173,8 +173,8 @@
it('does not allow the author of a discussion thread to endorse', function() {
var endorseButton;
this.thread.set({
- 'thread_type': 'discussion',
- 'user_id': window.user.id
+ thread_type: 'discussion',
+ user_id: window.user.id
});
this.view.render();
endorseButton = this.view.$('.action-endorse');
@@ -184,8 +184,8 @@
it('does not allow a student who is not the author of a question thread to mark an answer', function() {
var endorseButton;
this.thread.set({
- 'thread_type': 'question',
- 'user_id': (parseInt(window.user.id) + 1).toString()
+ thread_type: 'question',
+ user_id: (parseInt(window.user.id) + 1).toString()
});
this.view.render();
endorseButton = this.view.$('.action-answer');
@@ -228,8 +228,8 @@
var checkUserLink;
beforeEach(function() {
this.comment.set('endorsement', {
- 'username': 'test_endorser',
- 'time': new Date().toISOString()
+ username: 'test_endorser',
+ time: new Date().toISOString()
});
return spyOn(DiscussionUtil, 'urlFor').and.returnValue('test_endorser_url');
});
diff --git a/common/static/common/js/spec/discussion/view/thread_response_view_spec.js b/common/static/common/js/spec/discussion/view/thread_response_view_spec.js
index f6c0601cda..35e93a8401 100644
--- a/common/static/common/js/spec/discussion/view/thread_response_view_spec.js
+++ b/common/static/common/js/spec/discussion/view/thread_response_view_spec.js
@@ -6,7 +6,7 @@
DiscussionSpecHelper.setUpGlobals();
DiscussionSpecHelper.setUnderscoreFixtures();
this.thread = new Thread({
- 'thread_type': 'discussion'
+ thread_type: 'discussion'
});
this.response = new Comment({
children: [{}, {}],
@@ -24,8 +24,8 @@
checkCommentForm = function(closed) {
var comment, commentData, thread, view;
thread = new Thread({
- 'thread_type': 'discussion',
- 'closed': closed
+ thread_type: 'discussion',
+ closed: closed
});
commentData = {
id: 'dummy',
diff --git a/common/static/common/js/spec_helpers/jasmine-stealth.js b/common/static/common/js/spec_helpers/jasmine-stealth.js
index 33a5d7dc12..506876f62d 100644
--- a/common/static/common/js/spec_helpers/jasmine-stealth.js
+++ b/common/static/common/js/spec_helpers/jasmine-stealth.js
@@ -6,7 +6,8 @@
}((function() {
return this;
}()), function(window, jasmine, _) {
- var fake, clearSpies, spyOnConstructor, unfakes = [];
+ var fake, clearSpies, spyOnConstructor,
+ unfakes = [];
clearSpies = function() {
_.each(unfakes, function(u) {
@@ -33,7 +34,7 @@
}
return _Class;
- })();
+ }());
if (!methodsToSpy) {
methodsToSpy = [];
diff --git a/common/static/common/js/spec_helpers/page_helpers.js b/common/static/common/js/spec_helpers/page_helpers.js
index deeb711819..09c67ca04b 100644
--- a/common/static/common/js/spec_helpers/page_helpers.js
+++ b/common/static/common/js/spec_helpers/page_helpers.js
@@ -43,7 +43,7 @@ define(['backbone'],
};
return {
- 'getLocationHash': getLocationHash,
- 'preventBackboneChangingUrl': preventBackboneChangingUrl
+ getLocationHash: getLocationHash,
+ preventBackboneChangingUrl: preventBackboneChangingUrl
};
});
diff --git a/common/static/common/js/spec_helpers/template_helpers.js b/common/static/common/js/spec_helpers/template_helpers.js
index b5dc2c500d..97ad290ae1 100644
--- a/common/static/common/js/spec_helpers/template_helpers.js
+++ b/common/static/common/js/spec_helpers/template_helpers.js
@@ -37,7 +37,7 @@ define(['jquery', 'underscore'],
};
return {
- 'installTemplate': installTemplate,
- 'installTemplates': installTemplates
+ installTemplate: installTemplate,
+ installTemplates: installTemplates
};
});
diff --git a/common/static/common/js/spec_helpers/view_helpers.js b/common/static/common/js/spec_helpers/view_helpers.js
index eedda24d9f..3ef56d562d 100644
--- a/common/static/common/js/spec_helpers/view_helpers.js
+++ b/common/static/common/js/spec_helpers/view_helpers.js
@@ -131,22 +131,22 @@
};
return {
- 'installViewTemplates': installViewTemplates,
- 'createNotificationSpy': createNotificationSpy,
- 'verifyNotificationShowing': verifyNotificationShowing,
- 'verifyNotificationHidden': verifyNotificationHidden,
- 'confirmPrompt': confirmPrompt,
- 'createPromptSpy': createPromptSpy,
- 'verifyPromptShowing': verifyPromptShowing,
- 'verifyPromptHidden': verifyPromptHidden,
- 'inlineEdit': inlineEdit,
- 'verifyInlineEditChange': verifyInlineEditChange,
- 'installMockAnalytics': installMockAnalytics,
- 'removeMockAnalytics': removeMockAnalytics,
- 'clickDeleteItem': clickDeleteItem,
- 'patchAndVerifyRequest': patchAndVerifyRequest,
- 'submitAndVerifyFormSuccess': submitAndVerifyFormSuccess,
- 'submitAndVerifyFormError': submitAndVerifyFormError
+ installViewTemplates: installViewTemplates,
+ createNotificationSpy: createNotificationSpy,
+ verifyNotificationShowing: verifyNotificationShowing,
+ verifyNotificationHidden: verifyNotificationHidden,
+ confirmPrompt: confirmPrompt,
+ createPromptSpy: createPromptSpy,
+ verifyPromptShowing: verifyPromptShowing,
+ verifyPromptHidden: verifyPromptHidden,
+ inlineEdit: inlineEdit,
+ verifyInlineEditChange: verifyInlineEditChange,
+ installMockAnalytics: installMockAnalytics,
+ removeMockAnalytics: removeMockAnalytics,
+ clickDeleteItem: clickDeleteItem,
+ patchAndVerifyRequest: patchAndVerifyRequest,
+ submitAndVerifyFormSuccess: submitAndVerifyFormSuccess,
+ submitAndVerifyFormError: submitAndVerifyFormError
};
});
}).call(this, define || RequireJS.define);
diff --git a/common/static/common/js/xblock/core.js b/common/static/common/js/xblock/core.js
index 3538e18523..b7e9a70fcf 100644
--- a/common/static/common/js/xblock/core.js
+++ b/common/static/common/js/xblock/core.js
@@ -66,7 +66,7 @@
Block.prototype = initFn.prototype;
return new Block();
- })();
+ }());
block.runtime = runtime;
} else {
block = {};
diff --git a/common/static/common/js/xblock/runtime.v1.js b/common/static/common/js/xblock/runtime.v1.js
index b78c9cb781..c49d7ea886 100644
--- a/common/static/common/js/xblock/runtime.v1.js
+++ b/common/static/common/js/xblock/runtime.v1.js
@@ -43,5 +43,5 @@
};
return v1;
- })();
+ }());
}).call(this);
diff --git a/common/static/js/capa/annotationinput.js b/common/static/js/capa/annotationinput.js
index f1b4a5dab5..09adde930c 100644
--- a/common/static/js/capa/annotationinput.js
+++ b/common/static/js/capa/annotationinput.js
@@ -33,7 +33,8 @@
this.storeValue(value_el, current_value);
},
onClickTag: function(e) {
- var target_el = e.target, target_value, target_index;
+ var target_el = e.target,
+ target_value, target_index;
var value_el, current_value;
value_el = this.findValueEl(e.target);
diff --git a/common/static/js/capa/chemical_equation_preview.js b/common/static/js/capa/chemical_equation_preview.js
index 0fed243d4a..85a1c2ac67 100644
--- a/common/static/js/capa/chemical_equation_preview.js
+++ b/common/static/js/capa/chemical_equation_preview.js
@@ -18,7 +18,7 @@
// grab the input id from the input
input_id = $(this).data('input-id');
- Problem.inputAjax(url, input_id, 'preview_chemcalc', {'formula': this.value}, create_handler(preview_div));
+ Problem.inputAjax(url, input_id, 'preview_chemcalc', {formula: this.value}, create_handler(preview_div));
};
inputs = $('.chemicalequationinput input');
diff --git a/common/static/js/capa/choicetextinput.js b/common/static/js/capa/choicetextinput.js
index e1f1ab2fd0..3d08c94ba7 100644
--- a/common/static/js/capa/choicetextinput.js
+++ b/common/static/js/capa/choicetextinput.js
@@ -6,16 +6,16 @@
// find the closest parent problems-wrapper and use that as the problem
// grab the input id from the input
// real_input is the hidden input field
- var real_input = $('input.choicetextvalue', parent);
- var all_inputs = $('input.ctinput', parent);
+ var $real_input = $('input.choicetextvalue', parent);
+ var $all_inputs = $('input.ctinput', parent);
var user_inputs = {};
- $(all_inputs).each(function(index, elt) {
- var node = $(elt);
- var name = node.attr('id');
- var val = node.val();
- var radio_value = node.attr('value');
- var type = node.attr('type');
- var is_checked = node.attr('checked');
+ $($all_inputs).each(function(index, elt) {
+ var $node = $(elt);
+ var name = $node.attr('id');
+ var val = $node.val();
+ var radio_value = $node.attr('value');
+ var type = $node.attr('type');
+ var is_checked = $node.attr('checked');
if (type === 'radio' || type === 'checkbox') {
if (is_checked === 'checked' || is_checked === 'true') {
user_inputs[name] = radio_value;
@@ -26,14 +26,14 @@
});
var val_string = JSON.stringify(user_inputs);
// this is what gets submitted as the answer, we deserialize it later
- real_input.val(val_string);
+ $real_input.val(val_string);
};
var check_parent = function(event) {
// This looks for the containing choice of a textinput
// and sets it to be checked.
- var elt = $(event.target);
- var parent_container = elt.closest('section[id^="forinput"]');
+ var $elt = $(event.target);
+ var parent_container = $elt.closest('section[id^="forinput"]');
var choice = parent_container.find("input[type='checkbox'], input[type='radio']");
choice.attr('checked', 'checked');
choice.change();
@@ -44,8 +44,8 @@
// This causes a section to check and uncheck
// a radiobutton/checkbox whenever a user clicks on it
// If the button/checkbox is disabled, nothing happens
- var elt = $(event.target);
- var parent_container = elt.closest('section[id^="forinput"]');
+ var $elt = $(event.target);
+ var parent_container = $elt.closest('section[id^="forinput"]');
var choice = parent_container.find("input[type='checkbox'], input[type='radio']");
if (choice.attr('type') === 'radio') {
choice.attr('checked', 'checked');
@@ -59,15 +59,15 @@
choice.change();
update();
};
- var choices = $('.mock_label');
- var inputs = $('.choicetextinput .ctinput');
- var text_inputs = $('.choicetextinput .ctinput[type="text"]');
+ var $choices = $('.mock_label');
+ var $inputs = $('.choicetextinput .ctinput');
+ var $text_inputs = $('.choicetextinput .ctinput[type="text"]');
// update on load
- inputs.each(update);
+ $inputs.each(update);
// and on every change
// This allows text inside of choices to behave as if they were part of
// a label for the choice's button/checkbox
- choices.click(imitate_label);
- inputs.bind('change', update);
- text_inputs.click(check_parent);
+ $choices.click(imitate_label);
+ $inputs.bind('change', update);
+ $text_inputs.click(check_parent);
}).call(this);
diff --git a/common/static/js/capa/design-protein-2d.js b/common/static/js/capa/design-protein-2d.js
index 2b4ab67ff4..56ceec23ea 100644
--- a/common/static/js/capa/design-protein-2d.js
+++ b/common/static/js/capa/design-protein-2d.js
@@ -38,8 +38,8 @@
// Get answer from protex and store it into the hidden input field
// when Check button is clicked
- var fold_button = $('#fold-button');
- fold_button.on('click', function() {
+ var $fold_button = $('#fold-button');
+ $fold_button.on('click', function() {
var problem = $('#protex_container').parents('.problem');
var input_field = problem.find('input[type=hidden]');
var protex_answer = protexCheckAnswer();
diff --git a/common/static/js/capa/drag_and_drop/base_image.js b/common/static/js/capa/drag_and_drop/base_image.js
index 6e31215234..c9114f86c7 100644
--- a/common/static/js/capa/drag_and_drop/base_image.js
+++ b/common/static/js/capa/drag_and_drop/base_image.js
@@ -3,9 +3,9 @@
return BaseImage;
function BaseImage(state) {
- var baseImageElContainer;
+ var $baseImageElContainer;
- baseImageElContainer = $(
+ $baseImageElContainer = $(
'' +
'ERROR: Image "' + state.config.baseImage + '" was not found!' +
''
);
- baseImageElContainer.appendTo(state.containerEl);
+ $baseImageElContainer.appendTo(state.containerEl);
});
}
}); // End-of: define([], function () {
diff --git a/common/static/js/capa/drag_and_drop/config_parser.js b/common/static/js/capa/drag_and_drop/config_parser.js
index 375c002cb3..b51112cfa4 100644
--- a/common/static/js/capa/drag_and_drop/config_parser.js
+++ b/common/static/js/capa/drag_and_drop/config_parser.js
@@ -4,14 +4,14 @@
function configParser(state, config) {
state.config = {
- 'draggables': [],
- 'baseImage': '',
- 'targets': [],
- 'onePerTarget': null, // Specified by user. No default.
- 'targetOutline': true,
- 'labelBgColor': '#d6d6d6',
- 'individualTargets': null, // Depends on 'targets'.
- 'foundErrors': false // Whether or not we find errors while processing the config.
+ draggables: [],
+ baseImage: '',
+ targets: [],
+ onePerTarget: null, // Specified by user. No default.
+ targetOutline: true,
+ labelBgColor: '#d6d6d6',
+ individualTargets: null, // Depends on 'targets'.
+ foundErrors: false // Whether or not we find errors while processing the config.
};
getDraggables(state, config);
diff --git a/common/static/js/capa/drag_and_drop/draggable_events.js b/common/static/js/capa/drag_and_drop/draggable_events.js
index 6720205b3a..16fbe2b519 100644
--- a/common/static/js/capa/drag_and_drop/draggable_events.js
+++ b/common/static/js/capa/drag_and_drop/draggable_events.js
@@ -1,7 +1,7 @@
(function(requirejs, require, define) {
define([], function() {
return {
- 'attachMouseEventsTo': function(element) {
+ attachMouseEventsTo: function(element) {
var self;
self = this;
@@ -17,7 +17,7 @@
});
},
- 'mouseDown': function(event) {
+ mouseDown: function(event) {
if (this.mousePressed === false) {
// So that the browser does not perform a default drag.
// If we don't do this, each drag operation will
@@ -47,19 +47,19 @@
if (this.iconImgEl !== null) {
this.iconImgEl.css({
- 'width': this.iconWidth,
- 'height': this.iconHeight
+ width: this.iconWidth,
+ height: this.iconHeight
});
}
this.iconEl.css({
'background-color': this.iconElBGColor,
'padding-left': this.iconElPadding,
'padding-right': this.iconElPadding,
- 'border': this.iconElBorder,
- 'width': this.iconWidth,
- 'height': this.iconHeight,
- 'left': event.pageX - this.state.baseImageEl.offset().left - this.iconWidth * 0.5 - this.iconElLeftOffset,
- 'top': event.pageY - this.state.baseImageEl.offset().top - this.iconHeight * 0.5
+ border: this.iconElBorder,
+ width: this.iconWidth,
+ height: this.iconHeight,
+ left: event.pageX - this.state.baseImageEl.offset().left - this.iconWidth * 0.5 - this.iconElLeftOffset,
+ top: event.pageY - this.state.baseImageEl.offset().top - this.iconHeight * 0.5
});
this.iconEl.appendTo(this.state.baseImageEl.parent());
@@ -71,9 +71,9 @@
'background-color': this.state.config.labelBgColor,
'padding-left': 8,
'padding-right': 8,
- 'border': '1px solid black',
- 'left': event.pageX - this.state.baseImageEl.offset().left - this.labelWidth * 0.5 - 9, // Account for padding, border.
- 'top': event.pageY - this.state.baseImageEl.offset().top + this.iconHeight * 0.5 + 5
+ border: '1px solid black',
+ left: event.pageX - this.state.baseImageEl.offset().left - this.labelWidth * 0.5 - 9, // Account for padding, border.
+ top: event.pageY - this.state.baseImageEl.offset().top + this.iconHeight * 0.5 + 5
});
this.labelEl.appendTo(this.state.baseImageEl.parent());
}
@@ -100,7 +100,7 @@
}
},
- 'mouseUp': function() {
+ mouseUp: function() {
if (this.mousePressed === true) {
this.state.currentMovingDraggable = null;
this.iconEl.attr('aria-grabbed', 'false');
@@ -115,7 +115,7 @@
}
},
- 'mouseMove': function(event) {
+ mouseMove: function(event) {
if (this.mousePressed === true) {
// Because we have also attached a 'mousemove' event to the
// 'document' (that will do the same thing), let's tell the
@@ -126,14 +126,14 @@
event.stopPropagation();
this.iconEl.css({
- 'left': event.pageX - this.state.baseImageEl.offset().left - this.iconWidth * 0.5 - this.iconElLeftOffset,
- 'top': event.pageY - this.state.baseImageEl.offset().top - this.iconHeight * 0.5
+ left: event.pageX - this.state.baseImageEl.offset().left - this.iconWidth * 0.5 - this.iconElLeftOffset,
+ top: event.pageY - this.state.baseImageEl.offset().top - this.iconHeight * 0.5
});
if (this.labelEl !== null) {
this.labelEl.css({
- 'left': event.pageX - this.state.baseImageEl.offset().left - this.labelWidth * 0.5 - 9, // Acoount for padding, border.
- 'top': event.pageY - this.state.baseImageEl.offset().top + this.iconHeight * 0.5 + 5
+ left: event.pageX - this.state.baseImageEl.offset().left - this.labelWidth * 0.5 - 9, // Acoount for padding, border.
+ top: event.pageY - this.state.baseImageEl.offset().top + this.iconHeight * 0.5 + 5
});
}
}
diff --git a/common/static/js/capa/drag_and_drop/draggable_logic.js b/common/static/js/capa/drag_and_drop/draggable_logic.js
index 16ccb90b4a..4fbd9692a2 100644
--- a/common/static/js/capa/drag_and_drop/draggable_logic.js
+++ b/common/static/js/capa/drag_and_drop/draggable_logic.js
@@ -1,7 +1,7 @@
(function(requirejs, require, define) {
define(['js/capa/drag_and_drop/update_input', 'js/capa/drag_and_drop/targets'], function(updateInput, Targets) {
return {
- 'moveDraggableTo': function(moveType, target, funcCallback) {
+ moveDraggableTo: function(moveType, target, funcCallback) {
var self, offset;
if (this.hasLoaded === false) {
@@ -36,8 +36,8 @@
if (this.iconImgEl !== null) {
this.iconImgEl.css({
- 'width': this.iconWidth,
- 'height': this.iconHeight
+ width: this.iconWidth,
+ height: this.iconHeight
});
}
@@ -45,19 +45,19 @@
'background-color': this.iconElBGColor,
'padding-left': this.iconElPadding,
'padding-right': this.iconElPadding,
- 'border': this.iconElBorder,
- 'width': this.iconWidth,
- 'height': this.iconHeight
+ border: this.iconElBorder,
+ width: this.iconWidth,
+ height: this.iconHeight
});
if (moveType === 'target') {
this.iconEl.css({
- 'left': target.offset.left + 0.5 * target.w - this.iconWidth * 0.5 + offset - this.iconElLeftOffset,
- 'top': target.offset.top + 0.5 * target.h - this.iconHeight * 0.5 + offset
+ left: target.offset.left + 0.5 * target.w - this.iconWidth * 0.5 + offset - this.iconElLeftOffset,
+ top: target.offset.top + 0.5 * target.h - this.iconHeight * 0.5 + offset
});
} else {
this.iconEl.css({
- 'left': target.x - this.iconWidth * 0.5 + offset - this.iconElLeftOffset,
- 'top': target.y - this.iconHeight * 0.5 + offset
+ left: target.x - this.iconWidth * 0.5 + offset - this.iconElLeftOffset,
+ top: target.y - this.iconHeight * 0.5 + offset
});
}
this.iconEl.appendTo(this.state.baseImageEl.parent());
@@ -70,17 +70,17 @@
'background-color': this.state.config.labelBgColor,
'padding-left': 8,
'padding-right': 8,
- 'border': '1px solid black'
+ border: '1px solid black'
});
if (moveType === 'target') {
this.labelEl.css({
- 'left': target.offset.left + 0.5 * target.w - this.labelWidth * 0.5 + offset - 9, // Account for padding, border.
- 'top': target.offset.top + 0.5 * target.h + this.iconHeight * 0.5 + 5 + offset
+ left: target.offset.left + 0.5 * target.w - this.labelWidth * 0.5 + offset - 9, // Account for padding, border.
+ top: target.offset.top + 0.5 * target.h + this.iconHeight * 0.5 + 5 + offset
});
} else {
this.labelEl.css({
- 'left': target.x - this.labelWidth * 0.5 + offset - 9, // Account for padding, border.
- 'top': target.y - this.iconHeight * 0.5 + this.iconHeight + 5 + offset
+ left: target.x - this.labelWidth * 0.5 + offset - 9, // Account for padding, border.
+ top: target.y - this.iconHeight * 0.5 + this.iconHeight + 5 + offset
});
}
this.labelEl.appendTo(this.state.baseImageEl.parent());
@@ -113,7 +113,7 @@
// will either move the draggable back to the slider, or update
// the input with the user's answer (X-Y position of the draggable,
// or the ID of the target where it landed.
- 'checkLandingElement': function() {
+ checkLandingElement: function() {
var positionIE;
this.mousePressed = false;
@@ -174,7 +174,7 @@
// positionIE is the object as returned by
//
// this.iconEl.position()
- 'checkIfOnTarget': function(positionIE) {
+ checkIfOnTarget: function(positionIE) {
var c1, target;
for (c1 = 0; c1 < this.state.targets.length; c1 += 1) {
@@ -236,7 +236,7 @@
return false;
},
- 'toggleTargets': function(isEnabled) {
+ toggleTargets: function(isEnabled) {
var effect = isEnabled ? 'move' : null;
this.state.baseImageEl.attr('aria-dropeffect', effect);
@@ -245,7 +245,7 @@
});
},
- 'snapToTarget': function(target) {
+ snapToTarget: function(target) {
var offset;
offset = 0;
@@ -254,14 +254,14 @@
}
this.iconEl.css({
- 'left': target.offset.left + 0.5 * target.w - this.iconWidth * 0.5 + offset - this.iconElLeftOffset,
- 'top': target.offset.top + 0.5 * target.h - this.iconHeight * 0.5 + offset
+ left: target.offset.left + 0.5 * target.w - this.iconWidth * 0.5 + offset - this.iconElLeftOffset,
+ top: target.offset.top + 0.5 * target.h - this.iconHeight * 0.5 + offset
});
if (this.labelEl !== null) {
this.labelEl.css({
- 'left': target.offset.left + 0.5 * target.w - this.labelWidth * 0.5 + offset - 9, // Acoount for padding, border.
- 'top': target.offset.top + 0.5 * target.h + this.iconHeight * 0.5 + 5 + offset
+ left: target.offset.left + 0.5 * target.w - this.labelWidth * 0.5 + offset - 9, // Acoount for padding, border.
+ top: target.offset.top + 0.5 * target.h + this.iconHeight * 0.5 + 5 + offset
});
}
},
@@ -276,7 +276,7 @@
// will be on top of all of the other draggables. Also, the
// ordering of the visibility (z-index) of the other draggables
// will not change.
- 'correctZIndexes': function() {
+ correctZIndexes: function() {
var c1, highestZIndex;
highestZIndex = -10000;
@@ -322,7 +322,7 @@
// If a draggable was released in a wrong positione, we will
// move it back to the slider, placing it in the same position
// that it was dragged out of.
- 'moveBackToSlider': function() {
+ moveBackToSlider: function() {
var c1;
Targets.destroyTargetField(this);
@@ -350,41 +350,41 @@
this.iconEl.detach();
if (this.iconImgEl !== null) {
this.iconImgEl.css({
- 'width': this.iconWidthSmall,
- 'height': this.iconHeightSmall
+ width: this.iconWidthSmall,
+ height: this.iconHeightSmall
});
}
this.iconEl.css({
- 'border': 'none',
+ border: 'none',
'background-color': 'transparent',
'padding-left': 0,
'padding-right': 0,
'z-index': this.zIndex,
- 'width': this.iconWidthSmall,
- 'height': this.iconHeightSmall,
- 'left': 50 - this.iconWidthSmall * 0.5,
+ width: this.iconWidthSmall,
+ height: this.iconHeightSmall,
+ left: 50 - this.iconWidthSmall * 0.5,
// Before:
// 'top': ((this.labelEl !== null) ? (100 - this.iconHeightSmall - 25) * 0.5 : 50 - this.iconHeightSmall * 0.5)
// After:
- 'top': ((this.labelEl !== null) ? 37.5 : 50.0) - 0.5 * this.iconHeightSmall
+ top: ((this.labelEl !== null) ? 37.5 : 50.0) - 0.5 * this.iconHeightSmall
});
this.iconEl.appendTo(this.containerEl);
if (this.labelEl !== null) {
this.labelEl.detach();
this.labelEl.css({
- 'border': 'none',
+ border: 'none',
'background-color': 'transparent',
'padding-left': 0,
'padding-right': 0,
'z-index': this.zIndex,
- 'left': 50 - this.labelWidth * 0.5,
+ left: 50 - this.labelWidth * 0.5,
// Before:
// 'top': (100 - this.iconHeightSmall - 25) * 0.5 + this.iconHeightSmall + 5
// After:
- 'top': 42.5 + 0.5 * this.iconHeightSmall
+ top: 42.5 + 0.5 * this.iconHeightSmall
});
this.labelEl.appendTo(this.containerEl);
}
diff --git a/common/static/js/capa/drag_and_drop/draggables.js b/common/static/js/capa/drag_and_drop/draggables.js
index a0b3fafac8..a813f52b4d 100644
--- a/common/static/js/capa/drag_and_drop/draggables.js
+++ b/common/static/js/capa/drag_and_drop/draggables.js
@@ -1,7 +1,7 @@
(function(requirejs, require, define) {
define(['js/capa/drag_and_drop/draggable_events', 'js/capa/drag_and_drop/draggable_logic'], function(draggableEvents, draggableLogic) {
return {
- 'init': init
+ init: init
};
function init(state) {
@@ -39,18 +39,18 @@
draggableObj.iconImgEl.attr('src', draggableObj.originalConfigObj.icon);
draggableObj.iconImgEl.load(function() {
draggableObj.iconEl.css({
- 'position': 'absolute',
- 'width': draggableObj.iconWidthSmall,
- 'height': draggableObj.iconHeightSmall,
- 'left': 50 - draggableObj.iconWidthSmall * 0.5,
- 'top': ((draggableObj.originalConfigObj.label.length > 0) ? 5 : 50 - draggableObj.iconHeightSmall * 0.5)
+ position: 'absolute',
+ width: draggableObj.iconWidthSmall,
+ height: draggableObj.iconHeightSmall,
+ left: 50 - draggableObj.iconWidthSmall * 0.5,
+ top: ((draggableObj.originalConfigObj.label.length > 0) ? 5 : 50 - draggableObj.iconHeightSmall * 0.5)
});
draggableObj.iconImgEl.css({
- 'position': 'absolute',
- 'width': draggableObj.iconWidthSmall,
- 'height': draggableObj.iconHeightSmall,
- 'left': 0,
- 'top': 0
+ position: 'absolute',
+ width: draggableObj.iconWidthSmall,
+ height: draggableObj.iconHeightSmall,
+ left: 0,
+ top: 0
});
draggableObj.iconImgEl.appendTo(draggableObj.iconEl);
@@ -67,8 +67,8 @@
'
'
);
draggableObj.labelEl.css({
- 'left': 50 - draggableObj.labelWidth * 0.5,
- 'top': 5 + draggableObj.iconHeightSmall + 5
+ left: 50 - draggableObj.labelWidth * 0.5,
+ top: 5 + draggableObj.iconHeightSmall + 5
});
draggableObj.attachMouseEventsTo('labelEl');
@@ -98,8 +98,8 @@
' '
);
draggableObj.iconEl.css({
- 'left': 50 - draggableObj.iconWidthSmall * 0.5,
- 'top': 50 - draggableObj.iconHeightSmall * 0.5
+ left: 50 - draggableObj.iconWidthSmall * 0.5,
+ top: 50 - draggableObj.iconHeightSmall * 0.5
});
draggableObj.attachMouseEventsTo('iconEl');
@@ -119,53 +119,53 @@
var draggableObj;
draggableObj = {
- 'uniqueId': state.getUniqueId(),
- 'originalConfigObj': obj,
- 'stateDraggablesIndex': null,
- 'id': obj.id,
- 'isReusable': obj.can_reuse,
- 'isOriginal': true,
- 'x': -1,
- 'y': -1,
- 'zIndex': 1,
- 'containerEl': null,
- 'iconEl': null,
- 'iconImgEl': null,
- 'iconElBGColor': null,
- 'iconElPadding': null,
- 'iconElBorder': null,
- 'iconElLeftOffset': null,
- 'iconWidth': null,
- 'iconHeight': null,
- 'iconWidthSmall': null,
- 'iconHeightSmall': null,
- 'labelEl': null,
- 'labelWidth': null,
- 'hasLoaded': false,
- 'inContainer': true,
- 'mousePressed': false,
- 'onTarget': null,
- 'onTargetIndex': null,
- 'state': state,
+ uniqueId: state.getUniqueId(),
+ originalConfigObj: obj,
+ stateDraggablesIndex: null,
+ id: obj.id,
+ isReusable: obj.can_reuse,
+ isOriginal: true,
+ x: -1,
+ y: -1,
+ zIndex: 1,
+ containerEl: null,
+ iconEl: null,
+ iconImgEl: null,
+ iconElBGColor: null,
+ iconElPadding: null,
+ iconElBorder: null,
+ iconElLeftOffset: null,
+ iconWidth: null,
+ iconHeight: null,
+ iconWidthSmall: null,
+ iconHeightSmall: null,
+ labelEl: null,
+ labelWidth: null,
+ hasLoaded: false,
+ inContainer: true,
+ mousePressed: false,
+ onTarget: null,
+ onTargetIndex: null,
+ state: state,
- 'mouseDown': draggableEvents.mouseDown,
- 'mouseUp': draggableEvents.mouseUp,
- 'mouseMove': draggableEvents.mouseMove,
+ mouseDown: draggableEvents.mouseDown,
+ mouseUp: draggableEvents.mouseUp,
+ mouseMove: draggableEvents.mouseMove,
- 'checkLandingElement': draggableLogic.checkLandingElement,
- 'checkIfOnTarget': draggableLogic.checkIfOnTarget,
- 'snapToTarget': draggableLogic.snapToTarget,
- 'correctZIndexes': draggableLogic.correctZIndexes,
- 'moveBackToSlider': draggableLogic.moveBackToSlider,
- 'moveDraggableTo': draggableLogic.moveDraggableTo,
- 'toggleTargets': draggableLogic.toggleTargets,
+ checkLandingElement: draggableLogic.checkLandingElement,
+ checkIfOnTarget: draggableLogic.checkIfOnTarget,
+ snapToTarget: draggableLogic.snapToTarget,
+ correctZIndexes: draggableLogic.correctZIndexes,
+ moveBackToSlider: draggableLogic.moveBackToSlider,
+ moveDraggableTo: draggableLogic.moveDraggableTo,
+ toggleTargets: draggableLogic.toggleTargets,
- 'makeDraggableCopy': makeDraggableCopy,
+ makeDraggableCopy: makeDraggableCopy,
- 'attachMouseEventsTo': draggableEvents.attachMouseEventsTo,
+ attachMouseEventsTo: draggableEvents.attachMouseEventsTo,
- 'targetField': [],
- 'numDraggablesOnMe': 0
+ targetField: [],
+ numDraggablesOnMe: 0
};
draggableObj.containerEl = $(
@@ -209,22 +209,22 @@
}
draggableObj.iconEl.css({
- 'position': 'absolute',
- 'width': draggableObj.iconWidthSmall,
- 'height': draggableObj.iconHeightSmall,
- 'left': 50 - draggableObj.iconWidthSmall * 0.5,
+ position: 'absolute',
+ width: draggableObj.iconWidthSmall,
+ height: draggableObj.iconHeightSmall,
+ left: 50 - draggableObj.iconWidthSmall * 0.5,
// Before:
// 'top': ((obj.label.length > 0) ? (100 - draggableObj.iconHeightSmall - 25) * 0.5 : 50 - draggableObj.iconHeightSmall * 0.5)
// After:
- 'top': ((obj.label.length > 0) ? 37.5 : 50.0) - 0.5 * draggableObj.iconHeightSmall
+ top: ((obj.label.length > 0) ? 37.5 : 50.0) - 0.5 * draggableObj.iconHeightSmall
});
draggableObj.iconImgEl.css({
- 'position': 'absolute',
- 'width': draggableObj.iconWidthSmall,
- 'height': draggableObj.iconHeightSmall,
- 'left': 0,
- 'top': 0
+ position: 'absolute',
+ width: draggableObj.iconWidthSmall,
+ height: draggableObj.iconHeightSmall,
+ left: 0,
+ top: 0
});
draggableObj.iconImgEl.appendTo(draggableObj.iconEl);
draggableObj.iconEl.appendTo(draggableObj.containerEl);
@@ -246,12 +246,12 @@
draggableObj.labelEl.appendTo(draggableObj.containerEl);
draggableObj.labelWidth = draggableObj.labelEl.width();
draggableObj.labelEl.css({
- 'left': 50 - draggableObj.labelWidth * 0.5,
+ left: 50 - draggableObj.labelWidth * 0.5,
// Before:
// 'top': (100 - this.iconHeightSmall - 25) * 0.5 + this.iconHeightSmall + 5
// After:
- 'top': 42.5 + 0.5 * draggableObj.iconHeightSmall
+ top: 42.5 + 0.5 * draggableObj.iconHeightSmall
});
draggableObj.attachMouseEventsTo('labelEl');
@@ -292,8 +292,8 @@
draggableObj.iconHeightSmall = draggableObj.iconHeight;
draggableObj.iconEl.css({
- 'left': 50 - draggableObj.iconWidthSmall * 0.5,
- 'top': 50 - draggableObj.iconHeightSmall * 0.5
+ left: 50 - draggableObj.iconWidthSmall * 0.5,
+ top: 50 - draggableObj.iconHeightSmall * 0.5
});
draggableObj.hasLoaded = true;
diff --git a/common/static/js/capa/drag_and_drop/main.js b/common/static/js/capa/drag_and_drop/main.js
index 440d27b3ba..d3db330190 100644
--- a/common/static/js/capa/drag_and_drop/main.js
+++ b/common/static/js/capa/drag_and_drop/main.js
@@ -1,10 +1,10 @@
(function(requirejs, require, define) {
define(
- ['js/capa/drag_and_drop/state',
- 'js/capa/drag_and_drop/config_parser', 'js/capa/drag_and_drop/container',
- 'js/capa/drag_and_drop/base_image', 'js/capa/drag_and_drop/scroller',
- 'js/capa/drag_and_drop/draggables', 'js/capa/drag_and_drop/targets',
- 'js/capa/drag_and_drop/update_input'],
+ ['js/capa/drag_and_drop/state',
+ 'js/capa/drag_and_drop/config_parser', 'js/capa/drag_and_drop/container',
+ 'js/capa/drag_and_drop/base_image', 'js/capa/drag_and_drop/scroller',
+ 'js/capa/drag_and_drop/draggables', 'js/capa/drag_and_drop/targets',
+ 'js/capa/drag_and_drop/update_input'],
function(State, configParser, Container, BaseImage, Scroller, Draggables, Targets, updateInput) {
return Main;
@@ -23,7 +23,7 @@
t = Object(this);
len = t.length >>> 0;
- if (typeof fun != 'function') {
+ if (typeof fun !== 'function') {
throw new TypeError();
}
diff --git a/common/static/js/capa/drag_and_drop/scroller.js b/common/static/js/capa/drag_and_drop/scroller.js
index c014cbb367..0a1fa48ea7 100644
--- a/common/static/js/capa/drag_and_drop/scroller.js
+++ b/common/static/js/capa/drag_and_drop/scroller.js
@@ -3,9 +3,9 @@
return Scroller;
function Scroller(state) {
- var parentEl, moveLeftEl, showEl, moveRightEl, showElLeftMargin;
+ var $parentEl, $moveLeftEl, $showEl, $moveRightEl, showElLeftMargin;
- parentEl = $(
+ $parentEl = $(
''
);
- moveLeftEl = $(
+ $moveLeftEl = $(
'' +
''
);
- moveLeftEl.appendTo(parentEl);
+ $moveLeftEl.appendTo($parentEl);
// The below is necessary to prevent the browser thinking that we want
// to perform a drag operation, or a highlight operation. If we don't
// do this, the browser will then highlight with a gray shade the
// element.
- moveLeftEl.mousemove(function(event) { event.preventDefault(); });
- moveLeftEl.mousedown(function(event) { event.preventDefault(); });
+ $moveLeftEl.mousemove(function(event) { event.preventDefault(); });
+ $moveLeftEl.mousedown(function(event) { event.preventDefault(); });
// This event will be responsible for moving the scroller left.
// Hidden draggables will be shown.
- moveLeftEl.mouseup(function(event) {
+ $moveLeftEl.mouseup(function(event) {
event.preventDefault();
// When there are no more hidden draggables, prevent from
@@ -77,7 +77,7 @@
});
});
- showEl = $(
+ $showEl = $(
''
);
- showEl.appendTo(parentEl);
+ $showEl.appendTo($parentEl);
showElLeftMargin = 0;
@@ -106,13 +106,13 @@
'" ' +
'>'
);
- state.sliderEl.appendTo(showEl);
+ state.sliderEl.appendTo($showEl);
state.sliderEl.mousedown(function(event) {
event.preventDefault();
});
- moveRightEl = $(
+ $moveRightEl = $(
'' +
''
);
- moveRightEl.appendTo(parentEl);
+ $moveRightEl.appendTo($parentEl);
// The below is necessary to prevent the browser thinking that we want
// to perform a drag operation, or a highlight operation. If we don't
// do this, the browser will then highlight with a gray shade the
// element.
- moveRightEl.mousemove(function(event) { event.preventDefault(); });
- moveRightEl.mousedown(function(event) { event.preventDefault(); });
+ $moveRightEl.mousemove(function(event) { event.preventDefault(); });
+ $moveRightEl.mousedown(function(event) { event.preventDefault(); });
// This event will be responsible for moving the scroller right.
// Hidden draggables will be shown.
- moveRightEl.mouseup(function(event) {
+ $moveRightEl.mouseup(function(event) {
event.preventDefault();
// When there are no more hidden draggables, prevent from
@@ -173,7 +173,7 @@
});
});
- parentEl.appendTo(state.containerEl);
+ $parentEl.appendTo(state.containerEl);
// Make the function available throughout the application. We need to
// call it in several places:
@@ -190,14 +190,14 @@
return;
function updateArrowOpacity() {
- moveLeftEl.children('div').css('opacity', '1');
- moveRightEl.children('div').css('opacity', '1');
+ $moveLeftEl.children('div').css('opacity', '1');
+ $moveRightEl.children('div').css('opacity', '1');
if (showElLeftMargin < -102 * (state.numDraggablesInSlider - 6)) {
- moveRightEl.children('div').css('opacity', '.4');
+ $moveRightEl.children('div').css('opacity', '.4');
}
if (showElLeftMargin > -102) {
- moveLeftEl.children('div').css('opacity', '.4');
+ $moveLeftEl.children('div').css('opacity', '.4');
}
}
} // End-of: function Scroller(state)
diff --git a/common/static/js/capa/drag_and_drop/state.js b/common/static/js/capa/drag_and_drop/state.js
index 1f022c847f..593c9b8a9c 100644
--- a/common/static/js/capa/drag_and_drop/state.js
+++ b/common/static/js/capa/drag_and_drop/state.js
@@ -6,29 +6,29 @@
var state;
state = {
- 'config': null,
+ config: null,
- 'baseImageEl': null,
- 'baseImageLoaded': false,
+ baseImageEl: null,
+ baseImageLoaded: false,
- 'containerEl': null,
+ containerEl: null,
- 'sliderEl': null,
+ sliderEl: null,
- 'problemId': problemId,
+ problemId: problemId,
- 'draggables': [],
- 'numDraggablesInSlider': 0,
- 'currentMovingDraggable': null,
+ draggables: [],
+ numDraggablesInSlider: 0,
+ currentMovingDraggable: null,
- 'targets': [],
+ targets: [],
- 'updateArrowOpacity': null,
+ updateArrowOpacity: null,
- 'uniqueId': 0,
- 'salt': makeSalt(),
+ uniqueId: 0,
+ salt: makeSalt(),
- 'getUniqueId': getUniqueId
+ getUniqueId: getUniqueId
};
$(document).mousemove(function(event) {
diff --git a/common/static/js/capa/drag_and_drop/targets.js b/common/static/js/capa/drag_and_drop/targets.js
index bea6234b3a..ffbf47f1e8 100644
--- a/common/static/js/capa/drag_and_drop/targets.js
+++ b/common/static/js/capa/drag_and_drop/targets.js
@@ -1,9 +1,9 @@
(function(requirejs, require, define) {
define([], function() {
return {
- 'initializeBaseTargets': initializeBaseTargets,
- 'initializeTargetField': initializeTargetField,
- 'destroyTargetField': destroyTargetField
+ initializeBaseTargets: initializeBaseTargets,
+ initializeTargetField: initializeTargetField,
+ destroyTargetField: destroyTargetField
};
function initializeBaseTargets(state) {
@@ -68,14 +68,14 @@
}
function processTarget(state, obj, fromTargetField, draggableObj) {
- var targetEl, borderCss, numTextEl, targetObj;
+ var $targetEl, borderCss, $numTextEl, targetObj;
borderCss = '';
if (state.config.targetOutline === true) {
borderCss = 'border: 1px dashed gray; ';
}
- targetEl = $(
+ $targetEl = $(
''
);
if (fromTargetField === true) {
- targetEl.appendTo(draggableObj.iconEl);
+ $targetEl.appendTo(draggableObj.iconEl);
} else {
- targetEl.appendTo(state.baseImageEl.parent());
+ $targetEl.appendTo(state.baseImageEl.parent());
}
- targetEl.mousedown(function(event) {
+ $targetEl.mousedown(function(event) {
event.preventDefault();
});
if (state.config.onePerTarget === false) {
- numTextEl = $(
+ $numTextEl = $(
'0
'
);
} else {
- numTextEl = null;
+ $numTextEl = null;
}
targetObj = {
- 'uniqueId': state.getUniqueId(),
+ uniqueId: state.getUniqueId(),
- 'id': obj.id,
+ id: obj.id,
- 'x': obj.x,
- 'y': obj.y,
+ x: obj.x,
+ y: obj.y,
- 'w': obj.w,
- 'h': obj.h,
+ w: obj.w,
+ h: obj.h,
- 'el': targetEl,
- 'offset': targetEl.position(),
+ el: $targetEl,
+ offset: $targetEl.position(),
- 'draggableList': [],
+ draggableList: [],
- 'state': state,
+ state: state,
- 'targetEl': targetEl,
+ targetEl: $targetEl,
- 'numTextEl': numTextEl,
- 'updateNumTextEl': updateNumTextEl,
+ numTextEl: $numTextEl,
+ updateNumTextEl: updateNumTextEl,
- 'removeDraggable': removeDraggable,
- 'addDraggable': addDraggable,
+ removeDraggable: removeDraggable,
+ addDraggable: addDraggable,
- 'type': 'base',
- 'draggableObj': null
+ type: 'base',
+ draggableObj: null
};
if (fromTargetField === true) {
@@ -161,11 +161,11 @@
}
if (state.config.onePerTarget === false) {
- numTextEl.appendTo(state.baseImageEl.parent());
- numTextEl.mousedown(function(event) {
+ $numTextEl.appendTo(state.baseImageEl.parent());
+ $numTextEl.mousedown(function(event) {
event.preventDefault();
});
- numTextEl.mouseup(function() {
+ $numTextEl.mouseup(function() {
cycleDraggableOrder.call(targetObj);
});
}
diff --git a/common/static/js/capa/drag_and_drop/update_input.js b/common/static/js/capa/drag_and_drop/update_input.js
index 39764c580e..bff33ab18a 100644
--- a/common/static/js/capa/drag_and_drop/update_input.js
+++ b/common/static/js/capa/drag_and_drop/update_input.js
@@ -1,8 +1,8 @@
(function(requirejs, require, define) {
define([], function() {
return {
- 'check': check,
- 'update': update
+ check: check,
+ update: update
};
function update(state) {
@@ -235,8 +235,8 @@
}
draggable.moveDraggableTo('XY', {
- 'x': answer[c1][draggableId][0],
- 'y': answer[c1][draggableId][1]
+ x: answer[c1][draggableId][0],
+ y: answer[c1][draggableId][1]
});
}
diff --git a/common/static/js/capa/edit-a-gene.js b/common/static/js/capa/edit-a-gene.js
index e169fb9ac7..74ec12c597 100644
--- a/common/static/js/capa/edit-a-gene.js
+++ b/common/static/js/capa/edit-a-gene.js
@@ -6,8 +6,7 @@
function waitForGenex() {
if (typeof(genex) !== 'undefined' && genex) {
genex.onInjectionDone('genex');
- }
- else {
+ } else {
setTimeout(function() { waitForGenex(); }, timeout);
}
}
@@ -52,8 +51,7 @@
if (genex_saved_state === '') {
// Load DNA sequence from xml file
genex_dna_sequence = genex_default_dna_sequence;
- }
- else {
+ } else {
// Load DNA sequence from saved value
genex_saved_state = JSON.parse(genex_saved_state);
genex_dna_sequence = genex_saved_state.genex_dna_sequence;
@@ -67,7 +65,7 @@
genexStoreAnswer = function(answer) {
var input_field = genexGetInputField();
- var value = {'genex_dna_sequence': genexGetDNASequence(), 'genex_answer': answer};
+ var value = {genex_dna_sequence: genexGetDNASequence(), genex_answer: answer};
input_field.val(JSON.stringify(value));
};
}).call(this);
diff --git a/common/static/js/capa/editamolecule.js b/common/static/js/capa/editamolecule.js
index 1b0200efe0..5e47f80024 100644
--- a/common/static/js/capa/editamolecule.js
+++ b/common/static/js/capa/editamolecule.js
@@ -2,7 +2,7 @@
var timeout = 100;
// Simple "lock" to prevent applets from being initialized more than once
- if (typeof(_editamolecule_loaded) == 'undefined' || _editamolecule_loaded == false) {
+ if (typeof(_editamolecule_loaded) === 'undefined' || _editamolecule_loaded == false) {
_editamolecule_loaded = true;
loadGWTScripts();
waitForGWT();
@@ -27,12 +27,12 @@
// Make sure we don't request the scripts twice
- if (typeof (_jsmolcalc) == 'undefined') {
+ if (typeof (_jsmolcalc) === 'undefined') {
_jsmolcalc = true;
loadScript(jsmolcalc_src);
}
- if (typeof (_jsme) == 'undefined') {
+ if (typeof (_jsme) === 'undefined') {
_jsme = true;
loadScript(jsme_src);
}
@@ -43,20 +43,18 @@
// script loader. To fix this, wait for the scripts to load,
// initialize them manually and wait until they are ready
- if (typeof(jsmolcalc) != 'undefined' && jsmolcalc)
- {
+ if (typeof(jsmolcalc) !== 'undefined' && jsmolcalc) {
jsmolcalc.onInjectionDone('jsmolcalc');
}
- if (typeof(jsme) != 'undefined' && jsme)
- {
+ if (typeof(jsme) !== 'undefined' && jsme) {
// dummy function called by jsme
window.jsmeOnLoad = function() {};
jsme.onInjectionDone('jsme');
}
// jsmol is defined my jsmolcalc and JavaScriptApplet is defined by jsme
- if (typeof(jsmol) != 'undefined' && typeof(JavaScriptApplet) != 'undefined') {
+ if (typeof(jsmol) !== 'undefined' && typeof(JavaScriptApplet) !== 'undefined') {
// ready, initialize applets
initializeApplets();
_editamolecule_loaded = false; // for reloading when checking is pressed
@@ -66,15 +64,15 @@
}
function initializeApplets() {
- var applets = $('.editamoleculeinput div.applet');
- applets.each(function(i, element) {
+ var $applets = $('.editamoleculeinput div.applet');
+ $applets.each(function(i, element) {
if (!$(element).hasClass('loaded')) {
var applet = new JavaScriptApplet.JSME(
element.id,
$(element).width(),
$(element).height(),
{
- 'options': 'query, hydrogens'
+ options: 'query, hydrogens'
});
$(element).addClass('loaded');
configureApplet(element, applet);
@@ -95,7 +93,7 @@
// Load initial data
var value = input_field.val();
if (value) {
- var data = JSON.parse(value)['mol'];
+ var data = JSON.parse(value).mol;
loadAppletData(applet, data, input_field);
} else {
requestAppletData(element, applet, input_field);
@@ -173,7 +171,7 @@
function updateMessages(message_field, values) {
- var error = values['error'];
+ var error = values.error;
if (error) {
message_field.html(error).show();
} else {
diff --git a/common/static/js/capa/schematicinput.js b/common/static/js/capa/schematicinput.js
index 6afd18220d..3d1026c11d 100644
--- a/common/static/js/capa/schematicinput.js
+++ b/common/static/js/capa/schematicinput.js
@@ -27,8 +27,7 @@ $(function() {
var circuit_so_far = $(editingCircuit).val();
var n = editorCircuit.schematic.components.length;
- for (var i = 0; i < n; i++)
- editorCircuit.schematic.components[n - 1 - i].remove();
+ for (var i = 0; i < n; i++) { editorCircuit.schematic.components[n - 1 - i].remove(); }
editorCircuit.schematic.load_schematic(circuit_so_far, '');
editorCircuit.schematic.zoomall();
@@ -40,8 +39,7 @@ $(function() {
var saving_circuit = $(editorCircuit).val();
var n = editingCircuit.schematic.components.length;
- for (var i = 0; i < n; i++)
- editingCircuit.schematic.components[n - 1 - i].remove();
+ for (var i = 0; i < n; i++) { editingCircuit.schematic.components[n - 1 - i].remove(); }
editingCircuit.schematic.load_schematic(saving_circuit, '');
editingCircuit.schematic.zoomall();
diff --git a/common/static/js/capa/spec/formula_equation_preview_spec.js b/common/static/js/capa/spec/formula_equation_preview_spec.js
index 71e4831609..ad0a903e03 100644
--- a/common/static/js/capa/spec/formula_equation_preview_spec.js
+++ b/common/static/js/capa/spec/formula_equation_preview_spec.js
@@ -54,7 +54,7 @@ describe('Formula Equation Preview', function() {
window.MathJax.Hub.getAllJax = jasmine.createSpy('MathJax.Hub.getAllJax')
.and.returnValue([this.jax]);
window.MathJax.Hub.Queue = function(callback) {
- if (typeof (callback) == 'function') {
+ if (typeof (callback) === 'function') {
callback();
}
};
@@ -73,11 +73,11 @@ describe('Formula Equation Preview', function() {
var legitInput = this.$fixture[0].getElementsByTagName('input')[0];
// Use the (modified) jQuery.
- var jqueryInput = $('.formulaequationinput input');
- var byIdInput = $('#input_THE_ID');
+ var $jqueryInput = $('.formulaequationinput input');
+ var $byIdInput = $('#input_THE_ID');
- expect(jqueryInput[0]).toEqual(legitInput);
- expect(byIdInput[0]).toEqual(legitInput);
+ expect($jqueryInput[0]).toEqual(legitInput);
+ expect($byIdInput[0]).toEqual(legitInput);
});
describe('Ajax requests', function() {
@@ -101,7 +101,7 @@ describe('Formula Equation Preview', function() {
'THE_ID',
'preview_formcalc',
{formula: 'PREFILLED_VALUE',
- request_start: jasmine.any(Number)},
+ request_start: jasmine.any(Number)},
jasmine.any(Function)
]);
});
diff --git a/common/static/js/capa/src/formula_equation_preview.js b/common/static/js/capa/src/formula_equation_preview.js
index 4066161e95..646ba0809c 100644
--- a/common/static/js/capa/src/formula_equation_preview.js
+++ b/common/static/js/capa/src/formula_equation_preview.js
@@ -87,7 +87,7 @@ formulaEquationPreview.enable = function() {
inputData.url,
inputData.inputId,
'preview_formcalc',
- {'formula': formula, 'request_start': now},
+ {formula: formula, request_start: now},
inputData.requestCallback
);
// ).fail(function () {
@@ -95,8 +95,7 @@ formulaEquationPreview.enable = function() {
// // Have an error message and other stuff here?
// inputData.$img.css('visibility', 'hidden');
// });
- }
- else {
+ } else {
inputData.requestCallback({
preview: '',
request_start: now
@@ -113,7 +112,7 @@ formulaEquationPreview.enable = function() {
* -Save which request is visible
*/
function updatePage(inputData, response) {
- var requestStart = response['request_start'];
+ var requestStart = response.request_start;
if (requestStart == inputData.lastSent &&
!inputData.isWaitingForRequest) {
// Disable icon.
diff --git a/common/static/js/capa/src/jschannel.js b/common/static/js/capa/src/jschannel.js
index d3259d666e..b75859ded3 100644
--- a/common/static/js/capa/src/jschannel.js
+++ b/common/static/js/capa/src/jschannel.js
@@ -247,15 +247,14 @@ var Channel = (function() {
if ((s_boundChans['*'] && s_boundChans['*'][scope])) {
exists = hasWin(s_boundChans['*'][scope]);
}
- if (!exists && s_boundChans[origin] && s_boundChans[origin][scope])
- {
+ if (!exists && s_boundChans[origin] && s_boundChans[origin][scope]) {
exists = hasWin(s_boundChans[origin][scope]);
}
}
if (exists) throw "A channel is already bound to the same window which overlaps with origin '" + origin + "' and has scope '" + scope + "'";
- if (typeof s_boundChans[origin] != 'object') s_boundChans[origin] = { };
- if (typeof s_boundChans[origin][scope] != 'object') s_boundChans[origin][scope] = [];
+ if (typeof s_boundChans[origin] !== 'object') s_boundChans[origin] = { };
+ if (typeof s_boundChans[origin][scope] !== 'object') s_boundChans[origin][scope] = [];
s_boundChans[origin][scope].push({win: win, handler: handler});
}
@@ -345,7 +344,7 @@ var Channel = (function() {
}
}
// otherwise it must have an id (or be poorly formed
- else if (typeof i != 'undefined') {
+ else if (typeof i !== 'undefined') {
if (s_transIds[i]) s_transIds[i](o, meth, m);
}
};
@@ -403,7 +402,7 @@ var Channel = (function() {
}
/* basic argument validation */
- if (typeof cfg != 'object') throw ('Channel build invoked without a proper object argument');
+ if (typeof cfg !== 'object') throw ('Channel build invoked without a proper object argument');
if (!cfg.window || !cfg.window.postMessage) throw ('Channel.build() called without a valid window argument');
@@ -418,7 +417,7 @@ var Channel = (function() {
var oMatch;
if (cfg.origin === '*') validOrigin = true;
// allow valid domains under http and https. Also, trim paths off otherwise valid origins.
- else if (null !== (oMatch = cfg.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/))) {
+ else if ((oMatch = cfg.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/)) !== null) {
cfg.origin = oMatch[0].toLowerCase();
validOrigin = true;
}
@@ -438,7 +437,7 @@ var Channel = (function() {
var alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
for (var i = 0; i < 5; i++) text += alpha.charAt(Math.floor(Math.random() * alpha.length));
return text;
- })();
+ }());
// registrations: mapping method names to call objects
var regTbl = { };
@@ -549,7 +548,7 @@ var Channel = (function() {
return function(params) {
return trans.invoke(cbName, params);
};
- })();
+ }());
}
}
var resp = regTbl[method](trans, m.params);
@@ -583,8 +582,7 @@ var Channel = (function() {
message = JSON.stringify(e);
/* On MSIE8, this can result in 'out of memory', which
* leaves message undefined. */
- if (typeof(message) == 'undefined')
- message = e.toString();
+ if (typeof(message) === 'undefined') { message = e.toString(); }
} catch (e2) {
message = e.toString();
}
@@ -594,8 +592,7 @@ var Channel = (function() {
}
}
} else if (m.id && m.callback) {
- if (!outTbl[m.id] || !outTbl[m.id].callbacks || !outTbl[m.id].callbacks[m.callback])
- {
+ if (!outTbl[m.id] || !outTbl[m.id].callbacks || !outTbl[m.id].callbacks[m.callback]) {
debug('ignoring invalid callback, id:' + m.id + ' (' + m.callback + ')');
} else {
// XXX: what if client code raises an exception here?
@@ -744,7 +741,7 @@ var Channel = (function() {
// XXX: This function returns a timeout ID, but we don't do anything with it.
// We might want to keep track of it so we can cancel it using clearTimeout()
// when the transaction completes.
- setTransactionTimeout(s_curTranId, m.timeout, scopeMethod(m.method));
+ { setTransactionTimeout(s_curTranId, m.timeout, scopeMethod(m.method)); }
// insert into the transaction table
outTbl[s_curTranId] = {callbacks: callbacks, error: m.error, success: m.success};
@@ -785,4 +782,4 @@ var Channel = (function() {
return obj;
}
};
-})();
+}());
diff --git a/common/static/js/capa/src/jsinput.js b/common/static/js/capa/src/jsinput.js
index 35c64c5580..8ff7336a30 100644
--- a/common/static/js/capa/src/jsinput.js
+++ b/common/static/js/capa/src/jsinput.js
@@ -145,12 +145,11 @@ var JSInput = (function($, undefined) {
}
if (typeof(jsonValue) === 'object') {
- stateValue = jsonValue['state'];
+ stateValue = jsonValue.state;
} else {
stateValue = jsonValue;
}
- }
- else {
+ } else {
// use initial_state string as the JSON string for stateValue.
stateValue = initialState;
}
@@ -179,8 +178,7 @@ var JSInput = (function($, undefined) {
} catch (err) {
setTimeout(function() { whileloop(n - 1); }, 200);
}
- }
- else {
+ } else {
console.debug('Error: could not set state');
}
}
@@ -220,4 +218,4 @@ var JSInput = (function($, undefined) {
jsinputConstructor: jsinputConstructor,
walkDOM: walkDOM
};
-})(window.jQuery);
+}(window.jQuery));
diff --git a/common/static/js/spec/CSS3_workarounds_spec.js b/common/static/js/spec/CSS3_workarounds_spec.js
index ea4928c24f..4808159fbe 100644
--- a/common/static/js/spec/CSS3_workarounds_spec.js
+++ b/common/static/js/spec/CSS3_workarounds_spec.js
@@ -13,7 +13,7 @@ describe('CSS3 workarounds', function() {
// so that it includes 'pointerEvents'
var mockBodyStyle = document.body.style;
if (!('pointerEvents' in mockBodyStyle)) {
- mockBodyStyle['pointerEvents'] = '';
+ mockBodyStyle.pointerEvents = '';
}
pointerEventsNone('.is-disabled', mockBodyStyle);
diff --git a/common/static/js/spec/accessibility_tools_spec.js b/common/static/js/spec/accessibility_tools_spec.js
index 44b587e99d..db7918fda0 100644
--- a/common/static/js/spec/accessibility_tools_spec.js
+++ b/common/static/js/spec/accessibility_tools_spec.js
@@ -124,5 +124,4 @@ describe('Tests for accessibility_tools.js', function() {
);
});
});
-
});
diff --git a/common/static/js/spec/lang_edx_spec.js b/common/static/js/spec/lang_edx_spec.js
index d7a528895d..16aee329c3 100644
--- a/common/static/js/spec/lang_edx_spec.js
+++ b/common/static/js/spec/lang_edx_spec.js
@@ -2,45 +2,45 @@
(function() {
'use strict';
describe('Language change test for lang-edx.js', function() {
- var lang_selector,
+ var $lang_selector,
deferred;
beforeEach(function() {
loadFixtures('js/fixtures/lang-edx-fixture.html');
- lang_selector = $('#settings-language-value');
+ $lang_selector = $('#settings-language-value');
deferred = $.Deferred();
});
it('can spy on language selector change event', function() {
- spyOnEvent(lang_selector, 'change');
- lang_selector.trigger('change');
- expect('change').toHaveBeenTriggeredOn(lang_selector);
+ spyOnEvent($lang_selector, 'change');
+ $lang_selector.trigger('change');
+ expect('change').toHaveBeenTriggeredOn($lang_selector);
});
it('should make an AJAX request to the correct URL', function() {
spyOn($, 'ajax').and.returnValue(deferred);
Language.init();
- lang_selector.trigger('change');
+ $lang_selector.trigger('change');
expect($.ajax.calls.mostRecent().args[0].url).toEqual('/api/user/v1/preferences/test1/');
});
it('should make an AJAX request with correct type', function() {
spyOn($, 'ajax').and.returnValue(deferred);
Language.init();
- lang_selector.trigger('change');
+ $lang_selector.trigger('change');
expect($.ajax.calls.mostRecent().args[0].type).toEqual('PATCH');
});
it('should make an AJAX request with correct data', function() {
spyOn($, 'ajax').and.returnValue(deferred);
Language.init();
- lang_selector.val('ar');
- lang_selector.trigger('change');
+ $lang_selector.val('ar');
+ $lang_selector.trigger('change');
expect($.ajax.calls.mostRecent().args[0].data).toEqual('{"pref-lang":"ar"}');
// change to 'en' from 'ar'
- lang_selector.val('en');
- lang_selector.trigger('change');
+ $lang_selector.val('en');
+ $lang_selector.trigger('change');
expect($.ajax.calls.mostRecent().args[0].data).toEqual('{"pref-lang":"en"}');
});
@@ -52,7 +52,7 @@
});
Language.init();
spyOn(Language, 'refresh');
- lang_selector.trigger('change');
+ $lang_selector.trigger('change');
expect(Language.refresh).toHaveBeenCalled();
});
});
diff --git a/common/static/js/spec/logger_spec.js b/common/static/js/spec/logger_spec.js
index 89fa2ef799..2939420465 100644
--- a/common/static/js/spec/logger_spec.js
+++ b/common/static/js/spec/logger_spec.js
@@ -40,7 +40,7 @@
});
describe('ajax request settings with path_prefix', function() {
- var meta_tag;
+ var $meta_tag;
beforeEach(function() {
this.initialAjaxWithPrefix = jQuery.ajaxWithPrefix;
@@ -51,13 +51,13 @@
afterEach(function() {
jQuery.ajaxWithPrefix = this.initialAjaxWithPrefix;
- meta_tag.remove();
- meta_tag = null;
+ $meta_tag.remove();
+ $meta_tag = null;
});
it('if path_prefix is not defined', function() {
- meta_tag = $('');
- meta_tag.appendTo('body');
+ $meta_tag = $('');
+ $meta_tag.appendTo('body');
spyOn(jQuery, 'ajax');
Logger.log('example', 'data');
expect(jQuery.ajax).toHaveBeenCalledWith({
@@ -73,8 +73,8 @@
});
it('if path_prefix is defined', function() {
- meta_tag = $('');
- meta_tag.appendTo('body');
+ $meta_tag = $('');
+ $meta_tag.appendTo('body');
spyOn(jQuery, 'ajax');
Logger.log('example', 'data');
expect(jQuery.ajax).toHaveBeenCalledWith({
@@ -90,8 +90,8 @@
});
it('if path_prefix is custom value', function() {
- meta_tag = $('');
- meta_tag.appendTo('body');
+ $meta_tag = $('');
+ $meta_tag.appendTo('body');
spyOn(jQuery, 'ajax');
Logger.log('example', 'data');
expect(jQuery.ajax).toHaveBeenCalledWith({
diff --git a/common/static/js/spec/tooltip_manager_spec.js b/common/static/js/spec/tooltip_manager_spec.js
index 6780d03a2a..6902c56cc7 100644
--- a/common/static/js/spec/tooltip_manager_spec.js
+++ b/common/static/js/spec/tooltip_manager_spec.js
@@ -1,11 +1,15 @@
describe('TooltipManager', function() {
'use strict';
- var PAGE_X = 100, PAGE_Y = 100, WIDTH = 100, HEIGHT = 100, DELTA = 10,
+ var PAGE_X = 100,
+ PAGE_Y = 100,
+ WIDTH = 100,
+ HEIGHT = 100,
+ DELTA = 10,
showTooltip;
beforeEach(function() {
setFixtures(sandbox({
- 'id': 'test-id',
+ id: 'test-id',
'data-tooltip': 'some text here.'
}));
this.element = $('#test-id');
diff --git a/common/static/js/src/accessibility_tools.js b/common/static/js/src/accessibility_tools.js
index a593c65a3e..ea6a4fcd31 100644
--- a/common/static/js/src/accessibility_tools.js
+++ b/common/static/js/src/accessibility_tools.js
@@ -33,7 +33,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVE
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-var focusedElementBeforeModal;
+var $focusedElementBeforeModal;
var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) {
// Modifies a lean modal to optimize focus management.
@@ -50,7 +50,7 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) {
var focusableElementsString = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]';
$(trigger).click(function() {
- focusedElementBeforeModal = $(trigger);
+ $focusedElementBeforeModal = $(trigger);
// when modal is opened, adjust tabindexes and aria-hidden attributes
$(mainPageId).attr('aria-hidden', 'true');
@@ -63,15 +63,15 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) {
$(closeButtonId).focus();
// define the last tabbable element to complete tab cycle
- var last;
+ var $last;
if (focusableItems.length !== 0) {
- last = focusableItems.last();
+ $last = focusableItems.last();
} else {
- last = $(closeButtonId);
+ $last = $(closeButtonId);
}
// tab on last element in modal returns to the first one
- last.on('keydown', function(e) {
+ $last.on('keydown', function(e) {
var keyCode = e.keyCode || e.which;
// 9 is the js keycode for tab
if (!e.shiftKey && keyCode === 9) {
@@ -86,7 +86,7 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) {
// 9 is the js keycode for tab
if (e.shiftKey && keyCode == 9) {
e.preventDefault();
- last.focus();
+ $last.focus();
}
});
@@ -94,7 +94,7 @@ var accessible_modal = function(trigger, closeButtonId, modalId, mainPageId) {
$('#lean_overlay, ' + closeButtonId).click(function() {
$(mainPageId).attr('aria-hidden', 'false');
$(modalId).attr('aria-hidden', 'true');
- focusedElementBeforeModal.focus();
+ $focusedElementBeforeModal.focus();
});
// get modal to exit on escape key
@@ -192,7 +192,7 @@ $(function() {
};
return SRAlert;
- })();
+ }());
window.SR = new SRAlert();
});
diff --git a/common/static/js/src/lang_edx.js b/common/static/js/src/lang_edx.js
index e0111594dd..a5bd7390fe 100644
--- a/common/static/js/src/lang_edx.js
+++ b/common/static/js/src/lang_edx.js
@@ -1,10 +1,10 @@
var Language = (function() {
'use strict';
- var settings_language_selector,
+ var $settings_language_selector,
self = null;
return {
init: function() {
- settings_language_selector = $('#settings-language-value');
+ $settings_language_selector = $('#settings-language-value');
self = this;
this.listenForLanguagePreferenceChange();
},
@@ -14,7 +14,7 @@ var Language = (function() {
* Send an ajax request to save user language preferences.
*/
listenForLanguagePreferenceChange: function() {
- settings_language_selector.change(function(event) {
+ $settings_language_selector.change(function(event) {
var language = this.value,
url = $('.url-endpoint').val(),
is_user_authenticated = JSON.parse($('.url-endpoint').data('user-is-authenticated'));
@@ -61,7 +61,7 @@ var Language = (function() {
}
};
-})();
+}());
$(document).ready(function() {
'use strict';
Language.init();
diff --git a/common/static/js/src/logger.js b/common/static/js/src/logger.js
index 613c289f49..2eb0710148 100644
--- a/common/static/js/src/logger.js
+++ b/common/static/js/src/logger.js
@@ -9,10 +9,10 @@
var request = $.ajaxWithPrefix ? $.ajaxWithPrefix : $.ajax;
options = $.extend(true, {
- 'url': '/event',
- 'type': 'POST',
- 'data': data,
- 'async': true
+ url: '/event',
+ type: 'POST',
+ data: data,
+ async: true
}, options);
return request(options);
};
@@ -57,9 +57,9 @@
}
// Regardless of whether any callbacks were made, log this event.
return sendRequest({
- 'event_type': eventType,
- 'event': JSON.stringify(data),
- 'page': window.location.href
+ event_type: eventType,
+ event: JSON.stringify(data),
+ page: window.location.href
}, requestOptions);
},
diff --git a/common/static/js/src/tooltip_manager.js b/common/static/js/src/tooltip_manager.js
index 5b0a1cf545..4219f40835 100644
--- a/common/static/js/src/tooltip_manager.js
+++ b/common/static/js/src/tooltip_manager.js
@@ -7,7 +7,7 @@
// Otherwise, create new one.
if (!this.tooltip.length) {
this.tooltip = $('', {
- 'class': this.className
+ class: this.className
}).appendTo(this.element);
}
@@ -32,8 +32,8 @@
getCoords: function(pageX, pageY) {
return {
- 'left': pageX - 0.5 * this.tooltip.outerWidth(),
- 'top': pageY - (this.tooltip.outerHeight() + 15)
+ left: pageX - 0.5 * this.tooltip.outerWidth(),
+ top: pageY - (this.tooltip.outerHeight() + 15)
};
},
diff --git a/common/static/js/src/utility.js b/common/static/js/src/utility.js
index e45a90aa94..ec8d8de838 100644
--- a/common/static/js/src/utility.js
+++ b/common/static/js/src/utility.js
@@ -7,15 +7,13 @@ window.isExternal = function(url) {
// if the protocol in the url does not match the protocol in the window's location, this url is considered external
if (typeof match[1] === 'string' &&
match[1].length > 0 &&
- match[1].toLowerCase() !== location.protocol)
- return true;
+ match[1].toLowerCase() !== location.protocol) { return true; }
// match[2] matches the host if one exists in the url
// if the host in the url does not match the host of the window location, this url is considered external
if (typeof match[2] === 'string' &&
match[2].length > 0 &&
// this regex removes the port number if it patches the current location's protocol
- match[2].replace(new RegExp(':(' + {'http:': 80, 'https:': 443}[location.protocol] + ')?$'), '') !== location.host)
- return true;
+ match[2].replace(new RegExp(':(' + {'http:': 80, 'https:': 443}[location.protocol] + ')?$'), '') !== location.host) { return true; }
return false;
};
@@ -28,8 +26,7 @@ window.rewriteStaticLinks = function(content, from, to) {
function replacer(match) {
if (match === from) {
return to;
- }
- else {
+ } else {
return match;
}
}
diff --git a/lms/djangoapps/discussion/static/discussion/js/discussion_router.js b/lms/djangoapps/discussion/static/discussion/js/discussion_router.js
index 4175f49646..46d2950670 100644
--- a/lms/djangoapps/discussion/static/discussion/js/discussion_router.js
+++ b/lms/djangoapps/discussion/static/discussion/js/discussion_router.js
@@ -28,7 +28,6 @@
} else {
this.startHeader = 2; // Start the header levels at H
}
-
},
start: function() {
diff --git a/lms/djangoapps/support/static/support/js/spec/models/enrollment_spec.js b/lms/djangoapps/support/static/support/js/spec/models/enrollment_spec.js
index 9f81994a78..ccd2cb934c 100644
--- a/lms/djangoapps/support/static/support/js/spec/models/enrollment_spec.js
+++ b/lms/djangoapps/support/static/support/js/spec/models/enrollment_spec.js
@@ -18,8 +18,8 @@ define([
it('can save an enrollment to the server and updates itself on success', function() {
var requests = AjaxHelpers.requests(this),
manual_enrollment = {
- 'enrolled_by': 'staff@edx.org',
- 'reason': 'Financial Assistance'
+ enrolled_by: 'staff@edx.org',
+ reason: 'Financial Assistance'
};
enrollment.updateEnrollment('verified', 'Financial Assistance');
AjaxHelpers.expectJsonRequest(requests, 'POST', '/support/enrollment/test-user', {
diff --git a/lms/djangoapps/support/static/support/js/spec/views/certificates_spec.js b/lms/djangoapps/support/static/support/js/spec/views/certificates_spec.js
index 87eee9f3ea..e41a8212a8 100644
--- a/lms/djangoapps/support/static/support/js/spec/views/certificates_spec.js
+++ b/lms/djangoapps/support/static/support/js/spec/views/certificates_spec.js
@@ -10,40 +10,40 @@ define([
REGENERATE_SEARCH_RESULTS = [
{
- 'username': 'student',
- 'status': 'notpassing',
- 'created': '2015-08-05T17:32:25+00:00',
- 'grade': '0.0',
- 'type': 'honor',
- 'course_key': 'course-v1:edX+DemoX+Demo_Course',
- 'download_url': null,
- 'modified': '2015-08-06T19:47:07+00:00',
- 'regenerate': true
+ username: 'student',
+ status: 'notpassing',
+ created: '2015-08-05T17:32:25+00:00',
+ grade: '0.0',
+ type: 'honor',
+ course_key: 'course-v1:edX+DemoX+Demo_Course',
+ download_url: null,
+ modified: '2015-08-06T19:47:07+00:00',
+ regenerate: true
},
{
- 'username': 'student',
- 'status': 'downloadable',
- 'created': '2015-08-05T17:53:33+00:00',
- 'grade': '1.0',
- 'type': 'verified',
- 'course_key': 'edx/test/2015',
- 'download_url': 'http://www.example.com/certificate.pdf',
- 'modified': '2015-08-06T19:47:05+00:00',
- 'regenerate': true
+ username: 'student',
+ status: 'downloadable',
+ created: '2015-08-05T17:53:33+00:00',
+ grade: '1.0',
+ type: 'verified',
+ course_key: 'edx/test/2015',
+ download_url: 'http://www.example.com/certificate.pdf',
+ modified: '2015-08-06T19:47:05+00:00',
+ regenerate: true
}
],
GENERATE_SEARCH_RESULTS = [
{
- 'username': 'student',
- 'status': '',
- 'created': '',
- 'grade': '',
- 'type': '',
- 'course_key': 'edx/test1/2016',
- 'download_url': null,
- 'modified': '',
- 'regenerate': false
+ username: 'student',
+ status: '',
+ created: '',
+ grade: '',
+ type: '',
+ course_key: 'edx/test1/2016',
+ download_url: null,
+ modified: '',
+ regenerate: false
}
],
diff --git a/lms/djangoapps/support/static/support/js/spec/views/enrollment_modal_spec.js b/lms/djangoapps/support/static/support/js/spec/views/enrollment_modal_spec.js
index f942d43764..be9c9972a3 100644
--- a/lms/djangoapps/support/static/support/js/spec/views/enrollment_modal_spec.js
+++ b/lms/djangoapps/support/static/support/js/spec/views/enrollment_modal_spec.js
@@ -80,8 +80,8 @@ define([
reason: 'Financial Assistance'
});
AjaxHelpers.respondWithJson(requests, {
- 'enrolled_by': 'staff@edx.org',
- 'reason': 'Financial Assistance'
+ enrolled_by: 'staff@edx.org',
+ reason: 'Financial Assistance'
});
expect($('.enrollment-change-errors').css('display')).toEqual('none');
});
diff --git a/lms/djangoapps/support/static/support/js/spec/views/enrollment_spec.js b/lms/djangoapps/support/static/support/js/spec/views/enrollment_spec.js
index 83e52d01be..e073d324b6 100644
--- a/lms/djangoapps/support/static/support/js/spec/views/enrollment_spec.js
+++ b/lms/djangoapps/support/static/support/js/spec/views/enrollment_spec.js
@@ -74,6 +74,5 @@ define([
expect($enrollmentResultRow.find('td:nth-child(5)').text())
.toBe('Sep 1, 2017 4:00 PM UTC'); // Verification Deadline
});
-
});
});
diff --git a/lms/djangoapps/support/static/support/js/views/enrollment.js b/lms/djangoapps/support/static/support/js/views/enrollment.js
index 4549c2c3a5..205332b612 100644
--- a/lms/djangoapps/support/static/support/js/views/enrollment.js
+++ b/lms/djangoapps/support/static/support/js/views/enrollment.js
@@ -83,9 +83,9 @@
* learner's enrollment.
*/
changeEnrollment: function(event) {
- var button = $(event.currentTarget),
- course_id = button.data('course_id'),
- modes = button.data('modes').split(','),
+ var $button = $(event.currentTarget),
+ course_id = $button.data('course_id'),
+ modes = $button.data('modes').split(','),
enrollment = this.enrollments.findWhere({course_id: course_id});
event.preventDefault();
new EnrollmentModal({
diff --git a/lms/djangoapps/support/static/support/js/views/enrollment_modal.js b/lms/djangoapps/support/static/support/js/views/enrollment_modal.js
index 4eef9fdc45..40a264cbf2 100644
--- a/lms/djangoapps/support/static/support/js/views/enrollment_modal.js
+++ b/lms/djangoapps/support/static/support/js/views/enrollment_modal.js
@@ -49,8 +49,7 @@
event.preventDefault();
if (!reason) {
this.showErrors(gettext('Please specify a reason.'));
- }
- else {
+ } else {
this.enrollment.updateEnrollment(new_mode, reason).then(
// Success callback
_.bind(function() {
diff --git a/lms/djangoapps/teams/static/teams/js/spec/collections/topic_collection_spec.js b/lms/djangoapps/teams/static/teams/js/spec/collections/topic_collection_spec.js
index f9f23da28d..d396de5bac 100644
--- a/lms/djangoapps/teams/static/teams/js/spec/collections/topic_collection_spec.js
+++ b/lms/djangoapps/teams/static/teams/js/spec/collections/topic_collection_spec.js
@@ -1,5 +1,5 @@
define(['backbone', 'URI', 'underscore', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers',
- 'teams/js/spec_helpers/team_spec_helpers'],
+ 'teams/js/spec_helpers/team_spec_helpers'],
function(Backbone, URI, _, AjaxHelpers, TeamSpecHelpers) {
'use strict';
describe('TopicCollection', function() {
diff --git a/lms/djangoapps/teams/static/teams/js/spec/teams_tab_factory_spec.js b/lms/djangoapps/teams/static/teams/js/spec/teams_tab_factory_spec.js
index cef15771e1..eeac3b6385 100644
--- a/lms/djangoapps/teams/static/teams/js/spec/teams_tab_factory_spec.js
+++ b/lms/djangoapps/teams/static/teams/js/spec/teams_tab_factory_spec.js
@@ -1,5 +1,5 @@
define(['jquery', 'backbone', 'teams/js/teams_tab_factory', 'teams/js/views/teams_tab',
- 'common/js/spec_helpers/page_helpers', 'teams/js/spec_helpers/team_spec_helpers'],
+ 'common/js/spec_helpers/page_helpers', 'teams/js/spec_helpers/team_spec_helpers'],
function($, Backbone, TeamsTabFactory, TeamsTabView, PageHelpers, TeamSpecHelpers) {
'use strict';
diff --git a/lms/djangoapps/teams/static/teams/js/spec/views/edit_team_members_spec.js b/lms/djangoapps/teams/static/teams/js/spec/views/edit_team_members_spec.js
index db9aaf752b..ad68372b76 100644
--- a/lms/djangoapps/teams/static/teams/js/spec/views/edit_team_members_spec.js
+++ b/lms/djangoapps/teams/static/teams/js/spec/views/edit_team_members_spec.js
@@ -14,11 +14,11 @@ define([
var editTeamID = 'av',
DEFAULT_MEMBERSHIP = [
{
- 'user': {
- 'username': 'frodo',
- 'profile_image': {
- 'has_image': true,
- 'image_url_medium': '/frodo-image-url'
+ user: {
+ username: 'frodo',
+ profile_image: {
+ has_image: true,
+ image_url_medium: '/frodo-image-url'
}
},
last_activity_at: '2015-08-21T18:53:01.145Z',
@@ -30,8 +30,7 @@ define([
// Confirm delete dialog
if (confirm) {
$('.action-primary').click();
- }
- else {
+ } else {
$('.action-secondary').click();
}
},
diff --git a/lms/djangoapps/teams/static/teams/js/spec/views/edit_team_spec.js b/lms/djangoapps/teams/static/teams/js/spec/views/edit_team_spec.js
index 44bf25ddfc..20930bae84 100644
--- a/lms/djangoapps/teams/static/teams/js/spec/views/edit_team_spec.js
+++ b/lms/djangoapps/teams/static/teams/js/spec/views/edit_team_spec.js
@@ -204,7 +204,7 @@ define([
AjaxHelpers.respondWithError(
requests,
errorCode,
- {'user_message': 'User message', 'developer_message': 'Developer message'}
+ {user_message: 'User message', developer_message: 'Developer message'}
);
expect(teamEditView.$('.wrapper-msg .copy').text().trim()).toBe('User message');
} else {
diff --git a/lms/djangoapps/teams/static/teams/js/spec/views/instructor_tools_spec.js b/lms/djangoapps/teams/static/teams/js/spec/views/instructor_tools_spec.js
index 59f9fd1618..b866826769 100644
--- a/lms/djangoapps/teams/static/teams/js/spec/views/instructor_tools_spec.js
+++ b/lms/djangoapps/teams/static/teams/js/spec/views/instructor_tools_spec.js
@@ -24,8 +24,7 @@ define([
// Confirm delete dialog
if (confirm) {
$('.action-primary').click();
- }
- else {
+ } else {
$('.action-secondary').click();
}
},
diff --git a/lms/djangoapps/teams/static/teams/js/spec/views/team_card_spec.js b/lms/djangoapps/teams/static/teams/js/spec/views/team_card_spec.js
index f5c322d81a..4902e7f3b7 100644
--- a/lms/djangoapps/teams/static/teams/js/spec/views/team_card_spec.js
+++ b/lms/djangoapps/teams/static/teams/js/spec/views/team_card_spec.js
@@ -1,8 +1,8 @@
define(['jquery',
- 'underscore',
- 'moment',
- 'teams/js/views/team_card',
- 'teams/js/models/team'],
+ 'underscore',
+ 'moment',
+ 'teams/js/views/team_card',
+ 'teams/js/models/team'],
function($, _, moment, TeamCardView, Team) {
'use strict';
diff --git a/lms/djangoapps/teams/static/teams/js/spec/views/team_profile_header_actions_spec.js b/lms/djangoapps/teams/static/teams/js/spec/views/team_profile_header_actions_spec.js
index cb53022cc6..af8a510f46 100644
--- a/lms/djangoapps/teams/static/teams/js/spec/views/team_profile_header_actions_spec.js
+++ b/lms/djangoapps/teams/static/teams/js/spec/views/team_profile_header_actions_spec.js
@@ -49,9 +49,9 @@ define([
createMembershipData = function(username) {
return [
{
- 'user': {
- 'username': username,
- 'url': ACCOUNTS_API_URL + username
+ user: {
+ username: username,
+ url: ACCOUNTS_API_URL + username
}
}
];
@@ -68,7 +68,7 @@ define([
var view = createHeaderActionsView(requests, 1, 'ma', createTeamModelData('teamA', 'teamAlpha', []));
if (joinTeam) {
// if we want the error to return when user try to join team, respond with no membership
- AjaxHelpers.respondWithJson(requests, {'count': 0});
+ AjaxHelpers.respondWithJson(requests, {count: 0});
view.$('.action.action-primary').click();
}
AjaxHelpers.respondWithTextError(requests, 400, errorMessage);
@@ -97,12 +97,12 @@ define([
requests,
'GET',
TeamSpecHelpers.testContext.teamMembershipsUrl + '?' + $.param({
- 'username': currentUsername, 'course_id': TeamSpecHelpers.testCourseID
+ username: currentUsername, course_id: TeamSpecHelpers.testCourseID
})
);
// current user is not a member of any team so we should see the Join Team button
- AjaxHelpers.respondWithJson(requests, {'count': 0});
+ AjaxHelpers.respondWithJson(requests, {count: 0});
expect(view.$('.action.action-primary').length).toEqual(1);
// a post request will be sent to add current user to current team
@@ -111,7 +111,7 @@ define([
requests,
'POST',
TeamSpecHelpers.testContext.teamMembershipsUrl,
- $.param({'username': currentUsername, 'team_id': teamId})
+ $.param({username: currentUsername, team_id: teamId})
);
AjaxHelpers.respondWithJson(requests, {});
@@ -142,12 +142,12 @@ define([
requests,
'GET',
TeamSpecHelpers.testContext.teamMembershipsUrl + '?' + $.param({
- 'username': currentUsername, 'course_id': TeamSpecHelpers.testCourseID
+ username: currentUsername, course_id: TeamSpecHelpers.testCourseID
})
);
// current user is a member of another team so we should see the correct message
- AjaxHelpers.respondWithJson(requests, {'count': 1});
+ AjaxHelpers.respondWithJson(requests, {count: 1});
expect(view.$('.action.action-primary').length).toEqual(0);
expect(view.$('.join-team-message').text().trim()).toBe(view.alreadyMemberMessage);
});
@@ -176,7 +176,7 @@ define([
// verify user_message
verifyErrorMessage(
requests,
- JSON.stringify({'user_message': "Can't be made member"}),
+ JSON.stringify({user_message: "Can't be made member"}),
"Can't be made member",
true
);
@@ -192,7 +192,7 @@ define([
// verify error message when json parsing succeeded but error message format is incorrect
verifyErrorMessage(
requests,
- JSON.stringify({'blah': "Can't be made member"}),
+ JSON.stringify({blah: "Can't be made member"}),
'An error occurred. Try again.',
true
);
@@ -204,7 +204,7 @@ define([
// verify user_message
verifyErrorMessage(
requests,
- JSON.stringify({'user_message': "Can't return user memberships"}),
+ JSON.stringify({user_message: "Can't return user memberships"}),
"Can't return user memberships",
false
);
diff --git a/lms/djangoapps/teams/static/teams/js/spec/views/topic_card_spec.js b/lms/djangoapps/teams/static/teams/js/spec/views/topic_card_spec.js
index 6ab6d35219..91ac3202a8 100644
--- a/lms/djangoapps/teams/static/teams/js/spec/views/topic_card_spec.js
+++ b/lms/djangoapps/teams/static/teams/js/spec/views/topic_card_spec.js
@@ -1,16 +1,16 @@
define(['jquery',
- 'underscore',
- 'teams/js/views/topic_card',
- 'teams/js/models/topic'],
+ 'underscore',
+ 'teams/js/views/topic_card',
+ 'teams/js/models/topic'],
function($, _, TopicCardView, Topic) {
describe('Topic card view', function() {
var createTopicCardView = function() {
return new TopicCardView({
model: new Topic({
- 'id': 'renewables',
- 'name': 'Renewable Energy',
- 'description': 'Explore how changes in <ⓡⓔⓝⓔⓦⓐⓑⓛⓔ> ʎƃɹǝuǝ will affect our lives.',
- 'team_count': 34
+ id: 'renewables',
+ name: 'Renewable Energy',
+ description: 'Explore how changes in <ⓡⓔⓝⓔⓦⓐⓑⓛⓔ> ʎƃɹǝuǝ will affect our lives.',
+ team_count: 34
})
});
};
diff --git a/lms/djangoapps/teams/static/teams/js/spec_helpers/team_spec_helpers.js b/lms/djangoapps/teams/static/teams/js/spec_helpers/team_spec_helpers.js
index bbb9cab28b..da9a4e06cb 100644
--- a/lms/djangoapps/teams/static/teams/js/spec_helpers/team_spec_helpers.js
+++ b/lms/djangoapps/teams/static/teams/js/spec_helpers/team_spec_helpers.js
@@ -151,30 +151,30 @@ define([
];
}
return {
- 'num_pages': 1,
- 'page': 1,
- 'discussion_data': threads,
- 'user_info': {
- 'username': testUser,
- 'follower_ids': [],
- 'default_sort_key': 'date',
- 'downvoted_ids': [],
- 'subscribed_thread_ids': [],
- 'upvoted_ids': [],
- 'external_id': '9',
- 'id': '9',
- 'subscribed_user_ids': [],
- 'subscribed_commentable_ids': []
+ num_pages: 1,
+ page: 1,
+ discussion_data: threads,
+ user_info: {
+ username: testUser,
+ follower_ids: [],
+ default_sort_key: 'date',
+ downvoted_ids: [],
+ subscribed_thread_ids: [],
+ upvoted_ids: [],
+ external_id: '9',
+ id: '9',
+ subscribed_user_ids: [],
+ subscribed_commentable_ids: []
},
- 'annotated_content_info': {
+ annotated_content_info: {
},
- 'roles': {'Moderator': [], 'Administrator': [], 'Community TA': []},
- 'course_settings': {
- 'is_cohorted': false,
- 'allow_anonymous_to_peers': false,
- 'allow_anonymous': true,
- 'category_map': {'subcategories': {}, 'children': [], 'entries': {}},
- 'cohorts': []
+ roles: {Moderator: [], Administrator: [], 'Community TA': []},
+ course_settings: {
+ is_cohorted: false,
+ allow_anonymous_to_peers: false,
+ allow_anonymous: true,
+ category_map: {subcategories: {}, children: [], entries: {}},
+ cohorts: []
}
};
};
@@ -207,7 +207,7 @@ define([
resp_skip: 0,
id: '55c1323c56c02ce921000001',
pinned: false,
- votes: {'count': 0, 'down_count': 0, 'point': 0, 'up_count': 0},
+ votes: {count: 0, down_count: 0, point: 0, up_count: 0},
resp_limit: 25,
abuse_flaggers: [],
closed: false,
@@ -229,10 +229,10 @@ define([
createMockTopicData = function(startIndex, stopIndex) {
return _.map(_.range(startIndex, stopIndex + 1), function(i) {
return {
- 'description': 'Test description ' + i,
- 'name': 'Test Topic ' + i,
- 'id': 'test-topic-' + i,
- 'team_count': 0
+ description: 'Test description ' + i,
+ name: 'Test Topic ' + i,
+ id: 'test-topic-' + i,
+ team_count: 0
};
});
};
diff --git a/lms/djangoapps/teams/static/teams/js/views/edit_team.js b/lms/djangoapps/teams/static/teams/js/views/edit_team.js
index 0af255d4be..686c84d391 100644
--- a/lms/djangoapps/teams/static/teams/js/views/edit_team.js
+++ b/lms/djangoapps/teams/static/teams/js/views/edit_team.js
@@ -2,12 +2,12 @@
'use strict';
define(['backbone',
- 'underscore',
- 'gettext',
- 'js/views/fields',
- 'teams/js/models/team',
- 'common/js/components/utils/view_utils',
- 'text!teams/templates/edit-team.underscore'],
+ 'underscore',
+ 'gettext',
+ 'js/views/fields',
+ 'teams/js/models/team',
+ 'common/js/components/utils/view_utils',
+ 'text!teams/templates/edit-team.underscore'],
function(Backbone, _, gettext, FieldViews, TeamModel, ViewUtils, editTeamTemplate) {
return Backbone.View.extend({
diff --git a/lms/djangoapps/teams/static/teams/js/views/edit_team_members.js b/lms/djangoapps/teams/static/teams/js/views/edit_team_members.js
index 39e8df1dd5..6a79acc44d 100644
--- a/lms/djangoapps/teams/static/teams/js/views/edit_team_members.js
+++ b/lms/djangoapps/teams/static/teams/js/views/edit_team_members.js
@@ -2,14 +2,14 @@
'use strict';
define(['backbone',
- 'jquery',
- 'underscore',
- 'gettext',
- 'teams/js/models/team',
- 'teams/js/views/team_utils',
- 'common/js/components/utils/view_utils',
- 'text!teams/templates/edit-team-member.underscore',
- 'text!teams/templates/date.underscore'
+ 'jquery',
+ 'underscore',
+ 'gettext',
+ 'teams/js/models/team',
+ 'teams/js/views/team_utils',
+ 'common/js/components/utils/view_utils',
+ 'text!teams/templates/edit-team-member.underscore',
+ 'text!teams/templates/date.underscore'
],
function(Backbone, $, _, gettext, TeamModel, TeamUtils, ViewUtils, editTeamMemberTemplate, dateTemplate) {
return Backbone.View.extend({
@@ -36,8 +36,7 @@
render: function() {
if (this.model.get('membership').length === 0) {
this.$el.html('' + gettext('This team does not have any members.') + '
');
- }
- else {
+ } else {
this.$el.html('');
this.renderTeamMembers();
}
@@ -45,7 +44,8 @@
},
renderTeamMembers: function() {
- var self = this, dateJoined, lastActivity;
+ var self = this,
+ dateJoined, lastActivity;
_.each(this.model.get('membership'), function(membership) {
dateJoined = interpolate(
@@ -75,7 +75,8 @@
},
removeMember: function(event) {
- var self = this, username = $(event.currentTarget).data('username');
+ var self = this,
+ username = $(event.currentTarget).data('username');
event.preventDefault();
ViewUtils.confirmThenRunOperation(
diff --git a/lms/djangoapps/teams/static/teams/js/views/instructor_tools.js b/lms/djangoapps/teams/static/teams/js/views/instructor_tools.js
index 5d8e21a20f..002db500b7 100644
--- a/lms/djangoapps/teams/static/teams/js/views/instructor_tools.js
+++ b/lms/djangoapps/teams/static/teams/js/views/instructor_tools.js
@@ -2,12 +2,12 @@
'use strict';
define(['backbone',
- 'underscore',
- 'gettext',
- 'edx-ui-toolkit/js/utils/string-utils',
- 'teams/js/views/team_utils',
- 'common/js/components/utils/view_utils',
- 'text!teams/templates/instructor-tools.underscore'],
+ 'underscore',
+ 'gettext',
+ 'edx-ui-toolkit/js/utils/string-utils',
+ 'teams/js/views/team_utils',
+ 'common/js/components/utils/view_utils',
+ 'text!teams/templates/instructor-tools.underscore'],
function(Backbone, _, gettext, StringUtils, TeamUtils, ViewUtils, instructorToolbarTemplate) {
return Backbone.View.extend({
diff --git a/lms/djangoapps/teams/static/teams/js/views/team_profile_header_actions.js b/lms/djangoapps/teams/static/teams/js/views/team_profile_header_actions.js
index d5f5bc32fd..c2107858d3 100644
--- a/lms/djangoapps/teams/static/teams/js/views/team_profile_header_actions.js
+++ b/lms/djangoapps/teams/static/teams/js/views/team_profile_header_actions.js
@@ -2,11 +2,11 @@
'use strict';
define(['backbone',
- 'jquery',
- 'underscore',
- 'gettext',
- 'teams/js/views/team_utils',
- 'text!teams/templates/team-profile-header-actions.underscore'],
+ 'jquery',
+ 'underscore',
+ 'gettext',
+ 'teams/js/views/team_utils',
+ 'text!teams/templates/team-profile-header-actions.underscore'],
function(Backbone, $, _, gettext, TeamUtils, teamProfileHeaderActionsTemplate) {
return Backbone.View.extend({
@@ -64,7 +64,7 @@
$.ajax({
type: 'POST',
url: view.context.teamMembershipsUrl,
- data: {'username': view.context.userInfo.username, 'team_id': view.model.get('id')}
+ data: {username: view.context.userInfo.username, team_id: view.model.get('id')}
}).done(function(data) {
view.model.fetch()
.done(function() {
@@ -99,7 +99,7 @@
$.ajax({
type: 'GET',
url: view.context.teamMembershipsUrl,
- data: {'username': username, 'course_id': view.context.courseID}
+ data: {username: username, course_id: view.context.courseID}
}).done(function(data) {
info.alreadyMember = (data.count > 0);
info.memberOfCurrentTeam = false;
diff --git a/lms/djangoapps/teams/static/teams/js/views/team_utils.js b/lms/djangoapps/teams/static/teams/js/views/team_utils.js
index 93d0878dae..49ee02970e 100644
--- a/lms/djangoapps/teams/static/teams/js/views/team_utils.js
+++ b/lms/djangoapps/teams/static/teams/js/views/team_utils.js
@@ -33,8 +33,7 @@
isUserMemberOfTeam: function(memberships, requestUsername) {
return _.isObject(
- _.find(memberships, function(membership)
- {
+ _.find(memberships, function(membership) {
return membership.user.username === requestUsername;
})
);
@@ -45,13 +44,13 @@
},
showMessage: function(message, type) {
- var messageElement = $('#teams-message');
+ var $messageElement = $('#teams-message');
if (_.isUndefined(type)) {
type = 'warning';
}
- messageElement.removeClass('is-hidden').addClass(type);
+ $messageElement.removeClass('is-hidden').addClass(type);
$('.teams-content .msg-content .copy').text(message);
- messageElement.focus();
+ $messageElement.focus();
},
/**
diff --git a/lms/djangoapps/teams/static/teams/js/views/teams_tab.js b/lms/djangoapps/teams/static/teams/js/views/teams_tab.js
index b7de8954b7..7c1cc6072d 100644
--- a/lms/djangoapps/teams/static/teams/js/views/teams_tab.js
+++ b/lms/djangoapps/teams/static/teams/js/views/teams_tab.js
@@ -2,31 +2,31 @@
'use strict';
define(['backbone',
- 'jquery',
- 'underscore',
- 'gettext',
- 'edx-ui-toolkit/js/utils/html-utils',
- 'edx-ui-toolkit/js/utils/string-utils',
- 'common/js/components/views/search_field',
- 'js/components/header/views/header',
- 'js/components/header/models/header',
- 'teams/js/models/topic',
- 'teams/js/collections/topic',
- 'teams/js/models/team',
- 'teams/js/collections/team',
- 'teams/js/collections/my_teams',
- 'teams/js/utils/team_analytics',
- 'teams/js/views/teams_tabbed_view',
- 'teams/js/views/topics',
- 'teams/js/views/team_profile',
- 'teams/js/views/my_teams',
- 'teams/js/views/topic_teams',
- 'teams/js/views/edit_team',
- 'teams/js/views/edit_team_members',
- 'teams/js/views/team_profile_header_actions',
- 'teams/js/views/team_utils',
- 'teams/js/views/instructor_tools',
- 'text!teams/templates/teams_tab.underscore'],
+ 'jquery',
+ 'underscore',
+ 'gettext',
+ 'edx-ui-toolkit/js/utils/html-utils',
+ 'edx-ui-toolkit/js/utils/string-utils',
+ 'common/js/components/views/search_field',
+ 'js/components/header/views/header',
+ 'js/components/header/models/header',
+ 'teams/js/models/topic',
+ 'teams/js/collections/topic',
+ 'teams/js/models/team',
+ 'teams/js/collections/team',
+ 'teams/js/collections/my_teams',
+ 'teams/js/utils/team_analytics',
+ 'teams/js/views/teams_tabbed_view',
+ 'teams/js/views/topics',
+ 'teams/js/views/team_profile',
+ 'teams/js/views/my_teams',
+ 'teams/js/views/topic_teams',
+ 'teams/js/views/edit_team',
+ 'teams/js/views/edit_team_members',
+ 'teams/js/views/team_profile_header_actions',
+ 'teams/js/views/team_utils',
+ 'teams/js/views/instructor_tools',
+ 'text!teams/templates/teams_tab.underscore'],
function(Backbone, $, _, gettext, HtmlUtils, StringUtils, SearchFieldView, HeaderView, HeaderModel,
TopicModel, TopicCollection, TeamModel, TeamCollection, MyTeamsCollection, TeamAnalytics,
TeamsTabbedView, TopicsView, TeamProfileView, MyTeamsView, TopicTeamsView, TeamEditView,
@@ -174,8 +174,7 @@
TeamUtils.showMessage(gettext(
'Your request could not be completed. Reload the page and try again.'
));
- }
- else if (xhr.status === 500) {
+ } else if (xhr.status === 500) {
TeamUtils.showMessage(gettext(
'Your request could not be completed due to a server problem. Reload the page' +
' and try again. If the issue persists, click the Help tab to report the problem.'
@@ -513,7 +512,7 @@
getTopic: function(topicID) {
// Try finding topic in the current page of the
// topicCollection. Otherwise call the topic endpoint.
- var topic = this.topicsCollection.findWhere({'id': topicID}),
+ var topic = this.topicsCollection.findWhere({id: topicID}),
self = this,
deferred = $.Deferred();
if (topic) {
diff --git a/lms/djangoapps/teams/static/teams/js/views/topic_teams.js b/lms/djangoapps/teams/static/teams/js/views/topic_teams.js
index db6d9530b5..b513579379 100644
--- a/lms/djangoapps/teams/static/teams/js/views/topic_teams.js
+++ b/lms/djangoapps/teams/static/teams/js/views/topic_teams.js
@@ -46,10 +46,10 @@
// (e.g. {browse_span_start} for #1) and finish it with {span_end}.
_.escape(gettext("{browse_span_start}Browse teams in other topics{span_end} or {search_span_start}search teams{span_end} in this topic. If you still can't find a team to join, {create_span_start}create a new team in this topic{span_end}.")),
{
- 'browse_span_start': '',
- 'search_span_start': '',
- 'create_span_start': '',
- 'span_end': ''
+ browse_span_start: '',
+ search_span_start: '',
+ create_span_start: '',
+ span_end: ''
}
);
self.$el.append(_.template(teamActionsTemplate)({message: message}));
@@ -64,10 +64,10 @@
},
searchTeams: function(event) {
- var searchField = $('.page-header-search .search-field');
+ var $searchField = $('.page-header-search .search-field');
event.preventDefault();
- searchField.focus();
- searchField.select();
+ $searchField.focus();
+ $searchField.select();
$('html, body').animate({
scrollTop: 0
}, 500);
diff --git a/lms/static/js/Markdown.Converter.js b/lms/static/js/Markdown.Converter.js
index bc272019d5..fc89a74dfe 100644
--- a/lms/static/js/Markdown.Converter.js
+++ b/lms/static/js/Markdown.Converter.js
@@ -1,9 +1,9 @@
var Markdown;
if (typeof exports === 'object' && typeof require === 'function') // we're in a CommonJS (e.g. Node.js) module
- Markdown = exports;
+ {Markdown = exports;}
else
- Markdown = {};
+ {Markdown = {};}
// The following text is included for historical reasons, but should
// be taken with a pinch of salt; it's not all true anymore.
@@ -61,16 +61,16 @@ else
chain: function(hookname, func) {
var original = this[hookname];
if (!original)
- throw new Error('unknown hook ' + hookname);
+ {throw new Error('unknown hook ' + hookname);}
if (original === identity)
- this[hookname] = func;
+ {this[hookname] = func;}
else
- this[hookname] = function(x) { return func(original(x)); };
+ {this[hookname] = function(x) { return func(original(x)); };}
},
set: function(hookname, func) {
if (!this[hookname])
- throw new Error('unknown hook ' + hookname);
+ {throw new Error('unknown hook ' + hookname);}
this[hookname] = func;
},
addNoop: function(hookname) {
@@ -130,7 +130,7 @@ else
// This will only happen if makeHtml on the same converter instance is called from a plugin hook.
// Don't do that.
if (g_urls)
- throw new Error('Recursive call to converter.makeHtml');
+ {throw new Error('Recursive call to converter.makeHtml');}
// Create the private state objects.
g_urls = new SaveHash();
@@ -429,7 +429,7 @@ else
text = _DoItalicsAndBold(text);
// Do hard breaks:
- text = text.replace(/ +\n/g, '
\n');
+ text = text.replace(/ {2}+\n/g, '
\n');
return text;
}
@@ -570,8 +570,7 @@ else
if (g_titles.get(link_id) != undefined) {
title = g_titles.get(link_id);
}
- }
- else {
+ } else {
if (whole_match.search(/\(\s*\)$/m) > -1) {
// Special case for explicit empty url
url = '';
@@ -680,8 +679,7 @@ else
if (g_titles.get(link_id) != undefined) {
title = g_titles.get(link_id);
}
- }
- else {
+ } else {
return whole_match;
}
}
@@ -893,8 +891,7 @@ else
if (contains_double_newline || last_item_had_a_double_newline) {
item = _RunBlockGamut(_Outdent(item), /* doNotUnhash = */true);
- }
- else {
+ } else {
// Recursion for sub-lists:
item = _DoLists(_Outdent(item));
item = item.replace(/\n$/, ''); // chomp(item)
@@ -1090,7 +1087,7 @@ else
function(wholeMatch, m1) {
var pre = m1;
// attacklab: hack around Konqueror 3.5.4 bug:
- pre = pre.replace(/^ /mg, '~0');
+ pre = pre.replace(/^ {2}/mg, '~0');
pre = pre.replace(/~0/g, '');
return pre;
});
@@ -1126,8 +1123,7 @@ else
// if this is an HTML marker, copy it
if (markerRe.test(str)) {
grafsOut.push(str);
- }
- else if (/\S/.test(str)) {
+ } else if (/\S/.test(str)) {
str = _RunSpanGamut(str);
str = str.replace(/^([ \t]*)/g, '');
str += '
';
@@ -1255,7 +1251,7 @@ else
function _Detab(text) {
if (!/\t/.test(text))
- return text;
+ {return text;}
var spaces = [' ', ' ', ' ', ' '],
skew = 0,
@@ -1304,4 +1300,4 @@ else
return '~E' + charCodeToEscape + 'E';
}
}; // end of the Markdown.Converter constructor
-})();
+}());
diff --git a/lms/static/js/Markdown.Editor.js b/lms/static/js/Markdown.Editor.js
index 945aa87575..fc98d79435 100644
--- a/lms/static/js/Markdown.Editor.js
+++ b/lms/static/js/Markdown.Editor.js
@@ -80,8 +80,7 @@
panels;
this.run = function() {
- if (panels)
- return; // already initialized
+ if (panels) { return; } // already initialized
panels = new PanelCollection(idPostfix);
var commandManager = new CommandManager(hooks);
@@ -92,7 +91,7 @@
undoManager = new UndoManager(function() {
previewManager.refresh();
if (uiManager) // not available on the first call
- uiManager.setUndoRedoButtonStates();
+ { uiManager.setUndoRedoButtonStates(); }
}, panels);
this.textOperation = function(f) {
undoManager.setCommandMode();
@@ -162,7 +161,8 @@
//
// If remove is true, the whitespace disappears.
Chunks.prototype.trimWhitespace = function(remove) {
- var beforeReplacer, afterReplacer, that = this;
+ var beforeReplacer, afterReplacer,
+ that = this;
if (remove) {
beforeReplacer = afterReplacer = '';
} else {
@@ -268,10 +268,9 @@
if (window.getComputedStyle) {
// Most browsers
return window.getComputedStyle(elem, null).getPropertyValue('display') !== 'none';
- }
- else if (elem.currentStyle) {
+ } else if (elem.currentStyle) {
// IE
- return elem.currentStyle['display'] !== 'none';
+ return elem.currentStyle.display !== 'none';
}
};
@@ -282,8 +281,7 @@
if (elem.attachEvent) {
// IE only. The "on" is mandatory.
elem.attachEvent('on' + event, listener);
- }
- else {
+ } else {
// Other browsers.
elem.addEventListener(event, listener, false);
}
@@ -296,8 +294,7 @@
if (elem.detachEvent) {
// IE only. The "on" is mandatory.
elem.detachEvent('on' + event, listener);
- }
- else {
+ } else {
// Other browsers.
elem.removeEventListener(event, listener, false);
}
@@ -371,12 +368,10 @@
if (self.innerHeight && self.scrollMaxY) {
scrollWidth = doc.body.scrollWidth;
scrollHeight = self.innerHeight + self.scrollMaxY;
- }
- else if (doc.body.scrollHeight > doc.body.offsetHeight) {
+ } else if (doc.body.scrollHeight > doc.body.offsetHeight) {
scrollWidth = doc.body.scrollWidth;
scrollHeight = doc.body.scrollHeight;
- }
- else {
+ } else {
scrollWidth = doc.body.offsetWidth;
scrollHeight = doc.body.offsetHeight;
}
@@ -385,13 +380,11 @@
// Non-IE browser
innerWidth = self.innerWidth;
innerHeight = self.innerHeight;
- }
- else if (doc.documentElement && doc.documentElement.clientHeight) {
+ } else if (doc.documentElement && doc.documentElement.clientHeight) {
// Some versions of IE (IE 6 w/ a DOCTYPE declaration)
innerWidth = doc.documentElement.clientWidth;
innerHeight = doc.documentElement.clientHeight;
- }
- else if (doc.body) {
+ } else if (doc.body) {
// Other versions of IE
innerWidth = doc.body.clientWidth;
innerHeight = doc.body.clientHeight;
@@ -424,8 +417,7 @@
if (!uaSniffed.isIE || mode != 'moving') {
timer = setTimeout(refreshState, 1);
- }
- else {
+ } else {
inputStateObj = null;
}
};
@@ -459,8 +451,7 @@
// What about setting state -1 to null or checking for undefined?
lastState.restore();
lastState = null;
- }
- else {
+ } else {
undoStack[stackPtr] = new TextareaState(panels);
undoStack[--stackPtr].restore();
@@ -534,8 +525,7 @@
case 'z':
if (!event.shiftKey) {
undoObj.undo();
- }
- else {
+ } else {
undoObj.redo();
}
handled = true;
@@ -563,22 +553,18 @@
// 33 - 40: page up/dn and arrow keys
// 63232 - 63235: page up/dn and arrow keys on safari
setMode('moving');
- }
- else if (keyCode == 8 || keyCode == 46 || keyCode == 127) {
+ } else if (keyCode == 8 || keyCode == 46 || keyCode == 127) {
// 8: backspace
// 46: delete
// 127: delete
setMode('deleting');
- }
- else if (keyCode == 13) {
+ } else if (keyCode == 13) {
// 13: Enter
setMode('newlines');
- }
- else if (keyCode == 27) {
+ } else if (keyCode == 27) {
// 27: escape
setMode('escape');
- }
- else if ((keyCode < 16 || keyCode > 20) && keyCode != 91) {
+ } else if ((keyCode < 16 || keyCode > 20) && keyCode != 91) {
// 16-20 are shift, etc.
// 91: left window key
// I think this might be a little messed up since there are
@@ -661,8 +647,7 @@
inputArea.selectionStart = stateObj.start;
inputArea.selectionEnd = stateObj.end;
inputArea.scrollTop = stateObj.scrollTop;
- }
- else if (doc.selection) {
+ } else if (doc.selection) {
if (doc.activeElement && doc.activeElement !== inputArea) {
return;
}
@@ -681,8 +666,7 @@
if (!panels.ieCachedRange && (inputArea.selectionStart || inputArea.selectionStart === 0)) {
stateObj.start = inputArea.selectionStart;
stateObj.end = inputArea.selectionEnd;
- }
- else if (doc.selection) {
+ } else if (doc.selection) {
stateObj.text = util.fixEolChars(inputArea.value);
// IE loses the selection in the textarea when buttons are
@@ -713,8 +697,7 @@
range.text = fixedRange;
}
- if (panels.ieCachedRange)
- stateObj.scrollTop = panels.ieCachedScrollTop; // this is set alongside with ieCachedRange
+ if (panels.ieCachedRange) { stateObj.scrollTop = panels.ieCachedScrollTop; } // this is set alongside with ieCachedRange
panels.ieCachedRange = null;
@@ -780,12 +763,10 @@
if (window.innerHeight) {
result = window.pageYOffset;
- }
- else
+ } else
if (doc.documentElement && doc.documentElement.scrollTop) {
result = doc.documentElement.scrollTop;
- }
- else
+ } else
if (doc.body) {
result = doc.body.scrollTop;
}
@@ -796,15 +777,13 @@
var makePreviewHtml = function() {
// If there is no registered preview panel
// there is nothing to do.
- if (!panels.preview)
- return;
+ if (!panels.preview) { return; }
var text = panels.input.value;
if (text && text == oldInputText) {
return; // Input text hasn't changed.
- }
- else {
+ } else {
oldInputText = text;
}
@@ -858,8 +837,7 @@
if (requiresRefresh) {
oldInputText = '';
makePreviewHtml();
- }
- else {
+ } else {
applyTimeout();
}
};
@@ -879,10 +857,7 @@
var sibling = preview.nextSibling;
parent.removeChild(preview);
preview.innerHTML = text;
- if (!sibling)
- parent.appendChild(preview);
- else
- parent.insertBefore(preview, sibling);
+ if (!sibling) { parent.appendChild(preview); } else { parent.insertBefore(preview, sibling); }
};
var nonSuckyBrowserPreviewSet = function(text) {
@@ -892,8 +867,7 @@
var previewSetter;
var previewSet = function(text) {
- if (previewSetter)
- return previewSetter(text);
+ if (previewSetter) { return previewSetter(text); }
try {
nonSuckyBrowserPreviewSet(text);
@@ -924,8 +898,7 @@
setTimeout(function() {
window.scrollBy(0, fullTop - emptyTop);
}, 0);
- }
- else {
+ } else {
window.scrollBy(0, fullTop - emptyTop);
}
};
@@ -959,8 +932,7 @@
if (uaSniffed.isIE) {
style.filter = 'alpha(opacity=50)';
- }
- else {
+ } else {
style.opacity = '0.5';
}
@@ -970,8 +942,7 @@
if (uaSniffed.isIE) {
style.left = doc.documentElement.scrollLeft;
style.width = doc.documentElement.clientWidth;
- }
- else {
+ } else {
style.left = '0';
style.width = '100%';
}
@@ -1038,8 +1009,7 @@
if (isCancel) {
url = null;
- }
- else {
+ } else {
// Fixes common pasting errors.
url = url.replace(/^http:\/\/(https?|ftp):\/\//, '$1://');
// doesn't change url if started with '/' (local)
@@ -1075,7 +1045,7 @@
// Translators: 'errorCount' is the number of errors found in the form.
'%(errorCount)s error found in form.', '%(errorCount)s errors found in form.',
errorCount
- ), {'errorCount': errorCount}, true
+ ), {errorCount: errorCount}, true
),
!isValidUrl ? urlErrorMsg.textContent : '',
!isValidDesc ? descErrorMsg.textContent : ''
@@ -1191,8 +1161,7 @@
if (urlInput.selectionStart !== undefined) {
urlInput.selectionStart = 0;
urlInput.selectionEnd = defTextLen;
- }
- else if (urlInput.createTextRange) {
+ } else if (urlInput.createTextRange) {
var range = urlInput.createTextRange();
range.collapse(false);
range.moveStart('character', -defTextLen);
@@ -1258,8 +1227,7 @@
case 'z':
if (key.shiftKey) {
doClick(buttons.redo);
- }
- else {
+ } else {
doClick(buttons.undo);
}
break;
@@ -1412,8 +1380,7 @@
// It should become a separate commit applied to WMD's official HEAD if we remove this edited version
// of WMD from Git and install it from NPM / a maintained public fork.
button.removeAttribute('aria-disabled');
- }
- else {
+ } else {
image.style.backgroundPosition = button.XShift + ' ' + disabledYShift;
button.onmouseover = button.onmouseout = button.onclick = function() { };
// This line does not appear in vanilla WMD. It was added by edX to improve accessibility.
@@ -1424,8 +1391,7 @@
}
function bindCommand(method) {
- if (typeof method === 'string')
- method = commandManager[method];
+ if (typeof method === 'string') { method = commandManager[method]; }
return function() { method.apply(commandManager, arguments); };
}
@@ -1453,8 +1419,7 @@
button.appendChild(buttonImage);
button.title = title;
button.XShift = XShift;
- if (textOp)
- button.textOp = textOp;
+ if (textOp) { button.textOp = textOp; }
setupButton(button, true);
buttonRow.appendChild(button);
return button;
@@ -1586,16 +1551,14 @@
if ((prevStars >= nStars) && (prevStars != 2 || nStars != 1)) {
chunk.before = chunk.before.replace(re('[*]{' + nStars + '}$', ''), '');
chunk.after = chunk.after.replace(re('^[*]{' + nStars + '}', ''), '');
- }
- else if (!chunk.selection && starsAfter) {
+ } else if (!chunk.selection && starsAfter) {
// It's not really clear why this code is necessary. It just moves
// some arbitrary stuff around.
chunk.after = chunk.after.replace(/^([*_]*)/, '');
chunk.before = chunk.before.replace(/(\s?)$/, '');
var whitespace = re.$1;
chunk.before = chunk.before + starsAfter + whitespace;
- }
- else {
+ } else {
// In most cases, if you don't have any selected text and click the button
// you'll get a selected, marked up region with the default text inserted.
if (!chunk.selection && !starsAfter) {
@@ -1661,8 +1624,7 @@
if (linkDef) {
addDefNumber(linkDef);
- }
- else {
+ } else {
chunk.selection = chunk.selection.replace(regex, getLink);
}
@@ -1710,9 +1672,8 @@
if (chunk.endTag.length > 1 && chunk.startTag.length > 0) {
chunk.startTag = chunk.startTag.replace(/!?\[/, '');
chunk.endTag = '';
- this.addLinkDef(chunk, null);
- }
- else {
+ this.addLinkDef(chunk, null);
+ } else {
// We're moving start and end tag back into the selection, since (as we're in the else block) we're not
// *removing* a link, but *adding* one, so whatever findTags() found is now back to being part of the
// link text. linkEnteredCallback takes care of escaping any brackets.
@@ -1758,10 +1719,9 @@
if (!chunk.selection) {
if (isImage) {
- chunk.selection = description ? description : '';
- }
- else {
- chunk.selection = description ? description : gettext('enter link description here');
+ chunk.selection = description || '';
+ } else {
+ chunk.selection = description || gettext('enter link description here');
}
}
}
@@ -1787,8 +1747,7 @@
imageUploadHandler
);
}
- }
- else {
+ } else {
ui.prompt(
linkDialogText,
urlLabel,
@@ -1910,7 +1869,7 @@
if (/^>/.test(line)) { // a)
good = true;
if (!inChain && line.length > 1) // c) any line that starts with ">" and has at least one more character starts the chain
- inChain = true;
+ { inChain = true; }
} else if (/^[ \t]*$/.test(line)) { // b)
good = true;
} else {
@@ -2020,20 +1979,15 @@
if (!chunk.selection) {
chunk.startTag = ' ';
chunk.selection = gettext('enter code here');
- }
- else {
+ } else {
if (/^[ ]{0,3}\S/m.test(chunk.selection)) {
- if (/\n/.test(chunk.selection))
- chunk.selection = chunk.selection.replace(/^/gm, ' ');
- else // if it's not multiline, do not select the four added spaces; this is more consistent with the doList behavior
- chunk.before += ' ';
- }
- else {
+ if (/\n/.test(chunk.selection)) { chunk.selection = chunk.selection.replace(/^/gm, ' '); } else // if it's not multiline, do not select the four added spaces; this is more consistent with the doList behavior
+ { chunk.before += ' '; }
+ } else {
chunk.selection = chunk.selection.replace(/^[ ]{4}/gm, '');
}
}
- }
- else {
+ } else {
// Use backticks (`) to delimit the code block.
chunk.trimWhitespace();
@@ -2044,12 +1998,10 @@
if (!chunk.selection) {
chunk.selection = gettext('enter code here');
}
- }
- else if (chunk.endTag && !chunk.startTag) {
+ } else if (chunk.endTag && !chunk.startTag) {
chunk.before += chunk.endTag;
chunk.endTag = '';
- }
- else {
+ } else {
chunk.startTag = chunk.endTag = '';
}
}
@@ -2075,8 +2027,7 @@
if (isNumberedList) {
prefix = ' ' + num + '. ';
num++;
- }
- else {
+ } else {
prefix = ' ' + bullet + ' ';
}
return prefix;
@@ -2215,5 +2166,5 @@
chunk.startTag = '----------\n';
chunk.selection = '';
chunk.skipLines(2, 1, true);
- };
-})();
+ };
+}());
diff --git a/lms/static/js/Markdown.Sanitizer.js b/lms/static/js/Markdown.Sanitizer.js
index 221673eb59..ea4cf7d52b 100644
--- a/lms/static/js/Markdown.Sanitizer.js
+++ b/lms/static/js/Markdown.Sanitizer.js
@@ -28,10 +28,7 @@
var img_white = /^(
]*")?(\stitle="[^"<>]*")?\s?\/?>)$/i;
function sanitizeTag(tag) {
- if (tag.match(basic_tag_whitelist) || tag.match(a_white) || tag.match(img_white))
- return tag;
- else
- return '';
+ if (tag.match(basic_tag_whitelist) || tag.match(a_white) || tag.match(img_white)) { return tag; } else { return ''; }
}
// /
@@ -43,8 +40,7 @@
// / adapted from CODESNIPPET: A8591DBA-D1D3-11DE-947C-BA5556D89593
// /
function balanceTags(html) {
- if (html == '')
- return '';
+ if (html == '') { return ''; }
var re = /<\/?\w+[^>]*(\s|$|>)/g;
// convert everything to lower case; this makes
@@ -53,8 +49,7 @@
// no HTML tags present? nothing to do; exit now
var tagcount = (tags || []).length;
- if (tagcount == 0)
- return html;
+ if (tagcount == 0) { return html; }
var tagname, tag;
var ignoredtags = '![]()
';
@@ -68,8 +63,7 @@
tagname = tags[ctag].replace(/<\/?(\w+).*/, '$1');
// skip any already paired tags
// and skip tags in our ignore list; assume they're self-closed
- if (tagpaired[ctag] || ignoredtags.search('<' + tagname + '>') > -1)
- continue;
+ if (tagpaired[ctag] || ignoredtags.search('<' + tagname + '>') > -1) { continue; }
tag = tags[ctag];
match = -1;
@@ -85,14 +79,11 @@
}
}
- if (match == -1)
- needsRemoval = tagremove[ctag] = true; // mark for removal
- else
- tagpaired[match] = true; // mark paired
+ if (match == -1) { needsRemoval = tagremove[ctag] = true; } // mark for removal
+ else { tagpaired[match] = true; } // mark paired
}
- if (!needsRemoval)
- return html;
+ if (!needsRemoval) { return html; }
// delete all orphaned tags from the string
@@ -104,4 +95,4 @@
});
return html;
}
-})();
+}());
diff --git a/lms/static/js/api_admin/views/catalog_preview.js b/lms/static/js/api_admin/views/catalog_preview.js
index 866d92f37f..4393933528 100644
--- a/lms/static/js/api_admin/views/catalog_preview.js
+++ b/lms/static/js/api_admin/views/catalog_preview.js
@@ -55,8 +55,8 @@
*/
renderCourses: function(data) {
this.$('.preview-results').html(_.template(catalogResultsTpl)({
- 'courses': data.results,
- 'catalogApiUrl': this.catalogApiUrl
+ courses: data.results,
+ catalogApiUrl: this.catalogApiUrl
}));
}
});
diff --git a/lms/static/js/ccx/schedule.js b/lms/static/js/ccx/schedule.js
index 0fd2a75496..a7e4426727 100644
--- a/lms/static/js/ccx/schedule.js
+++ b/lms/static/js/ccx/schedule.js
@@ -235,7 +235,8 @@ var edx = edx || {};
$('#dirty-schedule').show();
$('html, body').animate(
{scrollTop: $('#dirty-schedule').offset().top},
- 'slow', function() { $('#dirty-schedule').focus();
+ 'slow', function() {
+ $('#dirty-schedule').focus();
});
} else {
$('#dirty-schedule').hide();
@@ -247,8 +248,8 @@ var edx = edx || {};
save: function() {
self.schedule_collection.set(self.schedule);
- var button = $('#dirty-schedule #save-changes');
- button.prop('disabled', true).text(gettext('Saving'));
+ var $button = $('#dirty-schedule #save-changes');
+ $button.prop('disabled', true).text(gettext('Saving'));
// save_url defined globally in ccx\schedule.html
/* globals save_url */
$.ajax({
@@ -259,7 +260,7 @@ var edx = edx || {};
success: function(data) {
self.dirty = false;
self.render();
- button.prop('disabled', false).text(gettext('Save changes'));
+ $button.prop('disabled', false).text(gettext('Save changes'));
// Update textarea with grading policy JSON, since grading policy
// may have changed.
@@ -270,7 +271,7 @@ var edx = edx || {};
$('#ajax-error').show().focus();
$('#dirty-schedule').hide();
$('form#add-unit select,input,button').prop('disabled', true);
- button.prop('disabled', false).text(gettext('Save changes'));
+ $button.prop('disabled', false).text(gettext('Save changes'));
}
});
}, // end save
@@ -393,12 +394,12 @@ var edx = edx || {};
expandAll: function() {
$('table.ccx-schedule > tbody > tr').each(function() {
- var row = $(this);
- if (!row.is('.expanded')) {
- var children = self.get_children(row);
- row.find('.ccx_sr_alert').attr('aria-expanded', 'true');
- row.find('.fa-caret-right').removeClass('fa-caret-right').addClass('fa-caret-down');
- row.removeClass('collapsed').addClass('expanded');
+ var $row = $(this);
+ if (!$row.is('.expanded')) {
+ var children = self.get_children($row);
+ $row.find('.ccx_sr_alert').attr('aria-expanded', 'true');
+ $row.find('.fa-caret-right').removeClass('fa-caret-right').addClass('fa-caret-down');
+ $row.removeClass('collapsed').addClass('expanded');
children.filter('.collapsed').each(function() {
children = children.not(self.get_children(this));
});
@@ -409,11 +410,11 @@ var edx = edx || {};
collapseAll: function() {
$('table.ccx-schedule > tbody > tr').each(function() {
- var row = $(this);
- if (row.is('.expanded')) {
- $(row).find('.ccx_sr_alert').attr('aria-expanded', 'false');
- $(row).find('.fa-caret-down').removeClass('fa-caret-down').addClass('fa-caret-right');
- row.removeClass('expanded').addClass('collapsed');
+ var $row = $(this);
+ if ($row.is('.expanded')) {
+ $($row).find('.ccx_sr_alert').attr('aria-expanded', 'false');
+ $($row).find('.fa-caret-down').removeClass('fa-caret-down').addClass('fa-caret-right');
+ $row.removeClass('expanded').addClass('collapsed');
}
});
$('table.ccx-schedule .sequential,.vertical').hide();
@@ -532,4 +533,4 @@ var edx = edx || {};
);
}
});
-})(jQuery, _, Backbone, gettext);
+}(jQuery, _, Backbone, gettext));
diff --git a/lms/static/js/certificates/views/certificate_invalidation_view.js b/lms/static/js/certificates/views/certificate_invalidation_view.js
index 8026226a63..6f8106c942 100644
--- a/lms/static/js/certificates/views/certificate_invalidation_view.js
+++ b/lms/static/js/certificates/views/certificate_invalidation_view.js
@@ -48,8 +48,7 @@
if (this.collection.findWhere({user: user})) {
message = gettext('Certificate of <%= user %> has already been invalidated. Please check your spelling and retry.'); // eslint-disable-line max-len
this.escapeAndShowMessage(_.template(message)({user: user}));
- }
- else if (certificate_invalidation.isValid()) {
+ } else if (certificate_invalidation.isValid()) {
var self = this;
certificate_invalidation.save(null, {
wait: true,
@@ -64,16 +63,14 @@
try {
var response_data = JSON.parse(response.responseText);
self.escapeAndShowMessage(response_data.message);
- }
- catch (exception) {
+ } catch (exception) {
self.escapeAndShowMessage(
gettext('Server Error, Please refresh the page and try again.')
);
}
}
});
- }
- else {
+ } else {
this.escapeAndShowMessage(certificate_invalidation.validationError);
}
},
@@ -94,8 +91,7 @@
try {
var response_data = JSON.parse(response.responseText);
self.escapeAndShowMessage(response_data.message);
- }
- catch (exception) {
+ } catch (exception) {
self.escapeAndShowMessage(
gettext('Server Error, Please refresh the page and try again.')
);
@@ -104,8 +100,7 @@
wait: true,
data: JSON.stringify(model.attributes)
});
- }
- else {
+ } else {
self.escapeAndShowMessage(
gettext('Could not find Certificate Invalidation in the list. Please refresh the page and try again') // eslint-disable-line max-len
);
diff --git a/lms/static/js/certificates/views/certificate_whitelist.js b/lms/static/js/certificates/views/certificate_whitelist.js
index 374a9b7762..d39a9b55b5 100644
--- a/lms/static/js/certificates/views/certificate_whitelist.js
+++ b/lms/static/js/certificates/views/certificate_whitelist.js
@@ -35,8 +35,7 @@
this.$el.html(template({certificates: this.collection.models}));
if (!this.active_certificate || this.collection.isEmpty()) {
this.$('#generate-exception-certificates').attr('disabled', 'disabled');
- }
- else {
+ } else {
this.$('#generate-exception-certificates').removeAttr('disabled');
}
},
@@ -64,8 +63,7 @@
data: JSON.stringify(model.attributes)
}
);
- }
- else {
+ } else {
this.escapeAndShowMessage(
gettext('Could not find Certificate Exception in white list. Please refresh the page and try again') // eslint-disable-line max-len
);
@@ -96,8 +94,7 @@
try {
var response = JSON.parse(xhr.responseText);
caller_object.escapeAndShowMessage(response.message);
- }
- catch (exception) {
+ } catch (exception) {
caller_object.escapeAndShowMessage(
gettext('Server Error, Please refresh the page and try again.')
);
diff --git a/lms/static/js/certificates/views/certificate_whitelist_editor.js b/lms/static/js/certificates/views/certificate_whitelist_editor.js
index 1ab767d8f6..24ca758919 100644
--- a/lms/static/js/certificates/views/certificate_whitelist_editor.js
+++ b/lms/static/js/certificates/views/certificate_whitelist_editor.js
@@ -33,13 +33,14 @@
addException: function() {
var value = this.$('#certificate-exception').val();
var notes = this.$('#notes').val();
- var user_email = '', user_name = '', model = {};
+ var user_email = '',
+ user_name = '',
+ model = {};
if (this.isEmailAddress(value)) {
user_email = value;
model = {user_email: user_email};
- }
- else {
+ } else {
user_name = value;
model = {user_name: user_name};
}
@@ -62,8 +63,7 @@
this.escapeAndShowMessage(
_.template(message)({user: (user_name || user_email)})
);
- }
- else if (certificate_exception.isValid()) {
+ } else if (certificate_exception.isValid()) {
message = gettext('<%= user %> has been successfully added to the exception list. Click Generate Exception Certificate below to send the certificate.'); // eslint-disable-line max-len
certificate_exception.save(
null,
@@ -76,8 +76,7 @@
error: this.showError(this)
}
);
- }
- else {
+ } else {
this.escapeAndShowMessage(certificate_exception.validationError);
}
},
@@ -106,8 +105,7 @@
try {
var response_data = JSON.parse(response.responseText);
caller.escapeAndShowMessage(response_data.message);
- }
- catch (exception) {
+ } catch (exception) {
caller.escapeAndShowMessage(
gettext('Server Error, Please refresh the page and try again.')
);
diff --git a/lms/static/js/commerce/credit.js b/lms/static/js/commerce/credit.js
index 38827b16b5..aaedd25014 100644
--- a/lms/static/js/commerce/credit.js
+++ b/lms/static/js/commerce/credit.js
@@ -19,15 +19,15 @@ var edx = edx || {};
dataType: 'json',
contentType: 'application/json',
data: JSON.stringify({
- 'course_key': courseKey,
- 'username': username
+ course_key: courseKey,
+ username: username
}),
context: this,
success: function(requestData) {
var $form = $('