fix: all auto fixable eslint issues (#31900)

* fix: eslint operator-linebreak issue

* fix: eslint quotes issue

* fix: react jsx indent and props issues

* fix: eslint trailing spaces issues

* fix: eslint line around directives issue

* fix: eslint prefer template issue

* fix: eslint semi rule

* fix: eslint newline per chain rule

* fix: eslint space infix ops rule

* fix: eslint space-in-parens issue

* fix: eslint space before function paren issue

* fix: eslint space before blocks issue

* fix: eslint arrow body style issue

* fix: eslint dot-location issue

* fix: eslint quotes issue

* fix: eslint quote props issue

* fix: eslint operator assignment issue

* fix: eslint new line after import issue

* fix: indent issues

* fix: operator assignment issue
This commit is contained in:
Syed Ali Abbas Zaidi
2023-05-09 11:57:15 +05:00
committed by GitHub
parent 118ea3a024
commit 228180b1ef
354 changed files with 1498 additions and 1489 deletions

View File

@@ -49,7 +49,6 @@
"import/no-dynamic-require": "off",
"import/no-unresolved": "off",
"max-len": "off",
"newline-per-chained-call": "off",
"no-console": "off",
"no-lonely-if": "off",
"no-param-reassign": "off",
@@ -69,11 +68,9 @@
"prefer-arrow-callback": "off",
"prefer-destructuring": "off",
"prefer-rest-params": "off",
"prefer-template": "off",
"radix": "off",
"react/jsx-indent-props": ["error", 4],
"react/prop-types": "off",
"semi": "off",
"vars-on-top": "off"
}
}

View File

@@ -28,7 +28,7 @@
define(name, [], function() { return globalValue; });
}
} else {
console.error('Expected library to be included on page, but not found on window object: ' + name);
console.error(`Expected library to be included on page, but not found on window object: ${name}`);
}
};

View File

@@ -286,7 +286,7 @@
i = 0;
while (i < testFiles.length) {
testFiles[i] = '/base/' + testFiles[i] + '.js';
testFiles[i] = `/base/${testFiles[i]}.js`;
i++;
}

View File

@@ -199,7 +199,7 @@
i = 0;
while (i < testFiles.length) {
testFiles[i] = '/base/' + testFiles[i] + '.js';
testFiles[i] = `/base/${testFiles[i]}.js`;
i++;
}

View File

@@ -12,6 +12,7 @@ import _ from 'underscore';
import str from 'underscore.string';
import HtmlUtils from 'edx-ui-toolkit/js/utils/html-utils';
import StringUtils from 'edx-ui-toolkit/js/utils/string-utils';
window._ = _;
window._.str = str;
window.edx = window.edx || {};

View File

@@ -67,7 +67,7 @@ function(_, Backbone, BackboneRelational, BackboneAssociations, gettext, CoffeeS
// If no url is defined for the signatories child collection we'll need to create that here as well
if (!this.isNew() && !this.get('signatories').url) {
this.get('signatories').url = this.collection.url + '/' + this.get('id') + '/signatories';
this.get('signatories').url = `${this.collection.url}/${this.get('id')}/signatories`;
}
},

View File

@@ -2,8 +2,8 @@
// http://tobyho.com/2012/01/30/write-a-jasmine-matcher/
define(['jquery'], function($) { // eslint-disable-line no-unused-vars
'use strict';
'use strict';
return function() {
jasmine.addMatchers({

View File

@@ -97,7 +97,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
}, this.newModelOptions);
this.collection = new CertificatesCollection([this.model], {
certificateUrl: '/certificates/' + window.course.id
certificateUrl: `/certificates/${window.course.id}`
});
this.model.set('id', 0);
this.view = new CertificateDetailsView({
@@ -121,7 +121,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
describe('The Certificate Details view', function() {
it('should parse a JSON string collection into a Backbone model collection', function() {
var course_title = 'Test certificate course title override 2';
var CERTIFICATE_JSON = '[{"course_title": "' + course_title + '", "signatories":"[]"}]';
var CERTIFICATE_JSON = `[{"course_title": "${course_title}", "signatories":"[]"}]`;
this.collection.parse(CERTIFICATE_JSON);
var model = this.collection.at(1);
expect(model.get('course_title')).toEqual(course_title);

View File

@@ -111,7 +111,7 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
}, this.newModelOptions);
this.collection = new CertificatesCollection([this.model], {
certificateUrl: '/certificates/' + window.course.id
certificateUrl: `/certificates/${window.course.id}`
});
this.model.set('id', 0);
this.view = new CertificateEditorView({
@@ -220,8 +220,8 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
// now delete anyone of the signatory, Add signatory should be enabled.
var signatory = this.model.get('signatories').at(0);
var text = 'Delete "' + signatory.get('name') + '" from the list of signatories?';
clickDeleteItem(this, text, SELECTORS.signatoryDeleteButton + ':first');
var text = `Delete "${signatory.get('name')}" from the list of signatories?`;
clickDeleteItem(this, text, `${SELECTORS.signatoryDeleteButton}:first`);
expect(this.view.$(SELECTORS.addSignatoryButton)).not.toHaveClass('disableClick');
}
);
@@ -273,8 +273,8 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
var signatory_url = '/certificates/signatory';
signatory.url = signatory_url;
spyOn(signatory, 'isNew').and.returnValue(false);
var text = 'Delete "' + signatory.get('name') + '" from the list of signatories?';
clickDeleteItem(this, text, SELECTORS.signatoryDeleteButton + ':first', signatory_url);
var text = `Delete "${signatory.get('name')}" from the list of signatories?`;
clickDeleteItem(this, text, `${SELECTORS.signatoryDeleteButton}:first`, signatory_url);
expect(this.model.get('signatories').length).toEqual(total_signatories - 1);
});
@@ -287,8 +287,8 @@ function(_, Course, CertificateModel, SignatoryModel, CertificatesCollection, Ce
var total_signatories = this.model.get('signatories').length;
var signatory_url = '/certificates/signatory';
signatory.url = signatory_url;
var text = 'Delete "' + signatory.get('name') + '" from the list of signatories?';
showConfirmPromptAndClickCancel(this.view, SELECTORS.signatoryDeleteButton + ':first', text);
var text = `Delete "${signatory.get('name')}" from the list of signatories?`;
showConfirmPromptAndClickCancel(this.view, `${SELECTORS.signatoryDeleteButton}:first`, text);
expect(this.model.get('signatories').length).toEqual(total_signatories);
});

View File

@@ -43,7 +43,7 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
el: $('.preview-certificate'),
course_modes: ['test1', 'test2', 'test3'],
certificate_web_view_url: '/users/1/courses/orgX/009/2016?preview=test1',
certificate_activation_handler_url: '/certificates/activation/' + window.course.id,
certificate_activation_handler_url: `/certificates/activation/${window.course.id}`,
is_active: true
});
appendSetFixtures(this.view.render().el);
@@ -64,16 +64,16 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
it('course mode selection updating the link successfully', function() {
selectDropDownByText(this.view.$(SELECTORS.course_modes), 'test1');
expect(this.view.$(SELECTORS.preview_certificate).attr('href')).
toEqual('/users/1/courses/orgX/009/2016?preview=test1');
expect(this.view.$(SELECTORS.preview_certificate).attr('href'))
.toEqual('/users/1/courses/orgX/009/2016?preview=test1');
selectDropDownByText(this.view.$(SELECTORS.course_modes), 'test2');
expect(this.view.$(SELECTORS.preview_certificate).attr('href')).
toEqual('/users/1/courses/orgX/009/2016?preview=test2');
expect(this.view.$(SELECTORS.preview_certificate).attr('href'))
.toEqual('/users/1/courses/orgX/009/2016?preview=test2');
selectDropDownByText(this.view.$(SELECTORS.course_modes), 'test3');
expect(this.view.$(SELECTORS.preview_certificate).attr('href')).
toEqual('/users/1/courses/orgX/009/2016?preview=test3');
expect(this.view.$(SELECTORS.preview_certificate).attr('href'))
.toEqual('/users/1/courses/orgX/009/2016?preview=test3');
});
it('toggle certificate activation event works fine', function() {
@@ -87,7 +87,7 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
var requests = AjaxHelpers.requests(this),
notificationSpy = ViewHelpers.createNotificationSpy();
this.view.$(SELECTORS.activate_certificate).click();
AjaxHelpers.expectJsonRequest(requests, 'POST', '/certificates/activation/' + window.course.id, {
AjaxHelpers.expectJsonRequest(requests, 'POST', `/certificates/activation/${window.course.id}`, {
is_active: false
});
ViewHelpers.verifyNotificationShowing(notificationSpy, /Deactivating/);
@@ -98,7 +98,7 @@ function(_, $, Course, CertificatePreview, TemplateHelpers, ViewHelpers, AjaxHel
notificationSpy = ViewHelpers.createNotificationSpy();
this.view.is_active = false;
this.view.$(SELECTORS.activate_certificate).click();
AjaxHelpers.expectJsonRequest(requests, 'POST', '/certificates/activation/' + window.course.id, {
AjaxHelpers.expectJsonRequest(requests, 'POST', `/certificates/activation/${window.course.id}`, {
is_active: true
});
ViewHelpers.verifyNotificationShowing(notificationSpy, /Activating/);

View File

@@ -54,7 +54,7 @@ function(_, Course, CertificatesCollection, CertificateModel, CertificateDetails
}, {add: true});
this.collection = new CertificatesCollection([], {
certificateUrl: '/certificates/' + window.course.id
certificateUrl: `/certificates/${window.course.id}`
});
this.model.set('id', 0);
this.view = new CertificatesListView({

View File

@@ -39,7 +39,7 @@ function($, _, Backbone, gettext,
'collection-edit',
'certificates',
'certificate-edit',
'certificate-edit-' + index
`certificate-edit-${index}`
].join(' ');
},

View File

@@ -63,7 +63,7 @@ function(_, gettext, BaseView, ViewUtils, NotificationView, certificateWebPrevie
courseModeChanged: function(event) {
$('.preview-certificate-link').attr('href', function(index, value) {
return value.replace(/preview=([^&]+)/, function() {
return 'preview=' + event.target.options[event.target.selectedIndex].text;
return `preview=${event.target.options[event.target.selectedIndex].text}`;
});
});
},

View File

@@ -32,7 +32,7 @@ function($, _, str, Backbone, gettext, TemplateUtils, ViewUtils, BaseView, Signa
var index = this.model.collection.indexOf(this.model);
return [
'signatory-details',
'signatory-details-view-' + index
`signatory-details-view-${index}`
].join(' ');
},

View File

@@ -35,7 +35,7 @@ function($, _, Backbone, gettext,
var index = this.getModelIndex(this.model);
return [
'signatory-edit',
'signatory-edit-view-' + index
`signatory-edit-view-${index}`
].join(' ');
},
@@ -194,7 +194,7 @@ function($, _, Backbone, gettext,
* @param string modelAttribute - the attribute of the signatory model e.g. name, title.
*/
toggleValidationErrorMessage: function(modelAttribute) {
var selector = 'div.add-signatory-' + modelAttribute;
var selector = `div.add-signatory-${modelAttribute}`;
var errorMessage;
if (!this.model.isValid() && _.has(this.model.validationError, modelAttribute)) {
// Show the error message if it is not exist before.
@@ -206,7 +206,7 @@ function($, _, Backbone, gettext,
} else {
// Remove the error message.
$(selector).removeClass('error');
$(selector + '>span.message-error').remove();
$(`${selector}>span.message-error`).remove();
}
}

View File

@@ -23,4 +23,4 @@ export default function ContainerFactory(componentTemplates, XBlockInfoJson, act
});
};
export {ContainerFactory}
export {ContainerFactory};

View File

@@ -1,3 +1,3 @@
import * as ContextCourse from 'js/models/course';
export {ContextCourse}
export {ContextCourse};

View File

@@ -23,4 +23,4 @@ export default function EditTabsFactory(courseLocation, explicitUrl) {
});
};
export {EditTabsFactory}
export {EditTabsFactory};

View File

@@ -26,4 +26,4 @@ export default function LibraryFactory(componentTemplates, XBlockInfoJson, optio
});
};
export {LibraryFactory}
export {LibraryFactory};

View File

@@ -8,7 +8,7 @@ define([
// highlighting labels when fields are focused in
$('form :input')
.focus(function() {
$('label[for="' + this.id + '"]').addClass('is-focused');
$(`label[for="${this.id}"]`).addClass('is-focused');
})
.blur(function() {
$('label').removeClass('is-focused');
@@ -16,9 +16,9 @@ define([
// Toggle collapsibles when trigger is clicked
$('.collapsible .collapsible-trigger').click(function() {
const contentId = this.id.replace('-trigger', '-content')
$(`#${contentId}`).toggleClass('collapsed')
})
const contentId = this.id.replace('-trigger', '-content');
$(`#${contentId}`).toggleClass('collapsed');
});
model = new CourseDetailsModel();
model.urlRoot = detailsUrl;

View File

@@ -8,7 +8,7 @@ define([
$('form :input')
.focus(function() {
$('label[for="' + this.id + '"]').addClass('is-focused');
$(`label[for="${this.id}"]`).addClass('is-focused');
})
.blur(function() {
$('label').removeClass('is-focused');

View File

@@ -8,7 +8,7 @@ define([
$('form :input')
.focus(function() {
$('label[for="' + this.id + '"]').addClass('is-focused');
$(`label[for="${this.id}"]`).addClass('is-focused');
})
.blur(function() {
$('label').removeClass('is-focused');

View File

@@ -21,4 +21,4 @@ export default function TextbooksFactory(textbooksJson) {
});
};
export {TextbooksFactory}
export {TextbooksFactory};

View File

@@ -18,4 +18,4 @@ export default function XBlockValidationFactory(validationMessages, hasEditingUr
}
};
export {XBlockValidationFactory}
export {XBlockValidationFactory};

View File

@@ -17,10 +17,10 @@ define([
$submitBtn = $('.submit-button'),
$chooseBtn = $('.view-import .choose-file-button'),
defaults = [
gettext('There was an error during the upload process.') + '\n',
gettext('There was an error while unpacking the file.') + '\n',
gettext('There was an error while verifying the file you submitted.') + '\n',
dbError + '\n'
`${gettext('There was an error during the upload process.')}\n`,
`${gettext('There was an error while unpacking the file.')}\n`,
`${gettext('There was an error while verifying the file you submitted.')}\n`,
`${dbError}\n`
],
unloading = false,
previousImport = Import.storedImport(),
@@ -116,7 +116,7 @@ define([
Import.reset();
onComplete();
alert(gettext('Your import has failed.') + '\n\n' + errMsg); // eslint-disable-line max-len, no-alert
alert(`${gettext('Your import has failed.')}\n\n${errMsg}`); // eslint-disable-line max-len, no-alert
}
}
});
@@ -130,7 +130,7 @@ define([
progressall: function(e, data) {
var percentInt = data.loaded / data.total * 100,
percentVal = parseInt(percentInt, 10) + '%',
percentVal = `${parseInt(percentInt, 10)}%`,
doneAt;
// Firefox makes ProgressEvent.loaded equal ProgressEvent.total only
// after receiving a response from the server (see Mozilla bug 637002),

View File

@@ -151,7 +151,7 @@ define(
$dom.successStage
.find('.item-progresspoint-success-date')
.text('(' + date + ' at ' + time + ' UTC)');
.text(`(${date} at ${time} UTC)`);
break;

View File

@@ -89,13 +89,13 @@ function(domReady, $, _, CancelOnEscape, CreateCourseUtilsFactory, CreateLibrary
var makeCancelHandler = function(addType) {
return function(e) {
e.preventDefault();
$('.new-' + addType + '-button').removeClass('is-disabled').attr('aria-disabled', false);
$('.wrapper-create-' + addType).removeClass('is-shown');
$(`.new-${addType}-button`).removeClass('is-disabled').attr('aria-disabled', false);
$(`.wrapper-create-${addType}`).removeClass('is-shown');
// Clear out existing fields and errors
$('#create-' + addType + '-form input[type=text]').val('');
$('#' + addType + '_creation_error').html('');
$('.create-' + addType + ' .wrap-error').removeClass('is-shown');
$('.new-' + addType + '-save').off('click');
$(`#create-${addType}-form input[type=text]`).val('');
$(`#${addType}_creation_error`).html('');
$(`.create-${addType} .wrap-error`).removeClass('is-shown');
$(`.new-${addType}-save`).off('click');
};
};

View File

@@ -22,7 +22,7 @@ function($, _, gettext, ViewUtils, StringUtils, HtmlUtils) {
showError = function(containerElSelector, error) {
var errorWrapperElSelector, errorHtml;
errorWrapperElSelector = containerElSelector + ' .wrapper-error';
errorWrapperElSelector = `${containerElSelector} .wrapper-error`;
errorHtml = HtmlUtils.joinHtml(
HtmlUtils.HTML('<div class="error" aria-live="polite" id="course-id-error">'),
error,

View File

@@ -8,7 +8,7 @@ define(['backbone', 'underscore'], function(Backbone, _) {
urlRoot: '/xblock/',
url: function() {
// add ?fields=graderType to the request url (only needed for fetch, but innocuous for others)
return Backbone.Model.prototype.url.apply(this) + '?' + $.param({fields: 'graderType'});
return `${Backbone.Model.prototype.url.apply(this)}?${$.param({fields: 'graderType'})}`;
}
});
return AssignmentGrade;

View File

@@ -2,7 +2,7 @@ define(['js/models/xblock_info'],
function(XBlockInfo) {
var CustomSyncXBlockInfo = XBlockInfo.extend({
sync: function(method, model, options) {
options.url = (this.urlRoots[method] || this.urlRoot) + '/' + this.get('id');
options.url = `${this.urlRoots[method] || this.urlRoot}/${this.get('id')}`;
return XBlockInfo.prototype.sync.call(this, method, model, options);
}
});

View File

@@ -15,7 +15,7 @@ define([
},
url: function() {
var parentModel = this.collection.parents[0];
return parentModel.urlRoot + '/' + encodeURIComponent(parentModel.id) + '/' + encodeURIComponent(this.id);
return `${parentModel.urlRoot}/${encodeURIComponent(parentModel.id)}/${encodeURIComponent(this.id)}`;
},
reset: function() {

View File

@@ -31,13 +31,13 @@ define(['backbone', 'underscore'], function(Backbone, _) {
if (_.isBoolean(value)) {
return value ? key : null;
} else {
return key + '=' + value;
return `${key}=${value}`;
}
});
// filter out nulls
optionStrings = _.filter(optionStrings, _.identity);
// build license string and return
return type + ': ' + optionStrings.join(' ');
return `${type}: ${optionStrings.join(' ')}`;
},
setFromString: function(string, options) {

View File

@@ -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'),

View File

@@ -153,7 +153,7 @@ function(Backbone, _, gettext, ValidationHelpers, DateUtils, StringUtils) {
},
videosourceSample: function() {
if (this.has('intro_video')) { return '//www.youtube.com/embed/' + this.get('intro_video'); } else { return ''; }
if (this.has('intro_video')) { return `//www.youtube.com/embed/${this.get('intro_video')}`; } else { return ''; }
},
// Whether or not the course pacing can be toggled. If the course

View File

@@ -10,7 +10,7 @@ define(['backbone', 'js/models/location', 'js/collections/course_grader', 'edx-u
grace_period: null, // either null or { hours: n, minutes: m, ...}
minimum_grade_credit: null, // either null or percentage
assignment_count_info: [], // Object with keys mapping assignment type names to a list of
//assignment display names
// assignment display names
},
parse: function(attributes) {
if (attributes.graders) {

View File

@@ -42,7 +42,7 @@ define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
var attrs = this.attributes,
getRegExp = function(formats) {
// Creates regular expression like: /(?:.+)\.(jpg|png|gif)$/i
return RegExp(('(?:.+)\\.(' + formats.join('|') + ')$'), 'i');
return RegExp((`(?:.+)\\.(${formats.join('|')})$`), 'i');
};
return (attrs.mimeTypes.length === 0 && attrs.fileFormats.length === 0)
@@ -57,7 +57,7 @@ define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
if (attrs.mimeTypes.concat(attrs.fileFormats).length === 1) {
return {
fileTypes: this.fileTypes()[0],
fileExtensions: '.' + this.fileTypes()[0].toLowerCase()
fileExtensions: `.${this.fileTypes()[0].toLowerCase()}`
};
}
var or = gettext('or');
@@ -73,7 +73,7 @@ define(['backbone', 'underscore', 'gettext'], function(Backbone, _, gettext) {
fileExtensions: formatTypes(
_.map(this.fileTypes(),
function(type) {
return '.' + type.toLowerCase();
return `.${type.toLowerCase()}`;
})
)
};

View File

@@ -251,7 +251,7 @@ define(
helpers = {};
_.each(categories, function(item) {
helpers['is' + str.titleize(item)] = function() {
helpers[`is${str.titleize(item)}`] = function() {
return this.get('category') === item;
};
}, this);

View File

@@ -4,7 +4,7 @@ import 'jquery.smoothScroll';
'use strict';
var toggleSock = function (e) {
var toggleSock = function(e) {
e.preventDefault();
var $btnShowSockLabel = $(this).find('.copy-show');
@@ -33,9 +33,9 @@ var toggleSock = function (e) {
});
};
domReady(function () {
domReady(function() {
// toggling footer additional support
$('.cta-show-sock').bind('click', toggleSock);
});
export {toggleSock}
export {toggleSock};

View File

@@ -12,7 +12,7 @@ define(
doc.body.innerHTML = iframe_html;
var verify_no_modification = function(src) {
iframe_html = '<iframe width="618" height="350" src="' + src + '" frameborder="0" allowfullscreen></iframe>';
iframe_html = `<iframe width="618" height="350" src="${src}" frameborder="0" allowfullscreen></iframe>`;
doc.body.innerHTML = iframe_html;
IframeBinding.iframeBinding(doc);

View File

@@ -50,7 +50,7 @@ define(
return {
pass: passed,
message: 'Expected ' + actual + (passed ? '' : ' not') + ' to equal ' + expected
message: `Expected ${actual}${passed ? '' : ' not'} to equal ${expected}`
};
}
};
@@ -69,7 +69,7 @@ define(
return {
pass: passed,
message: 'Expected ' + actual + (passed ? '' : ' not') + ' to equal ' + expected
message: `Expected ${actual}${passed ? '' : ' not'} to equal ${expected}`
};
}
};

View File

@@ -181,7 +181,7 @@ define(
});
$.each(metadataDict, function(index, val) {
it('toModels with argument as ' + index, function() {
it(`toModels with argument as ${index}`, function() {
expect(transcripts.toModels(val)).toEqual(models);
});
});

View File

@@ -81,7 +81,7 @@ define(
var elList = ['$form', '$input', '$progress'],
validFileExtensions = ['srt', 'sjson'],
result = $.map(validFileExtensions, function(item, index) {
return '.' + item;
return `.${item}`;
}).join(', ');
view.validFileExtensions = validFileExtensions;
@@ -169,7 +169,7 @@ define(
};
$.each(data, function(fileType, fileInfo) {
it(fileType + ' file type', function() {
it(`${fileType} file type`, function() {
var result = view.checkExtValidity(fileInfo);
expect(result).toBe(fileInfo.isValid);
@@ -190,8 +190,8 @@ define(
spyOn($.fn, 'width').and.callThrough();
view.xhrProgressHandler(null, null, null, percent);
expect(view.$progress.width).toHaveBeenCalledWith(percent + '%');
expect(view.$progress.html()).toBe(percent + '%');
expect(view.$progress.width).toHaveBeenCalledWith(`${percent}%`);
expect(view.$progress.html()).toBe(`${percent}%`);
});
describe('xhrCompleteHandler', function() {

View File

@@ -104,7 +104,7 @@ define(
];
$.each(wrongArgumentLists, function(index, element) {
it(element.argName + ' argument(s) is/are absent', function() {
it(`${element.argName} argument(s) is/are absent`, function() {
var result = Utils.getField.apply(this, element.list);
expect(result).toBeUndefined();
@@ -221,7 +221,7 @@ define(
it('Method: getYoutubeLink', function() {
var videoId = 'video_id',
result = Utils.getYoutubeLink(videoId),
expectedResult = 'http://youtu.be/' + videoId;
expectedResult = `http://youtu.be/${videoId}`;
expect(result).toBe(expectedResult);
});
@@ -263,7 +263,7 @@ define(
describe('Wrong arguments ', function() {
it('youtube videoId is wrong', function() {
var videoId = 'wrong_id',
link = 'http://youtu.be/' + videoId,
link = `http://youtu.be/${videoId}`,
result = Utils.parseLink(link);
expect(result).toEqual({mode: 'incorrect'});

View File

@@ -65,7 +65,7 @@ define(
return {
pass: passed,
message: 'Expected ' + actual + (passed ? '' : ' not') + ' to equal ' + expected
message: `Expected ${actual}${passed ? '' : ' not'} to equal ${expected}`
};
}
};
@@ -83,7 +83,7 @@ define(
return {
pass: passed,
message: 'Expected ' + actual + (passed ? '' : ' not') + ' to equal ' + expected
message: `Expected ${actual}${passed ? '' : ' not'} to equal ${expected}`
};
}
};

View File

@@ -117,7 +117,7 @@ define(
});
makeUploadUrl = function(fileName) {
return 'http://www.example.com/test_url/' + fileName;
return `http://www.example.com/test_url/${fileName}`;
};
getSentRequests = function() {
@@ -222,7 +222,7 @@ define(
fileInfo
]
},
S3Url = 'http://s3.aws.com/upload/videos/' + fileInfo.name,
S3Url = `http://s3.aws.com/upload/videos/${fileInfo.name}`,
requests;
// this is required so that we can use AjaxHelpers ajax mock utils instead of jasmine mock-ajax.js
@@ -356,7 +356,7 @@ define(
{desc: 'smaller than', additionalBytes: -1}
],
function(caseInfo) {
it(caseInfo.desc + 'max file size', function() {
it(`${caseInfo.desc}max file size`, function() {
var maxFileSizeInBytes = this.view.getMaxFileSizeInBytes(),
fileSize = maxFileSizeInBytes + caseInfo.additionalBytes,
fileToUpload = {
@@ -374,7 +374,7 @@ define(
verifyUploadViewInfo(
uploadView,
'Your file could not be uploaded',
'file.mp4 exceeds maximum size of ' + videoUploadMaxFileSizeInGB + ' GB.'
`file.mp4 exceeds maximum size of ${videoUploadMaxFileSizeInGB} GB.`
);
verifyA11YMessage(
StringUtils.interpolate(
@@ -415,10 +415,10 @@ define(
function(caseInfo) {
var fileNames = _.map(
_.range(caseInfo.numFiles),
function(i) { return 'test' + i + '.mp4'; }
function(i) { return `test${i}.mp4`; }
);
describe('on selection of ' + caseInfo.desc, function() {
describe(`on selection of ${caseInfo.desc}`, function() {
beforeEach(function() {
// The files property cannot be set on a file input for
// security reasons, so we must mock the access mechanism
@@ -512,7 +512,7 @@ define(
var refreshDescription = isViewRefresh ? ' (refreshed)' : ' (not refreshed)';
var subCases = [
{
desc: 'completion' + refreshDescription,
desc: `completion${refreshDescription}`,
responseStatus: 204,
statusText: ActiveVideoUpload.STATUS_COMPLETED,
progressValue: 1,
@@ -521,7 +521,7 @@ define(
isViewRefresh: isViewRefresh
},
{
desc: 'failure' + refreshDescription,
desc: `failure${refreshDescription}`,
responseStatus: 500,
statusText: ActiveVideoUpload.STATUS_FAILED,
progressValue: 0,
@@ -533,7 +533,7 @@ define(
_.each(subCases,
function(subCaseInfo) {
describe('and upload ' + subCaseInfo.desc, function() {
describe(`and upload ${subCaseInfo.desc}`, function() {
var refreshSpy = null;
beforeEach(function() {

View File

@@ -276,7 +276,7 @@ function($, AjaxHelpers, URI, AssetsView, AssetCollection, ViewHelpers) {
expect(assetsView).toBeDefined();
var requests = AjaxHelpers.requests(this);
$.each(assetsView.pagingView.filterableColumns, function(columnID, columnData) {
var $typeColumn = $('#' + columnID);
var $typeColumn = $(`#${columnID}`);
assetsView.pagingView.setPage(1);
respondWithMockAssets(requests);
var assetsNumber = assetsView.collection.length;
@@ -292,7 +292,7 @@ function($, AjaxHelpers, URI, AssetsView, AssetCollection, ViewHelpers) {
expect(assetsView).toBeDefined();
setup.call(this, mockExampleAssetsResponse);
$.each(assetsView.pagingView.filterableColumns, function(columnID, columnData) {
var $typeColumn = $('#' + columnID);
var $typeColumn = $(`#${columnID}`);
expect($typeColumn).toBeVisible();
var assetsNumber = $('#asset-table-body .type-col').length;
assetsView.openFilterColumn($typeColumn);
@@ -327,7 +327,7 @@ function($, AjaxHelpers, URI, AssetsView, AssetCollection, ViewHelpers) {
$.each(assetsView.pagingView.filterableColumns, function(columnID, columnData) {
assetsView.pagingView.setPage(1);
respondWithMockAssets(requests);
var $typeColumn = $('#' + columnID);
var $typeColumn = $(`#${columnID}`);
expect($typeColumn).toBeVisible();
var assetsNumber = assetsView.collection.length;
$typeColumn.trigger('click');

View File

@@ -15,7 +15,7 @@ describe('Container View', () => {
verifyRequest, verifyNumReorderCalls, respondToRequest, notificationSpy,
rootLocator = 'locator-container',
containerTestUrl = '/xblock/' + rootLocator,
containerTestUrl = `/xblock/${rootLocator}`,
groupAUrl = '/xblock/locator-group-A',
groupA = 'locator-group-A',
@@ -34,7 +34,7 @@ describe('Container View', () => {
beforeEach(() => {
EditHelpers.installMockXBlock();
EditHelpers.installViewTemplates();
appendSetFixtures('<div class="wrapper-xblock level-page studio-xblock-wrapper" data-locator="' + rootLocator + '"></div>');
appendSetFixtures(`<div class="wrapper-xblock level-page studio-xblock-wrapper" data-locator="${rootLocator}"></div>`);
notificationSpy = EditHelpers.createNotificationSpy();
model = new XBlockInfo({
id: rootLocator,
@@ -80,7 +80,7 @@ describe('Container View', () => {
};
getComponent = function(locator) {
return containerView.$('.studio-xblock-wrapper[data-locator="' + locator + '"]');
return containerView.$(`.studio-xblock-wrapper[data-locator="${locator}"]`);
};
getDragHandle = function(locator) {

View File

@@ -150,10 +150,10 @@ define(
verifyMessage = function(state, message) {
var icon = state === 'error' ? 'fa-info-circle' : 'fa-check-circle';
expect($courseVideoSettingsEl.find('.course-video-settings-message-wrapper.' + state).html()).toEqual(
expect($courseVideoSettingsEl.find(`.course-video-settings-message-wrapper.${state}`).html()).toEqual(
'<div class="course-video-settings-message">'
+ '<span class="icon fa ' + icon + '" aria-hidden="true"></span>'
+ '<span>' + message + '</span>'
+ `<span class="icon fa ${icon}" aria-hidden="true"></span>`
+ `<span>${message}</span>`
+ '</div>'
);
};
@@ -163,7 +163,7 @@ define(
// Check None provider is selected.
expect($transcriptProvidersListEl.find('input[type=radio]:checked').val()).toEqual(selectedProvider.value); // eslint-disable-line max-len
_.each(providers, function(provider, key) {
$transcriptProvidersListEl.find('label[for=transcript-provider-' + key + ']').val(provider.displayName); // eslint-disable-line max-len
$transcriptProvidersListEl.find(`label[for=transcript-provider-${key}]`).val(provider.displayName); // eslint-disable-line max-len
});
};
@@ -219,15 +219,15 @@ define(
};
verifyOrganizationCredentialField = function(fieldName, label) {
var elementSelector = courseVideoSettingsView.selectedProvider + '-' + fieldName;
var elementSelector = `${courseVideoSettingsView.selectedProvider}-${fieldName}`;
// Verify that correct label is shown.
expect(
$courseVideoSettingsEl.find('.' + elementSelector + '-wrapper label .title').html()
$courseVideoSettingsEl.find(`.${elementSelector}-wrapper label .title`).html()
).toEqual(label);
// Verify that credential field is shown.
expect(
$courseVideoSettingsEl.find('.' + elementSelector + '-wrapper .' + elementSelector)
$courseVideoSettingsEl.find(`.${elementSelector}-wrapper .${elementSelector}`)
).toExist();
};
@@ -235,7 +235,7 @@ define(
// Verify that success message is shown.
verifyMessage(
'success',
transcriptionPlans[courseVideoSettingsView.selectedProvider].display_name + ' credentials saved'
`${transcriptionPlans[courseVideoSettingsView.selectedProvider].display_name} credentials saved`
);
// Also verify that transcript credential state is updated.
@@ -253,7 +253,7 @@ define(
if ($courseVideoSettingsEl.find('.selected-transcript-provider').length) {
$courseVideoSettingsEl.find('.selected-transcript-provider .action-change-provider').click();
}
$courseVideoSettingsEl.find('#transcript-provider-' + selectedProvider).click();
$courseVideoSettingsEl.find(`#transcript-provider-${selectedProvider}`).click();
};
resetProvider = function() {
@@ -279,7 +279,7 @@ define(
// Provide organization credentials.
_.each(fieldValues, function(key) {
$courseVideoSettingsEl.find('.' + courseVideoSettingsView.selectedProvider + '-' + key).val(key);
$courseVideoSettingsEl.find(`.${courseVideoSettingsView.selectedProvider}-${key}`).val(key);
});
// Click save organization credentials button to save credentials.
$courseVideoSettingsEl.find('.action-update-org-credentials').click();
@@ -714,8 +714,8 @@ define(
expect($courseVideoSettingsEl.find('.transcription-account-details.warning')).toExist();
// Verify message
expect($courseVideoSettingsEl.find('.transcription-account-details').html()).toEqual(
'<span>This action updates the ' + courseVideoSettingsView.selectedProvider
+ ' information for your entire organization.</span>'
`<span>This action updates the ${courseVideoSettingsView.selectedProvider
} information for your entire organization.</span>`
);
});
@@ -740,12 +740,12 @@ define(
$courseVideoSettingsEl.find('.action-update-org-credentials').click();
verifyPreferanceErrorState(
$courseVideoSettingsEl.find('.' + courseVideoSettingsView.selectedProvider + '-api-key-wrapper'),
$courseVideoSettingsEl.find(`.${courseVideoSettingsView.selectedProvider}-api-key-wrapper`),
true
);
verifyPreferanceErrorState(
$courseVideoSettingsEl.find('.' + courseVideoSettingsView.selectedProvider + '-api-secret-wrapper'),
$courseVideoSettingsEl.find(`.${courseVideoSettingsView.selectedProvider}-api-secret-wrapper`),
true
);
});

View File

@@ -675,9 +675,9 @@ define([
verifyEditingGroup, respondToSave, expectGroupsVisible, correctValidationError;
scopedGroupSelector = function(groupIndex, additionalSelectors) {
var groupSelector = '.partition-groups-list-item-' + groupIndex;
var groupSelector = `.partition-groups-list-item-${groupIndex}`;
if (additionalSelectors) {
return groupSelector + ' ' + additionalSelectors;
return `${groupSelector} ${additionalSelectors}`;
} else {
return groupSelector;
}
@@ -860,7 +860,7 @@ define([
var requests = AjaxHelpers.requests(this),
newGroupName = 'New Group Name',
view = renderView();
editNewGroup(view, {newName: ' ' + newGroupName + ' ', save: true});
editNewGroup(view, {newName: ` ${newGroupName} `, save: true});
respondToSave(requests, view);
expect(view.collection.at(0).get('name')).toBe(newGroupName);
});

View File

@@ -48,7 +48,7 @@ function($, _, AjaxHelpers, TemplateHelpers, ViewHelpers, MoveXBlockModal, XBloc
showModal();
expect(
modal.$el.find('.modal-header .title').contents().get(0).nodeValue.trim()
).toEqual('Move: ' + DISPLAY_NAME);
).toEqual(`Move: ${DISPLAY_NAME}`);
expect(
modal.$el.find('.modal-sr-title').text().trim()
).toEqual('Choose a location to move your component to');

View File

@@ -64,7 +64,7 @@ describe('ModuleEdit', function() {
});
});
describe('render', function() {
beforeEach(function () {
beforeEach(function() {
edit_helpers.installEditTemplates(true);
spyOn(this.moduleEdit, 'loadDisplay');
spyOn(this.moduleEdit, 'delegateEvents');
@@ -124,7 +124,7 @@ describe('ModuleEdit', function() {
});
it('loads the module preview via ajax on the view element', function() {
expect($.ajax).toHaveBeenCalledWith({
url: '/xblock/' + this.moduleEdit.model.id + '/student_view',
url: `/xblock/${this.moduleEdit.model.id}/student_view`,
type: 'GET',
cache: false,
headers: {
@@ -133,7 +133,7 @@ describe('ModuleEdit', function() {
success: jasmine.any(Function)
});
expect($.ajax).not.toHaveBeenCalledWith({
url: '/xblock/' + this.moduleEdit.model.id + '/studio_view',
url: `/xblock/${this.moduleEdit.model.id}/studio_view`,
type: 'GET',
headers: {
Accept: 'application/json'
@@ -146,7 +146,7 @@ describe('ModuleEdit', function() {
it('loads the editing view via ajax on demand', function() {
var mockXBlockEditorHtml;
expect($.ajax).not.toHaveBeenCalledWith({
url: '/xblock/' + this.moduleEdit.model.id + '/studio_view',
url: `/xblock/${this.moduleEdit.model.id}/studio_view`,
type: 'GET',
cache: false,
headers: {
@@ -201,7 +201,7 @@ describe('ModuleEdit', function() {
]
});
expect($.ajax).toHaveBeenCalledWith({
url: '/xblock/' + this.moduleEdit.model.id + '/studio_view',
url: `/xblock/${this.moduleEdit.model.id}/studio_view`,
type: 'GET',
cache: false,
headers: {

View File

@@ -144,8 +144,8 @@ describe('MoveXBlock', function() {
createChildXBlockInfo = function(category, outlineOptions, xblockIndex) {
var childInfo = {
category: categoryMap[category],
display_name: category + '_display_name_' + xblockIndex,
id: category + '_ID_' + xblockIndex
display_name: `${category}_display_name_${xblockIndex}`,
id: `${category}_ID_${xblockIndex}`
};
return createXBlockInfo(parentChildMap[category], outlineOptions, childInfo);
};
@@ -236,11 +236,11 @@ describe('MoveXBlock', function() {
*/
verifyListViewInfo = function(category, expectedXBlocksCount, hasCurrentLocation) {
var displayedInfo = getDisplayedInfo();
expect(displayedInfo.categoryText).toEqual(modal.moveXBlockListView.categoriesText[category] + ':');
expect(displayedInfo.categoryText).toEqual(`${modal.moveXBlockListView.categoriesText[category]}:`);
expect(displayedInfo.xblockCount).toEqual(expectedXBlocksCount);
expect(displayedInfo.xblockDisplayNames).toEqual(
_.map(_.range(expectedXBlocksCount), function(xblockIndex) {
return category + '_display_name_' + xblockIndex;
return `${category}_display_name_${xblockIndex}`;
})
);
if (category === 'component') {
@@ -276,7 +276,7 @@ describe('MoveXBlock', function() {
expect(displayedBreadcrumbs).toEqual(
_.map(visitedCategories, function(visitedCategory) {
return visitedCategory === 'course'
? 'Course Outline' : visitedCategory + '_display_name_' + xblockIndex;
? 'Course Outline' : `${visitedCategory}_display_name_${xblockIndex}`;
})
);
};
@@ -288,7 +288,7 @@ describe('MoveXBlock', function() {
*/
clickForwardButton = function(buttonIndex) {
buttonIndex = buttonIndex || 0; // eslint-disable-line no-param-reassign
modal.moveXBlockListView.$el.find('[data-item-index="' + buttonIndex + '"] button').click();
modal.moveXBlockListView.$el.find(`[data-item-index="${buttonIndex}"] button`).click();
};
/**
@@ -429,7 +429,7 @@ describe('MoveXBlock', function() {
});
modal.$el.find('.modal-actions .action-move').click();
sendMoveXBlockRequest(requests, sourceLocator);
AjaxHelpers.expectJsonRequest(requests, 'GET', '/xblock/' + sourceParentLocator);
AjaxHelpers.expectJsonRequest(requests, 'GET', `/xblock/${sourceParentLocator}`);
AjaxHelpers.respondWithJson(requests, sourceParentXBlockInfo);
expect(getMovedAlertNotification().html().length).not.toEqual(0);
verifyConfirmationFeedbackTitleText(sourceDisplayName);

View File

@@ -19,9 +19,9 @@ function($, _, AjaxHelpers, URI, XBlockInfo, PagedContainer, PagingHeader, Pagin
};
var options = _.extend(default_options, override_options);
return '<div class="xblock" data-request-token="request_token">'
+ '<div class="container-paging-header"></div>'
+ htmlResponseTpl(options)
+ '<div class="container-paging-footer"></div>'
+ `<div class="container-paging-header"></div>${
htmlResponseTpl(options)
}<div class="container-paging-footer"></div>`
+ '</div>';
}
@@ -506,7 +506,7 @@ function($, _, AjaxHelpers, URI, XBlockInfo, PagedContainer, PagingHeader, Pagin
defaultUrl = '/preview/xblock/handler/trigger_previews';
testSendsAjax = function(show_previews) {
it('should send ' + (!show_previews) + ' when showChildrenPreviews was ' + show_previews, function() {
it(`should send ${!show_previews} when showChildrenPreviews was ${show_previews}`, function() {
var requests = AjaxHelpers.requests(this);
pagingContainer.collection.showChildrenPreviews = show_previews;
pagingContainer.togglePreviews();

View File

@@ -15,7 +15,7 @@ import Course from 'js/models/course';
import 'jquery.simulate';
function parameterized_suite(label, globalPageOptions) {
describe(label + ' ContainerPage', function() {
describe(`${label} ContainerPage`, function() {
var getContainerPage, renderContainerPage, handleContainerPageRefresh, expectComponents,
respondWithHtml, model, containerPage, requests, initialDisplayName,
mockContainerPage = readFixtures('templates/mock/mock-container-page.underscore'),
@@ -344,12 +344,12 @@ function parameterized_suite(label, globalPageOptions) {
allComponentsInGroup = _.map(
_.range(NUM_COMPONENTS_PER_GROUP),
function(index) {
return 'locator-component-' + GROUP_TO_TEST + (index + 1);
return `locator-component-${GROUP_TO_TEST}${index + 1}`;
}
);
getGroupElement = function() {
return containerPage.$("[data-locator='locator-group-" + GROUP_TO_TEST + "']");
return containerPage.$(`[data-locator='locator-group-${GROUP_TO_TEST}']`);
};
describe('Deleting an xblock', function() {
@@ -377,7 +377,7 @@ function parameterized_suite(label, globalPageOptions) {
// first request to delete the component
AjaxHelpers.expectJsonRequest(requests, 'DELETE',
'/xblock/locator-component-' + GROUP_TO_TEST + (componentIndex + 1),
`/xblock/locator-component-${GROUP_TO_TEST}${componentIndex + 1}`,
null);
AjaxHelpers.respondWithNoContent(requests);
@@ -489,8 +489,8 @@ function parameterized_suite(label, globalPageOptions) {
// verify content of request
AjaxHelpers.expectJsonRequest(requests, 'POST', '/xblock/', {
duplicate_source_locator: 'locator-component-' + GROUP_TO_TEST + (componentIndex + 1),
parent_locator: 'locator-group-' + GROUP_TO_TEST
duplicate_source_locator: `locator-component-${GROUP_TO_TEST}${componentIndex + 1}`,
parent_locator: `locator-group-${GROUP_TO_TEST}`
});
// send the response
@@ -568,7 +568,7 @@ function parameterized_suite(label, globalPageOptions) {
});
var updatePreviewButtonTest = function(show_previews, expected_text) {
it('can set preview button to "' + expected_text + '"', function() {
it(`can set preview button to "${expected_text}"`, function() {
containerPage = getContainerPage();
containerPage.updatePreviewButton(show_previews);
expect(getButtonText(containerPage)).toBe(expected_text);

View File

@@ -343,15 +343,15 @@ describe('Container Subviews', function() {
it('renders the last published date and user when there are no changes', function() {
renderContainerPage(this, mockContainerXBlockHtml);
fetch({published_on: 'Jul 01, 2014 at 12:45 UTC', published_by: 'amako'});
expect(containerPage.$(lastDraftCss).text()).
toContain('Last published Jul 01, 2014 at 12:45 UTC by amako');
expect(containerPage.$(lastDraftCss).text())
.toContain('Last published Jul 01, 2014 at 12:45 UTC by amako');
});
it('renders the last saved date and user when there are changes', function() {
renderContainerPage(this, mockContainerXBlockHtml);
fetch({has_changes: true, edited_on: 'Jul 02, 2014 at 14:20 UTC', edited_by: 'joe'});
expect(containerPage.$(lastDraftCss).text()).
toContain('Draft saved on Jul 02, 2014 at 14:20 UTC by joe');
expect(containerPage.$(lastDraftCss).text())
.toContain('Draft saved on Jul 02, 2014 at 14:20 UTC by joe');
});
describe('Release Date', function() {
@@ -596,8 +596,8 @@ describe('Container Subviews', function() {
fetch({
published: true, published_on: 'Jul 01, 2014 at 12:45 UTC', published_by: 'amako'
});
expect(containerPage.$(lastPublishCss).text()).
toContain('Last published Jul 01, 2014 at 12:45 UTC by amako');
expect(containerPage.$(lastPublishCss).text())
.toContain('Last published Jul 01, 2014 at 12:45 UTC by amako');
});
it('renders correctly when the block is published without publish info', function() {

View File

@@ -160,11 +160,11 @@ describe('CourseOutlinePage', function() {
};
getItemsOfType = function(type) {
return outlinePage.$('.outline-' + type);
return outlinePage.$(`.outline-${type}`);
};
getItemHeaders = function(type) {
return getItemsOfType(type).find('> .' + type + '-header');
return getItemsOfType(type).find(`> .${type}-header`);
};
verifyItemsExpanded = function(type, isExpanded) {
@@ -210,7 +210,7 @@ describe('CourseOutlinePage', function() {
setSelfPacedCustomPLS = function() {
setSelfPaced();
course.set('is_custom_relative_dates_active', true);
}
};
createCourseOutlinePage = function(test, courseJSON, createOnly) {
requests = AjaxHelpers.requests(test);
@@ -247,7 +247,7 @@ describe('CourseOutlinePage', function() {
createCourseOutlinePageAndShowUnit(this, mockCourseJSON);
getItemHeaders(type).find('.publish-button').click();
$('.wrapper-modal-window .action-publish').click();
AjaxHelpers.expectJsonRequest(requests, 'POST', '/xblock/mock-' + type, {
AjaxHelpers.expectJsonRequest(requests, 'POST', `/xblock/mock-${type}`, {
publish: 'make_public'
});
expect(requests[0].requestHeaders['X-HTTP-Method-Override']).toBe('PATCH');
@@ -688,7 +688,7 @@ describe('CourseOutlinePage', function() {
var highlights = [],
i;
for (i = 0; i < numberOfHighlights; i++) {
highlights.push('Highlight' + (i + 1));
highlights.push(`Highlight${i + 1}`);
}
return highlights;
};
@@ -1073,7 +1073,7 @@ describe('CourseOutlinePage', function() {
};
setContentVisibility = function(visibility) {
$('input[name=content-visibility][value=' + visibility + ']').prop('checked', true);
$(`input[name=content-visibility][value=${visibility}]`).prop('checked', true);
};
selectDisableSpecialExams = function() {
@@ -1122,7 +1122,7 @@ describe('CourseOutlinePage', function() {
};
expectShowCorrectness = function(showCorrectness) {
expect($('input[name=show-correctness][value=' + showCorrectness + ']').is(':checked')).toBe(true);
expect($(`input[name=show-correctness][value=${showCorrectness}]`).is(':checked')).toBe(true);
};
getMockNoPrereqOrExamsCourseJSON = function() {
@@ -1440,7 +1440,7 @@ describe('CourseOutlinePage', function() {
$('.wrapper-modal-window .action-save').click();
});
it('can select the onboarding exam when a course supports onboarding', function () {
it('can select the onboarding exam when a course supports onboarding', function() {
var mockCourseWithSpecialExamJSON = createMockCourseJSON({}, [
createMockSectionJSON({
has_changes: true,
@@ -2090,12 +2090,12 @@ describe('CourseOutlinePage', function() {
var setShowCorrectness;
setShowCorrectness = function(showCorrectness) {
$('input[name=show-correctness][value=' + showCorrectness + ']').click();
$(`input[name=show-correctness][value=${showCorrectness}]`).click();
};
describe('Show correctness set by subsection metadata.', function() {
$.each(['always', 'never', 'past_due'], function(index, showCorrectness) {
it('show_correctness="' + showCorrectness + '"', function() {
it(`show_correctness="${showCorrectness}"`, function() {
var mockCourseJSONCorrectness = createMockCourseJSON({}, [
createMockSectionJSON({}, [
createMockSubsectionJSON({show_correctness: showCorrectness}, [])
@@ -2124,7 +2124,7 @@ describe('CourseOutlinePage', function() {
});
$.each(['never', 'past_due'], function(index, showCorrectness) {
it('show_correctness="' + showCorrectness + '" updates settings, republishes', function() {
it(`show_correctness="${showCorrectness}" updates settings, republishes`, function() {
var expectedSettings = $.extend(true, {}, defaultModalSettings, {publish: 'republish'});
expectedSettings.metadata.show_correctness = showCorrectness;
@@ -2173,7 +2173,7 @@ describe('CourseOutlinePage', function() {
expect($modalWindow.find('.outline-subsection')).not.toExist();
});
describe('Self Paced with Custom Personalized Learner Schedules (PLS)', function () {
describe('Self Paced with Custom Personalized Learner Schedules (PLS)', function() {
beforeEach(function() {
var mockCourseJSON = createMockCourseJSON({}, [
createMockSectionJSON({}, [
@@ -2192,7 +2192,7 @@ describe('CourseOutlinePage', function() {
selectRelativeWeeksSubsection = function(weeks) {
$('#due_in').val(weeks).trigger('keyup');
}
};
mockCustomPacingServerValuesJson = createMockSectionJSON({
release_date: 'Jan 01, 2970 at 05:00 UTC'
@@ -2217,7 +2217,7 @@ describe('CourseOutlinePage', function() {
])
]);
it('can show correct editors for self_paced course with custom pacing', function (){
it('can show correct editors for self_paced course with custom pacing', function() {
outlinePage.$('.outline-subsection .configure-button').click();
expect($('.edit-settings-release').length).toBe(0);
// Due date input exists for custom pacing self paced courses
@@ -2286,7 +2286,7 @@ describe('CourseOutlinePage', function() {
$('#grading_type').val('notgraded').trigger('change');
$('#due_in').val('').trigger('change');
expect($('#relative_date_input').css('display')).toBe('none');
})
});
it('shows validation error on relative date', function() {
outlinePage.$('.outline-subsection .configure-button').click();
@@ -2353,7 +2353,7 @@ describe('CourseOutlinePage', function() {
'Contains staff only content'
);
});
})
});
});
// Note: most tests for units can be found in Bok Choy
@@ -2452,7 +2452,7 @@ describe('CourseOutlinePage', function() {
expect(messages).toContainText('Contains staff only content');
});
describe('discussion settings', function () {
describe('discussion settings', function() {
it('hides discussion settings if unit level discussions are disabled', function() {
getUnitStatus({}, {unit_level_discussions: false});
outlinePage.$('.outline-unit .configure-button').click();

View File

@@ -10,8 +10,8 @@ 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);
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();
}
@@ -110,7 +110,7 @@ function($, AjaxHelpers, ViewHelpers, ManageUsersFactory, ViewUtils) {
var promptSpy = ViewHelpers.createPromptSpy();
var reloadSpy = spyOn(ViewUtils, 'reload');
var email = 'honor@example.com';
$('.user-item[data-email="' + email + '"] .action-delete .delete').click();
$(`.user-item[data-email="${email}"] .action-delete .delete`).click();
ViewHelpers.verifyPromptShowing(promptSpy, 'Are you sure?');
ViewHelpers.confirmPrompt(promptSpy);
ViewHelpers.verifyPromptHidden(promptSpy);

View File

@@ -10,7 +10,7 @@ function($, URI, AjaxHelpers, PagingCollection, PagingView, PagingHeader) {
'use strict';
var createPageableItem = function(index) {
var id = 'item_' + index;
var id = `item_${index}`;
return {
id: id,
display_name: id,

View File

@@ -20,7 +20,7 @@ define(
_.range(numModels),
function(num, index) {
return new Backbone.Model(
_.extend({}, modelData, {edx_video_id: 'dummy_id_' + index})
_.extend({}, modelData, {edx_video_id: `dummy_id_${index}`})
);
}
)
@@ -66,7 +66,7 @@ define(
if (confirmRemove) {
// click on Remove button on confirmation popup
$('.action-primary').click();
AjaxHelpers.expectJsonRequest(requests, 'DELETE', videoHandlerUrl + '/dummy_id_0');
AjaxHelpers.expectJsonRequest(requests, 'DELETE', `${videoHandlerUrl}/dummy_id_0`);
AjaxHelpers.respondWithNoContent(requests);
numVideos -= 1;
firstVideoId = 'dummy_id_1';

View File

@@ -49,7 +49,7 @@ define(
},
collection = new Backbone.Collection(_.map(_.range(numVideos), function(num, index) {
return new Backbone.Model(
_.extend({}, defaultData, {edx_video_id: 'dummy_id_' + index}, modelData)
_.extend({}, defaultData, {edx_video_id: `dummy_id_${index}`}, modelData)
);
}));
videoListView = new PreviousVideoUploadListView({
@@ -192,7 +192,7 @@ define(
AjaxHelpers.expectRequest(
requests,
'POST',
IMAGE_UPLOAD_URL + '/dummy_id_' + videoViewIndex,
`${IMAGE_UPLOAD_URL}/dummy_id_${videoViewIndex}`,
new FormData()
);
@@ -221,7 +221,7 @@ define(
it('calls readMessage with correct message', function() {
var errorMessage = 'Image upload failed. This image file type is not supported. Supported file '
+ 'types are ' + videoThumbnailView.getVideoImageSupportedFileFormats().humanize + '.',
+ `types are ${videoThumbnailView.getVideoImageSupportedFileFormats().humanize}.`,
successData = {
files: [createFakeImageFile()],
submit: function() {}
@@ -270,8 +270,8 @@ define(
// Verify error message
expect($videoListEl.find('.thumbnail-error-wrapper').find('.action-text').html()
.trim()).toEqual(
'Image upload failed. The selected image must be larger than '
+ videoThumbnailView.getVideoImageMinSize().humanize + '.'
`Image upload failed. The selected image must be larger than ${
videoThumbnailView.getVideoImageMinSize().humanize}.`
);
});
@@ -285,8 +285,8 @@ define(
// Verify error message
expect($videoListEl.find('.thumbnail-error-wrapper').find('.action-text').html()
.trim()).toEqual(
'Image upload failed. The selected image must be smaller than '
+ videoThumbnailView.getVideoImageMaxSize().humanize + '.'
`Image upload failed. The selected image must be smaller than ${
videoThumbnailView.getVideoImageMaxSize().humanize}.`
);
});
@@ -322,8 +322,8 @@ define(
// Verify error message
expect($videoListEl.find('.thumbnail-error-wrapper').find('.action-text').html()
.trim()).toEqual(
'Image upload failed. This image file type is not supported. Supported file types are '
+ videoThumbnailView.getVideoImageSupportedFileFormats().humanize + '.'
`Image upload failed. This image file type is not supported. Supported file types are ${
videoThumbnailView.getVideoImageSupportedFileFormats().humanize}.`
);
});

View File

@@ -61,7 +61,7 @@ define(
expect(downloadTranscriptActionEl.html().trim(), 'Download');
expect(
downloadTranscriptActionEl.attr('href'),
TRANSCRIPT_DOWNLOAD_URL + '?edx_video_id=' + edxVideoID + '&language_code=' + transcriptLanguage
`${TRANSCRIPT_DOWNLOAD_URL}?edx_video_id=${edxVideoID}&language_code=${transcriptLanguage}`
);
expect(uploadTranscriptActionEl.html().trim(), 'Replace');
@@ -143,7 +143,7 @@ define(
videoTranscriptsView.$el.find('.video-transcripts-wrapper').hasClass('hidden')
).toEqual(true);
expect(videoTranscriptsView.$el.find('.toggle-show-transcripts-button-text').html().trim()).toEqual(
'Show transcripts (' + transcripts.length + ')'
`Show transcripts (${transcripts.length})`
);
});
@@ -155,7 +155,7 @@ define(
// Verify initial button text
expect(videoTranscriptsView.$el.find('.toggle-show-transcripts-button-text').html().trim()).toEqual(
'Show transcripts (' + transcripts.length + ')'
`Show transcripts (${transcripts.length})`
);
videoTranscriptsView.$el.find('.toggle-show-transcripts-button').click();
@@ -166,7 +166,7 @@ define(
// Verify button text is changed.
expect(videoTranscriptsView.$el.find('.toggle-show-transcripts-button-text').html().trim()).toEqual(
'Hide transcripts (' + transcripts.length + ')'
`Hide transcripts (${transcripts.length})`
);
});
@@ -176,7 +176,7 @@ define(
// Verify button text.
expect(videoTranscriptsView.$el.find('.toggle-show-transcripts-button-text').html().trim()).toEqual(
'Hide transcripts (' + transcripts.length + ')'
`Hide transcripts (${transcripts.length})`
);
// Verify transcript container is not hidden
@@ -188,7 +188,7 @@ define(
// Verify button text is changed.
expect(videoTranscriptsView.$el.find('.toggle-show-transcripts-button-text').html().trim()).toEqual(
'Show transcripts (' + transcripts.length + ')'
`Show transcripts (${transcripts.length})`
);
// Verify transcript container is hidden
@@ -216,10 +216,10 @@ define(
);
_.each(transcripts, function(languageCode) {
$transcriptEl = videoTranscriptsView.$el.find('.video-transcript-content[data-language-code="' + languageCode + '"]'); // eslint-disable-line max-len
$transcriptEl = videoTranscriptsView.$el.find(`.video-transcript-content[data-language-code="${languageCode}"]`); // eslint-disable-line max-len
// Verify correct transcript title is set.
expect($transcriptEl.find('.transcript-title').html()).toEqual(
'Video client title n_' + languageCode + '.' + TRANSCRIPT_DOWNLOAD_FILE_FORMAT
`Video client title n_${languageCode}.${TRANSCRIPT_DOWNLOAD_FILE_FORMAT}`
);
// Verify transcript is rendered with correct info.
verifyTranscriptStateInfo($transcriptEl, languageCode);
@@ -230,11 +230,11 @@ define(
var languageCode = 'en',
newLanguageCode = 'ar',
requests = AjaxHelpers.requests(this),
$transcriptEl = videoTranscriptsView.$el.find('.video-transcript-content[data-language-code="' + languageCode + '"]'); // eslint-disable-line max-len
$transcriptEl = videoTranscriptsView.$el.find(`.video-transcript-content[data-language-code="${languageCode}"]`); // eslint-disable-line max-len
// Verify correct transcript title is set.
expect($transcriptEl.find('.transcript-title').html()).toEqual(
'Video client title n_' + languageCode + '.' + TRANSCRIPT_DOWNLOAD_FILE_FORMAT
`Video client title n_${languageCode}.${TRANSCRIPT_DOWNLOAD_FILE_FORMAT}`
);
// Select a language
@@ -257,7 +257,7 @@ define(
// Verify correct transcript title is set.
expect($transcriptEl.find('.transcript-title').html()).toEqual(
'Video client title n_' + newLanguageCode + '.' + TRANSCRIPT_DOWNLOAD_FILE_FORMAT
`Video client title n_${newLanguageCode}.${TRANSCRIPT_DOWNLOAD_FILE_FORMAT}`
);
verifyMessage($transcriptEl, 'uploaded');
@@ -269,11 +269,11 @@ define(
it('can delete transcript', function() {
var languageCode = 'en',
requests = AjaxHelpers.requests(this),
$transcriptEl = videoTranscriptsView.$el.find('.video-transcript-content[data-language-code="' + languageCode + '"]'); // eslint-disable-line max-len
$transcriptEl = videoTranscriptsView.$el.find(`.video-transcript-content[data-language-code="${languageCode}"]`); // eslint-disable-line max-len
// Verify correct transcript title is set.
expect($transcriptEl.find('.transcript-title').html()).toEqual(
'Video client title n_' + languageCode + '.' + TRANSCRIPT_DOWNLOAD_FILE_FORMAT
`Video client title n_${languageCode}.${TRANSCRIPT_DOWNLOAD_FILE_FORMAT}`
);
$transcriptEl.find('.delete-transcript-button').click();
@@ -285,7 +285,7 @@ define(
AjaxHelpers.expectRequest(
requests,
'DELETE',
TRANSCRIPT_DELETE_URL + '/' + edxVideoID + '/' + languageCode
`${TRANSCRIPT_DELETE_URL}/${edxVideoID}/${languageCode}`
);
// Send successful delete response
@@ -293,7 +293,7 @@ define(
// Verify English transcript is not present.
expect(videoTranscriptsView.$el.find(
'.video-transcript-content[data-language-code="' + languageCode + '"]'
`.video-transcript-content[data-language-code="${languageCode}"]`
)).not.toExist();
// Verify transcripts view is rendered with transcript deleted for English.
@@ -305,11 +305,11 @@ define(
it('should show error message when deleting a transcript in case of server error', function() {
var languageCode = 'en',
requests = AjaxHelpers.requests(this),
$transcriptEl = videoTranscriptsView.$el.find('.video-transcript-content[data-language-code="' + languageCode + '"]'); // eslint-disable-line max-len
$transcriptEl = videoTranscriptsView.$el.find(`.video-transcript-content[data-language-code="${languageCode}"]`); // eslint-disable-line max-len
// Verify correct transcript title is set.
expect($transcriptEl.find('.transcript-title').html()).toEqual(
'Video client title n_' + languageCode + '.' + TRANSCRIPT_DOWNLOAD_FILE_FORMAT
`Video client title n_${languageCode}.${TRANSCRIPT_DOWNLOAD_FILE_FORMAT}`
);
$transcriptEl.find('.delete-transcript-button').click();
@@ -331,7 +331,7 @@ define(
AjaxHelpers.expectRequest(
requests,
'DELETE',
TRANSCRIPT_DELETE_URL + '/' + edxVideoID + '/' + languageCode
`${TRANSCRIPT_DELETE_URL}/${edxVideoID}/${languageCode}`
);
AjaxHelpers.respondWithError(requests, 500);
@@ -343,7 +343,7 @@ define(
// Verify English transcript container is not removed.
expect(videoTranscriptsView.$el.find(
'.video-transcript-content[data-language-code="' + languageCode + '"]'
`.video-transcript-content[data-language-code="${languageCode}"]`
)).toExist();
// Verify transcripts count is correct.
@@ -356,7 +356,7 @@ define(
var languageCode = 'en',
requests = AjaxHelpers.requests(this),
errorMessage = 'Transcript failed error message',
$transcriptEl = videoTranscriptsView.$el.find('.video-transcript-content[data-language-code="' + languageCode + '"]'); // eslint-disable-line max-len
$transcriptEl = videoTranscriptsView.$el.find(`.video-transcript-content[data-language-code="${languageCode}"]`); // eslint-disable-line max-len
$transcriptEl.find('.upload-transcript-button').click();
@@ -382,7 +382,7 @@ define(
it('should show error message in case of server error', function() {
var languageCode = 'en',
requests = AjaxHelpers.requests(this),
$transcriptEl = videoTranscriptsView.$el.find('.video-transcript-content[data-language-code="' + languageCode + '"]'); // eslint-disable-line max-len
$transcriptEl = videoTranscriptsView.$el.find(`.video-transcript-content[data-language-code="${languageCode}"]`); // eslint-disable-line max-len
$transcriptEl.find('.upload-transcript-button').click();
@@ -407,8 +407,8 @@ define(
it('should show error message in case of unsupported transcript file format', function() {
var languageCode = 'en',
transcriptFileName = 'unsupported-transcript-file-format.txt',
errorMessage = 'This file type is not supported. Supported file type is ' + TRANSCRIPT_DOWNLOAD_FILE_FORMAT + '.', // eslint-disable-line max-len
$transcriptEl = videoTranscriptsView.$el.find('.video-transcript-content[data-language-code="' + languageCode + '"]'); // eslint-disable-line max-len
errorMessage = `This file type is not supported. Supported file type is ${TRANSCRIPT_DOWNLOAD_FILE_FORMAT}.`, // eslint-disable-line max-len
$transcriptEl = videoTranscriptsView.$el.find(`.video-transcript-content[data-language-code="${languageCode}"]`); // eslint-disable-line max-len
$transcriptEl.find('.upload-transcript-button').click();

View File

@@ -36,7 +36,7 @@ describe('XBlockStringFieldEditorView', function() {
'<div class="wrapper-xblock-field incontext-editor is-editable"'
+ 'data-field="display_name" data-field-display-name="Display Name">'
+ '<h1 class="page-header-title xblock-field-value incontext-editor-value">'
+ '<span class="title-value">' + initialDisplayName + '</span>'
+ `<span class="title-value">${initialDisplayName}</span>`
+ '</h1>'
+ '</div>'
);
@@ -149,11 +149,11 @@ describe('XBlockStringFieldEditorView', function() {
});
it('renders open angle bracket in input field', function() {
expectInputMatchesModelDisplayName(updatedDisplayName + '<');
expectInputMatchesModelDisplayName(`${updatedDisplayName}<`);
});
it('renders close angle bracket in input field', function() {
expectInputMatchesModelDisplayName('>' + updatedDisplayName);
expectInputMatchesModelDisplayName(`>${updatedDisplayName}`);
});
});
});

View File

@@ -110,8 +110,8 @@ define(['jquery', 'js/models/xblock_validation', 'js/views/xblock_validation', '
it('renders action info', function() {
expect(view.$('a.edit-button .action-button-text').text()).toContain('Summary Action');
expect(view.$('a.notification-action-button .action-button-text').text()).
toContain('First Message Action');
expect(view.$('a.notification-action-button .action-button-text').text())
.toContain('First Message Action');
expect(view.$('a.notification-action-button').data('notification-action')).toBe('fix-up');
});

View File

@@ -138,4 +138,4 @@ export {
installEditTemplates,
showEditModal,
verifyXBlockRequest,
}
};

View File

@@ -46,7 +46,7 @@ define(['jquery', 'common/js/spec_helpers/template_helpers', 'common/js/spec_hel
pressModalButton = function(selector, modal) {
var modalElement, button;
modalElement = getModalElement(modal);
button = modalElement.find(selector + ':visible');
button = modalElement.find(`${selector}:visible`);
expect(button.length).toBe(1);
button.click();
};

View File

@@ -77,10 +77,10 @@ define(['jquery', 'date', 'js/utils/change_on_enter', 'jquery.ui', 'jquery.timep
var currentDate;
if (typeof index !== 'undefined' && view.hasOwnProperty('collection')) {
cacheModel = view.collection.models[index];
div = view.$el.find('#' + view.collectionSelector(cacheModel.cid));
div = view.$el.find(`#${view.collectionSelector(cacheModel.cid)}`);
} else {
cacheModel = view.model;
div = view.$el.find('#' + view.fieldToSelectorMap[fieldName]);
div = view.$el.find(`#${view.fieldToSelectorMap[fieldName]}`);
}
datefield = $(div).find('input.date');
timefield = $(div).find('input.time');

View File

@@ -212,7 +212,7 @@ function($, ui, _, gettext, Draggabilly, ModuleUtils, NotificationView) {
// Mark the new destination
if (destinationEle && this.pointerInBounds(pointer, $ele)) {
$ele.addClass(this.validDropClass);
destinationEle.addClass('drop-target drop-target-' + destinationInfo.attachMethod);
destinationEle.addClass(`drop-target drop-target-${destinationInfo.attachMethod}`);
this.dragState.attachMethod = destinationInfo.attachMethod;
this.dragState.dropDestination = destinationEle;
} else {

View File

@@ -26,7 +26,7 @@ define(['jquery'], function($) {
if (getQString[1].search('wmode=transparent') === -1) {
var oldString = getQString[1];
var newString = getQString[0];
$(this).attr('src', newString + '?' + wmode + '&' + oldString);
$(this).attr('src', `${newString}?${wmode}&${oldString}`);
}
// eslint-disable-next-line brace-style
}
@@ -34,7 +34,7 @@ define(['jquery'], function($) {
// removed we execute this code. To avoid throwing an error when setting the
// attr, check that the source doesn't start with the value specified by TinyMCE ('javascript:""').
else if (ifr_source.lastIndexOf('javascript:', 0) !== 0) {
$(this).attr('src', ifr_source + '?' + wmode);
$(this).attr('src', `${ifr_source}?${wmode}`);
}
}
} else {

View File

@@ -12,9 +12,9 @@ define(['underscore'], function(_) {
var getUpdateUrl = function(locator) {
if (_.isUndefined(locator)) {
return urlRoot + '/';
return `${urlRoot}/`;
} else {
return urlRoot + '/' + locator;
return `${urlRoot}/${locator}`;
}
};
return {

View File

@@ -5,10 +5,10 @@ define(['jquery', 'underscore'], function($, _) {
* @returns The loaded template.
*/
var loadTemplate = function(name) {
var templateSelector = '#' + name + '-tpl',
var templateSelector = `#${name}-tpl`,
templateText = $(templateSelector).text();
if (!templateText) {
console.error('Failed to load ' + name + ' template');
console.error(`Failed to load ${name} template`);
}
return _.template(templateText);
};

View File

@@ -6,7 +6,7 @@ define(['js/views/baseview', 'underscore'], function(BaseView, _) {
var self = this;
var templateName = _.result(this, 'templateName');
// Backbone model cid is only unique within the collection.
this.uniqueId = _.uniqueId(templateName + '_');
this.uniqueId = _.uniqueId(`${templateName}_`);
this.template = this.loadTemplate(templateName);
// xss-lint: disable=javascript-jquery-html
this.$el.html(this.template({model: this.model, uniqueId: this.uniqueId}));
@@ -87,10 +87,10 @@ define(['js/views/baseview', 'underscore'], function(BaseView, _) {
* @returns The loaded template.
*/
loadTemplate: function(name) {
var templateSelector = '#' + name,
var templateSelector = `#${name}`,
templateText = $(templateSelector).text();
if (!templateText) {
console.error('Failed to load ' + name + ' template');
console.error(`Failed to load ${name} template`);
}
return _.template(templateText);
}

View File

@@ -203,7 +203,7 @@ function($, _, gettext, HtmlUtils, BaseView, AssetModel, PagingView, AssetView,
if (self.maxFileSizeRedirectUrl) {
var instructions = gettext('Please follow the instructions here to upload a file elsewhere and link to it: {maxFileSizeRedirectUrl}')
.replace('{maxFileSizeRedirectUrl}', self.maxFileSizeRedirectUrl);
error = error + ' ' + instructions;
error = `${error} ${instructions}`;
}
self.largeFileErrorMsg = new NotificationView.Error({
@@ -262,7 +262,7 @@ function($, _, gettext, HtmlUtils, BaseView, AssetModel, PagingView, AssetView,
},
showUploadFeedback: function(event, percentComplete) {
var percentVal = percentComplete + '%',
var percentVal = `${percentComplete}%`,
$progressFill = $('.upload-modal .progress-fill');
$progressFill.width(percentVal);
@@ -319,7 +319,7 @@ function($, _, gettext, HtmlUtils, BaseView, AssetModel, PagingView, AssetView,
this.pagingView.filterableColumns['js-asset-type-col'].displayName = assettypeLabel;
this.pagingView.selectFilter('js-asset-type-col');
this.closeFilterPopup(this.$el.find(
'.column-filter-link[data-assetfilter="' + assettype + '"]'));
`.column-filter-link[data-assetfilter="${assettype}"]`));
},
closeFilterPopup: function(element) {

View File

@@ -46,8 +46,8 @@ function($, _, gettext, BaseView, ViewUtils, AddXBlockButton, AddXBlockMenu, Htm
event.stopPropagation();
type = $(event.currentTarget).data('type');
this.$('.new-component').slideUp(250);
this.$('.new-component-' + type).slideDown(250);
this.$('.new-component-' + type + ' div').focus();
this.$(`.new-component-${type}`).slideDown(250);
this.$(`.new-component-${type} div`).focus();
},
closeNewComponent: function(event) {
@@ -57,7 +57,7 @@ function($, _, gettext, BaseView, ViewUtils, AddXBlockButton, AddXBlockMenu, Htm
type = $(event.currentTarget).data('type');
this.$('.new-component').slideDown(250);
this.$('.new-component-templates').slideUp(250);
this.$('ul.new-component-type li button[data-type=' + type + ']').focus();
this.$(`ul.new-component-type li button[data-type=${type}]`).focus();
},
createNewComponent: function(event) {

View File

@@ -2,7 +2,7 @@ define(['jquery', 'js/views/baseview', 'edx-ui-toolkit/js/utils/html-utils'],
function($, BaseView, HtmlUtils) {
return BaseView.extend({
className: function() {
return 'new-component-templates new-component-' + this.model.type;
return `new-component-templates new-component-${this.model.type}`;
},
initialize: function() {
BaseView.prototype.initialize.call(this);

View File

@@ -72,7 +72,7 @@ function(CodeMirror, ModalUtils, DateUtils, HtmlUtils, CourseInfoHelper, Validat
},
collectionSelector: function(uid) {
return 'course-update-list li[name=' + uid + ']';
return `course-update-list li[name=${uid}]`;
},
setAndValidate: function(attr, value, event) {
@@ -96,13 +96,13 @@ function(CodeMirror, ModalUtils, DateUtils, HtmlUtils, CourseInfoHelper, Validat
handleValidationError: function(model, error) {
var self = this,
$validationElement = this.$el.find('#course-update-list li[name="' + model.cid + '"]');
$validationElement = this.$el.find(`#course-update-list li[name="${model.cid}"]`);
$validationElement.find('.message-error').remove();
Object.keys(error).forEach(function(field) {
if (error.hasOwnProperty(field)) {
HtmlUtils.append(
$validationElement.find('#update-date-' + model.cid).parent(),
$validationElement.find(`#update-date-${model.cid}`).parent(),
self.errorTemplate({message: error[field]})
);
HtmlUtils.append(
@@ -116,7 +116,7 @@ function(CodeMirror, ModalUtils, DateUtils, HtmlUtils, CourseInfoHelper, Validat
},
validateModel: function(model) {
var $validationElement = this.$el.find('#course-update-list li[name="' + model.cid + '"]');
var $validationElement = this.$el.find(`#course-update-list li[name="${model.cid}"]`);
if (model.isValid()) {
$validationElement.find('.message-error').remove();
$validationElement.find('.save-button').removeClass('is-disabled');

View File

@@ -612,7 +612,7 @@ function($, Backbone, _, gettext, moment, ViewUtils, HtmlUtils, StringUtils, Tra
var $OrganizationApiSecretWrapperEl,
$OrganizationUsernameWrapperEl,
isValid = true,
$OrganizationApiKeyWrapperEl = this.$el.find('.' + this.selectedProvider + '-api-key-wrapper');
$OrganizationApiKeyWrapperEl = this.$el.find(`.${this.selectedProvider}-api-key-wrapper`);
// Explicit None selected case.
if (this.selectedProvider === '') {
@@ -627,7 +627,7 @@ function($, Backbone, _, gettext, moment, ViewUtils, HtmlUtils, StringUtils, Tra
}
if (this.selectedProvider === THREE_PLAY_MEDIA) {
$OrganizationApiSecretWrapperEl = this.$el.find('.' + this.selectedProvider + '-api-secret-wrapper');
$OrganizationApiSecretWrapperEl = this.$el.find(`.${this.selectedProvider}-api-secret-wrapper`);
if ($OrganizationApiSecretWrapperEl.find('input').val() === '') {
isValid = false;
this.addErrorState($OrganizationApiSecretWrapperEl);
@@ -635,7 +635,7 @@ function($, Backbone, _, gettext, moment, ViewUtils, HtmlUtils, StringUtils, Tra
this.clearPreferenceErrorState($OrganizationApiSecretWrapperEl);
}
} else {
$OrganizationUsernameWrapperEl = this.$el.find('.' + this.selectedProvider + '-username-wrapper');
$OrganizationUsernameWrapperEl = this.$el.find(`.${this.selectedProvider}-username-wrapper`);
if ($OrganizationUsernameWrapperEl.find('input').val() === '') {
isValid = false;
this.addErrorState($OrganizationUsernameWrapperEl);
@@ -688,15 +688,15 @@ function($, Backbone, _, gettext, moment, ViewUtils, HtmlUtils, StringUtils, Tra
var self = this,
username,
apiSecret,
apiKey = this.$el.find('.' + this.selectedProvider + '-api-key').val();
apiKey = this.$el.find(`.${this.selectedProvider}-api-key`).val();
// First clear response status if present already
this.clearResponseStatus();
if (this.selectedProvider === THREE_PLAY_MEDIA) {
apiSecret = this.$el.find('.' + this.selectedProvider + '-api-secret').val();
apiSecret = this.$el.find(`.${this.selectedProvider}-api-secret`).val();
} else {
username = this.$el.find('.' + this.selectedProvider + '-username').val();
username = this.$el.find(`.${this.selectedProvider}-username`).val();
}
$.postJSON(self.transcriptCredentialsHandlerUrl, {

View File

@@ -1,55 +1,56 @@
define([
"jquery",
"underscore",
"backbone",
"js/views/utils/xblock_utils",
"js/utils/templates",
"js/views/modals/course_outline_modals",
"edx-ui-toolkit/js/utils/html-utils",
], function ($, _, Backbone, XBlockViewUtils, TemplateUtils, CourseOutlineModalsFactory, HtmlUtils) {
"use strict";
var CourseVideoSharingEnableView = Backbone.View.extend({
events: {
"change #video-sharing-configuration-options": "handleVideoSharingConfigurationChange",
},
'jquery',
'underscore',
'backbone',
'js/views/utils/xblock_utils',
'js/utils/templates',
'js/views/modals/course_outline_modals',
'edx-ui-toolkit/js/utils/html-utils',
], function($, _, Backbone, XBlockViewUtils, TemplateUtils, CourseOutlineModalsFactory, HtmlUtils) {
'use strict';
initialize: function () {
this.template = TemplateUtils.loadTemplate("course-video-sharing-enable");
},
getRequestData: function (value) {
return {
metadata: {
'video_sharing_options': value,
var CourseVideoSharingEnableView = Backbone.View.extend({
events: {
'change #video-sharing-configuration-options': 'handleVideoSharingConfigurationChange',
},
};
},
handleVideoSharingConfigurationChange: function (event) {
if (event.type === "change") {
event.preventDefault();
this.updateVideoSharingConfiguration(event.target.value);
}
},
initialize: function() {
this.template = TemplateUtils.loadTemplate('course-video-sharing-enable');
},
updateVideoSharingConfiguration: function (value) {
XBlockViewUtils.updateXBlockFields(this.model, this.getRequestData(value), {
success: this.refresh.bind(this)
});
},
getRequestData: function(value) {
return {
metadata: {
video_sharing_options: value,
},
};
},
refresh: function () {
this.model.fetch({
success: this.render.bind(this),
});
},
handleVideoSharingConfigurationChange: function(event) {
if (event.type === 'change') {
event.preventDefault();
this.updateVideoSharingConfiguration(event.target.value);
}
},
render: function () {
var html = this.template(this.model.attributes);
HtmlUtils.setHtml(this.$el, HtmlUtils.HTML(html));
return this;
},
});
updateVideoSharingConfiguration: function(value) {
XBlockViewUtils.updateXBlockFields(this.model, this.getRequestData(value), {
success: this.refresh.bind(this)
});
},
return CourseVideoSharingEnableView;
refresh: function() {
this.model.fetch({
success: this.render.bind(this),
});
},
render: function() {
var html = this.template(this.model.attributes);
HtmlUtils.setHtml(this.$el, HtmlUtils.HTML(html));
return this;
},
});
return CourseVideoSharingEnableView;
});

View File

@@ -12,7 +12,7 @@ function(_, $, gettext, HtmlUtils, BaseView, FileUploadModel, UploadDialogView,
},
tagName: 'li',
className: function() {
return 'field-group chapter chapter' + this.model.get('order');
return `field-group chapter chapter${this.model.get('order')}`;
},
render: function() {
HtmlUtils.setHtml(

View File

@@ -19,7 +19,7 @@ function(BaseView, _, str, gettext, groupEditTemplate) {
className: function() {
var index = this.model.collection.indexOf(this.model);
return 'field-group group group-' + index;
return `field-group group group-${index}`;
},
initialize: function() {

View File

@@ -118,7 +118,7 @@ define([
$dom.successStage
.find('.item-progresspoint-success-date')
.text('(' + date + ' at ' + time + ' UTC)');
.text(`(${date} at ${time} UTC)`);
break;
@@ -343,7 +343,7 @@ define([
+ 'and try again.');
action = gettext('Take me to the main course page');
}
msg += ' ' + gettext('The raw error message is:') + ' ' + errMsg;
msg += ` ${gettext('The raw error message is:')} ${errMsg}`;
dialog = new PromptView({
title: gettext('There has been an error with your export.'),
message: msg,

View File

@@ -23,7 +23,7 @@ function(BaseView, _, gettext, str, StringUtils, HtmlUtils) {
return [
'collection',
'group-configuration-details',
'group-configuration-details-' + index
`group-configuration-details-${index}`
].join(' ');
},

View File

@@ -27,7 +27,7 @@ function(ListItemEditorView, _, $, gettext, ExperimentGroupEditView) {
return [
'collection-edit',
'group-configuration-edit',
'group-configuration-edit-' + index
`group-configuration-edit-${index}`
].join(' ');
},

View File

@@ -33,10 +33,10 @@ define([
return [
'wrapper-collection',
'wrapper-collection-' + index,
`wrapper-collection-${index}`,
this.baseClassName,
this.baseClassName + 's-list-item',
this.baseClassName + 's-list-item-' + index
`${this.baseClassName}s-list-item`,
`${this.baseClassName}s-list-item-${index}`
].join(' ');
},

View File

@@ -103,7 +103,7 @@ function($, _, gettext, BaseView, PromptView, ViewUtils, HtmlUtils) {
var self = this;
for (var i = 0; i < self.options.roles.length; i++) {
var role_name = self.options.roles[i].key;
var role_selector = 'click .user-actions .make-' + role_name;
var role_selector = `click .user-actions .make-${role_name}`;
(function(role) {
roleEvents[role_selector] = function(event) { self.handleRoleButtonClick(event.target, role); };

View File

@@ -112,7 +112,7 @@ define(
// If the model has property `non editable` equals `true`,
// the field is disabled, but user is able to clear it.
if (this.model.get('non_editable')) {
this.$el.find('#' + this.uniqueId)
this.$el.find(`#${this.uniqueId}`)
.prop('readonly', true)
.addClass('is-disabled')
.attr('aria-disabled', true);
@@ -120,7 +120,7 @@ define(
},
getValueFromEditor: function() {
return this.$el.find('#' + this.uniqueId).val();
return this.$el.find(`#${this.uniqueId}`).val();
},
setValueInEditor: function(value) {
@@ -215,7 +215,7 @@ define(
templateName: 'metadata-number-entry',
getValueFromEditor: function() {
return this.$el.find('#' + this.uniqueId).val();
return this.$el.find(`#${this.uniqueId}`).val();
},
setValueInEditor: function(value) {
@@ -274,7 +274,7 @@ define(
templateName: 'metadata-option-entry',
getValueFromEditor: function() {
var selectedText = this.$el.find('#' + this.uniqueId).find(':selected').text();
var selectedText = this.$el.find(`#${this.uniqueId}`).find(':selected').text();
var selectedValue;
_.each(this.model.getOptions(), function(modelValue) {
if (modelValue === selectedText) {
@@ -294,7 +294,7 @@ define(
value = modelValue.display_name;
}
});
this.$el.find('#' + this.uniqueId + ' option').filter(function() {
this.$el.find(`#${this.uniqueId} option`).filter(function() {
return $(this).text() === value;
}).prop('selected', true);
}
@@ -407,7 +407,7 @@ define(
templateName: 'metadata-string-entry',
getValueFromEditor: function() {
var $input = this.$el.find('#' + this.uniqueId);
var $input = this.$el.find(`#${this.uniqueId}`);
return $input.val();
},
@@ -433,7 +433,7 @@ define(
parseRelativeTime: function(value) {
// This function ensure you have two-digits
var pad = function(number) {
return (number < 10) ? '0' + number : number;
return (number < 10) ? `0${number}` : number;
},
// Removes all white-spaces and splits by `:`.
list = value.replace(/\s+/g, '').split(':'),
@@ -584,7 +584,7 @@ define(
},
getValueFromEditor: function() {
return this.$('#' + this.uniqueId).val();
return this.$(`#${this.uniqueId}`).val();
},
setValueInEditor: function(value) {
@@ -593,14 +593,14 @@ define(
uniqueId: this.uniqueId
});
this.$('#' + this.uniqueId).val(value);
this.$(`#${this.uniqueId}`).val(value);
this.$('.wrapper-uploader-actions').html(HtmlUtils.HTML((html)).toString());
},
upload: function(event) {
var self = this,
$target = $(event.currentTarget),
url = '/assets/' + this.options.courseKey + '/',
url = `/assets/${this.options.courseKey}/`,
model = new FileUpload({
title: gettext('Upload File')
}),

View File

@@ -156,22 +156,22 @@ define(['jquery', 'underscore', 'gettext', 'js/views/baseview'],
* Returns the action bar that contains the modal's action buttons.
*/
getActionBar: function() {
return this.$(this.options.modalWindowClass + ' > div > .modal-actions');
return this.$(`${this.options.modalWindowClass} > div > .modal-actions`);
},
/**
* Returns the action button of the specified type.
*/
getActionButton: function(type) {
return this.getActionBar().find('.action-' + type);
return this.getActionBar().find(`.action-${type}`);
},
enableActionButton: function(type) {
this.getActionBar().find('.action-' + type).prop('disabled', false).removeClass('is-disabled');
this.getActionBar().find(`.action-${type}`).prop('disabled', false).removeClass('is-disabled');
},
disableActionButton: function(type) {
this.getActionBar().find('.action-' + type).prop('disabled', true).addClass('is-disabled');
this.getActionBar().find(`.action-${type}`).prop('disabled', true).addClass('is-disabled');
},
resize: function() {

View File

@@ -138,7 +138,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
_.map(tab.editors, function(Editor) {
return new Editor({
parent: this,
parentElement: this.$('.modal-section .' + tab.name),
parentElement: this.$(`.modal-section .${tab.name}`),
model: this.model,
xblockType: this.options.xblockType,
enable_proctored_exams: this.options.enable_proctored_exams,
@@ -180,9 +180,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
showTab: function(tab) {
this.$('.modal-section .settings-tab-button').removeClass('active');
this.$('.modal-section .settings-tab-button[data-tab="' + tab + '"]').addClass('active');
this.$(`.modal-section .settings-tab-button[data-tab="${tab}"]`).addClass('active');
this.$('.modal-section .settings-tab').hide();
this.$('.modal-section .' + tab).show();
this.$(`.modal-section .${tab}`).show();
}
});
@@ -194,7 +194,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
initialize: function() {
CourseOutlineXBlockModal.prototype.initialize.call(this);
if (this.options.xblockType) {
this.options.modalName = 'bulkpublish-' + this.options.xblockType;
this.options.modalName = `bulkpublish-${this.options.xblockType}`;
}
},
@@ -228,7 +228,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
initialize: function() {
CourseOutlineXBlockModal.prototype.initialize.call(this);
if (this.options.xblockType) {
this.options.modalName = 'highlights-' + this.options.xblockType;
this.options.modalName = `highlights-${this.options.xblockType}`;
}
},
@@ -245,7 +245,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
callAnalytics: function(event) {
event.preventDefault();
window.analytics.track('edx.bi.highlights.' + event.target.innerText.toLowerCase());
window.analytics.track(`edx.bi.highlights.${event.target.innerText.toLowerCase()}`);
if (event.target.className.indexOf('save') !== -1) {
this.save(event);
} else {
@@ -269,7 +269,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
initialize: function() {
CourseOutlineXBlockModal.prototype.initialize.call(this);
if (this.options.xblockType) {
this.options.modalName = 'highlights-enable-' + this.options.xblockType;
this.options.modalName = `highlights-enable-${this.options.xblockType}`;
}
},
@@ -283,7 +283,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
callAnalytics: function(event) {
event.preventDefault();
window.analytics.track('edx.bi.highlights_enable.' + event.target.innerText.toLowerCase());
window.analytics.track(`edx.bi.highlights_enable.${event.target.innerText.toLowerCase()}`);
if (event.target.className.indexOf('save') !== -1) {
this.save(event);
} else {
@@ -408,13 +408,13 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
if (!this.getValue() || !course.get('start')) { return; }
var startDate = new Date(course.get('start'));
// The value returned by toUTCString() is a string in the form Www, dd Mmm yyyy hh:mm:ss GMT
var startDateList = startDate.toUTCString().split(' ')
var startDateList = startDate.toUTCString().split(' ');
// This text will look like Mmm dd, yyyy (i.e. Jul 26, 2021)
this.$('#relative_weeks_due_start_date').text(startDateList[2] + ' ' + startDateList[1] + ', ' + startDateList[3]);
var projectedDate = new Date(startDate)
projectedDate.setDate(projectedDate.getDate() + this.getValue()*7);
this.$('#relative_weeks_due_start_date').text(`${startDateList[2]} ${startDateList[1]}, ${startDateList[3]}`);
var projectedDate = new Date(startDate);
projectedDate.setDate(projectedDate.getDate() + this.getValue() * 7);
var projectedDateList = projectedDate.toUTCString().split(' ');
this.$('#relative_weeks_due_projected_due_in').text(projectedDateList[2] + ' ' + projectedDateList[1] + ', ' + projectedDateList[3]);
this.$('#relative_weeks_due_projected_due_in').text(`${projectedDateList[2]} ${projectedDateList[1]}, ${projectedDateList[3]}`);
this.$('#relative_weeks_due_projected').show();
},
@@ -433,9 +433,9 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
afterRender: function() {
AbstractEditor.prototype.afterRender.call(this);
if (this.model.get('graded')) {
this.$('#relative_date_input').show()
this.$('#relative_date_input').show();
} else {
this.$('#relative_date_input').hide()
this.$('#relative_date_input').hide();
}
this.$('.field-due-in input').val(this.model.get('relative_weeks_due'));
this.$('#relative_weeks_due_projected').hide();
@@ -444,12 +444,12 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
getRequestData: function() {
// Grab all the sections, map them to their block_ids, then return as an Array
var sectionIds = $('.outline-section').map(function(){ return this.id; }).get()
var sectionIds = $('.outline-section').map(function() { return this.id; }).get();
// Grab all the subsections, map them to their block_ids, then return as an Array
var subsectionIds = $('.outline-subsection').map(function(){ return this.id; }).get()
var subsectionIds = $('.outline-subsection').map(function() { return this.id; }).get();
var relative_weeks_due = null;
if (this.getValue() > 0 && $('#grading_type').val() !== 'notgraded') {
relative_weeks_due = this.getValue()
relative_weeks_due = this.getValue();
}
window.analytics.track('edx.bi.studio.relative_date.saved', {
block_id: this.model.get('id'),
@@ -613,11 +613,11 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
return this.$('.field-time-limit input').val();
},
convertTimeLimitMinutesToString: function(timeLimitMinutes) {
var hoursStr = '' + Math.floor(timeLimitMinutes / 60);
var actualMinutesStr = '' + (timeLimitMinutes % 60);
var hoursStr = `${Math.floor(timeLimitMinutes / 60)}`;
var actualMinutesStr = `${timeLimitMinutes % 60}`;
hoursStr = '00'.substring(0, 2 - hoursStr.length) + hoursStr;
actualMinutesStr = '00'.substring(0, 2 - actualMinutesStr.length) + actualMinutesStr;
return hoursStr + ':' + actualMinutesStr;
return `${hoursStr}:${actualMinutesStr}`;
},
convertTimeLimitToMinutes: function(timeLimit) {
var time = timeLimit.split(':');
@@ -673,7 +673,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
prereqMinScore = this.model.get('prereq_min_score') || '100';
prereqMinCompletion = this.model.get('prereq_min_completion') || '100';
this.$('#is_prereq').prop('checked', this.model.get('is_prereq'));
this.$('#prereq option[value="' + prereq + '"]').prop('selected', true);
this.$(`#prereq option[value="${prereq}"]`).prop('selected', true);
this.$('#prereq_min_score').val(prereqMinScore);
this.$('#prereq_min_score_input').toggle(prereq.length > 0);
this.$('#prereq_min_completion').val(prereqMinCompletion);
@@ -859,7 +859,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
if (keys.length === 1) { // should be only one partition key
if (groupAccess.hasOwnProperty(keys[0]) && groupAccess[keys[0]].length > 0) {
// Select the option that has group access, provided there is a specific group within the scheme
this.$('.user-partition-select option[value=' + keys[0] + ']').prop('selected', true);
this.$(`.user-partition-select option[value=${keys[0]}]`).prop('selected', true);
this.showSelectedDiv(keys[0]);
// Change default option to 'All Learners and Staff' if unit is currently restricted
this.$('#partition-select option:first').text(gettext('All Learners and Staff'));
@@ -877,7 +877,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
},
getSelectedCheckboxesByDivId: function(contentGroupId) {
var $checkboxes = $('#' + contentGroupId + '-checkboxes input:checked'),
var $checkboxes = $(`#${contentGroupId}-checkboxes input:checked`),
selectedCheckboxValues = [],
i;
for (i = 0; i < $checkboxes.length; i++) {
@@ -887,7 +887,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
},
showSelectedDiv: function(contentGroupId) {
$('#' + contentGroupId + '-checkboxes').show();
$(`#${contentGroupId}-checkboxes`).show();
},
hideCheckboxDivs: function() {
@@ -944,16 +944,16 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
showTipText: function() {
if (this.model.get('published')) {
$('.un-published-tip').hide()
$('.un-published-tip').hide();
} else {
$('.un-published-tip').show()
$('.un-published-tip').show();
}
let enabledForGraded = course.get('discussions_settings').enable_graded_units
let enabledForGraded = course.get('discussions_settings').enable_graded_units;
if (this.model.get('graded') && !enabledForGraded) {
$('#discussion_enabled').prop('disabled', true);
$('.graded-tip').show()
$('.graded-tip').show();
} else {
$('.graded-tip').hide()
$('.graded-tip').hide();
}
},
@@ -1012,7 +1012,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
},
setVisibility: function(value) {
this.$('input[name=content-visibility][value=' + value + ']').prop('checked', true);
this.$(`input[name=content-visibility][value=${value}]`).prop('checked', true);
},
currentVisibility: function() {
@@ -1085,7 +1085,7 @@ define(['jquery', 'backbone', 'underscore', 'gettext', 'js/views/baseview',
},
setValue: function(value) {
this.$('input[name=show-correctness][value=' + value + ']').prop('checked', true);
this.$(`input[name=show-correctness][value=${value}]`).prop('checked', true);
},
currentValue: function() {

View File

@@ -163,7 +163,7 @@ function($, _, Backbone, gettext, BaseModal, ViewUtils, XBlockViewUtils, XBlockE
editorView.selectMode(mode);
this.$('.editor-modes a').removeClass('is-set');
if (mode) {
buttonSelector = '.' + mode + '-button';
buttonSelector = `.${mode}-button`;
this.$(buttonSelector).addClass('is-set');
}
},

View File

@@ -178,7 +178,7 @@ function($, Backbone, _, gettext, BaseView, XBlockViewUtils, MoveXBlockUtils, Ht
moveXBlock: function() {
MoveXBlockUtils.moveXBlock(
{
sourceXBlockElement: $("li.studio-xblock-wrapper[data-locator='" + this.sourceXBlockInfo.id + "']"),
sourceXBlockElement: $(`li.studio-xblock-wrapper[data-locator='${this.sourceXBlockInfo.id}']`),
sourceDisplayName: this.sourceXBlockInfo.get('display_name'),
sourceLocator: this.sourceXBlockInfo.id,
sourceParentLocator: this.sourceParentXBlockInfo.id,

View File

@@ -57,7 +57,7 @@
callback = function() {};
}
payload.parent_locator = parent;
return $.postJSON(this.model.urlRoot + '/', payload, function(data) {
return $.postJSON(`${this.model.urlRoot}/`, payload, function(data) {
_this.model.set({
id: data.locator
});
@@ -71,7 +71,7 @@
var _this = this;
if (this.model.id) {
return $.ajax({
url: '' + (decodeURIComponent(this.model.url())) + '/' + viewName,
url: `${decodeURIComponent(this.model.url())}/${viewName}`,
type: 'GET',
cache: false,
headers: {

View File

@@ -90,7 +90,7 @@ function($, _, ViewUtils, ContainerView, ModuleUtils, gettext, NotificationView,
xblockUrl = xblockInfo.url();
return $.ajax({
url: decodeURIComponent(xblockUrl) + '/' + view,
url: `${decodeURIComponent(xblockUrl)}/${view}`,
type: 'GET',
cache: false,
data: this.getRenderParameters(options.page_number, options.force_render),
@@ -102,14 +102,14 @@ function($, _, ViewUtils, ContainerView, ModuleUtils, gettext, NotificationView,
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() * 0.10));
}
if (originalDone) {
originalDone();
}
}
};
self.handleXBlockFragment(fragment, options);
}
});
@@ -265,7 +265,7 @@ function($, _, ViewUtils, ContainerView, ModuleUtils, gettext, NotificationView,
xblockUrl = this.model.url();
return $.ajax({
// No runtime, so can't get this via the handler() call.
url: '/preview' + decodeURIComponent(xblockUrl) + '/handler/trigger_previews',
url: `/preview${decodeURIComponent(xblockUrl)}/handler/trigger_previews`,
type: 'POST',
data: JSON.stringify({showChildrenPreviews: !this.collection.showChildrenPreviews}),
dataType: 'json'

View File

@@ -265,19 +265,19 @@ function($, _, Backbone, gettext, BasePage, ViewUtils, ContainerView, XBlockView
editXBlock: function(event, options) {
event.preventDefault();
if(!options || options.view !== 'visibility_view' ){
const primaryHeader = $(event.target).closest('.xblock-header-primary')
if (!options || options.view !== 'visibility_view') {
const primaryHeader = $(event.target).closest('.xblock-header-primary');
var useNewTextEditor = primaryHeader.attr('use-new-editor-text'),
useNewVideoEditor = primaryHeader.attr('use-new-editor-video'),
useNewProblemEditor = primaryHeader.attr('use-new-editor-problem'),
blockType = primaryHeader.attr('data-block-type');
if( (useNewTextEditor === 'True' && blockType === 'html')
if((useNewTextEditor === 'True' && blockType === 'html')
|| (useNewVideoEditor === 'True' && blockType === 'video')
|| (useNewProblemEditor === 'True' && blockType === 'problem')
) {
var destinationUrl = primaryHeader.attr('authoring_MFE_base_url') + '/' + blockType + '/' + encodeURI(primaryHeader.attr('data-usage-id'));
var destinationUrl = `${primaryHeader.attr('authoring_MFE_base_url')}/${blockType}/${encodeURI(primaryHeader.attr('data-usage-id'))}`;
window.location.href = destinationUrl;
return;
}
@@ -365,7 +365,7 @@ function($, _, Backbone, gettext, BasePage, ViewUtils, ContainerView, XBlockView
}),
placeholderElement;
placeholderElement = $placeholderEl.appendTo(listPanel);
return $.postJSON(this.getURLRoot() + '/', requestData,
return $.postJSON(`${this.getURLRoot()}/`, requestData,
_.bind(this.onNewXBlock, this, placeholderElement, scrollOffset, false))
.fail(function() {
// Remove the placeholder if the update failed
@@ -476,15 +476,15 @@ function($, _, Backbone, gettext, BasePage, ViewUtils, ContainerView, XBlockView
useNewProblemEditor = this.$('.xblock-header-primary').attr('use-new-editor-problem');
// find the block type in the locator if availible
if(data.hasOwnProperty('locator')){
if(data.hasOwnProperty('locator')) {
var matchBlockTypeFromLocator = /\@(.*?)\+/;
var blockType = data.locator.match(matchBlockTypeFromLocator);
}
if((useNewTextEditor === 'True' && blockType.includes('html'))
|| (useNewVideoEditor === 'True' && blockType.includes('video'))
||(useNewProblemEditor === 'True' && blockType.includes('problem'))
){
var destinationUrl = this.$('.xblock-header-primary').attr('authoring_MFE_base_url') + '/' + blockType[1] + '/' + encodeURI(data.locator);
|| (useNewProblemEditor === 'True' && blockType.includes('problem'))
) {
var destinationUrl = `${this.$('.xblock-header-primary').attr('authoring_MFE_base_url')}/${blockType[1]}/${encodeURI(data.locator)}`;
window.location.href = destinationUrl;
return;
}

View File

@@ -125,7 +125,7 @@ function($, _, gettext, BasePage, XBlockViewUtils, CourseOutlineView, ViewUtils,
* at 100 millisecond intervals until element is found or
* Polling is reached
*/
scrollToElement: function () {
scrollToElement: function() {
this.findElementPollingTimeout -= this.pollingDelay;
const elementID = window.location.hash.replace('#', '');

View File

@@ -43,7 +43,7 @@ function($, _, gettext, BasePage, GroupConfigurationsListView, PartitionGroupLis
// Render the remaining Configuration groups
for (i = 0; i < this.allGroupViewList.length; i++) {
currentClass = '.wrapper-groups.content-groups.' + this.allGroupViewList[i].scheme;
currentClass = `.wrapper-groups.content-groups.${this.allGroupViewList[i].scheme}`;
this.$(currentClass).append(this.allGroupViewList[i].render().el);
}
@@ -103,7 +103,7 @@ function($, _, gettext, BasePage, GroupConfigurationsListView, PartitionGroupLis
if (groupConfig) {
groupConfig.set('showGroups', true);
this.$('#' + id).focus();
this.$(`#${id}`).focus();
}
}
});

View File

@@ -26,7 +26,7 @@
var sortColumn = this.collection.sortColumn;
this.renderPageItems();
this.$('.column-sort-link').removeClass('current-sort');
this.$('#' + sortColumn).addClass('current-sort');
this.$(`#${sortColumn}`).addClass('current-sort');
},
onError: function() {
@@ -55,7 +55,7 @@
filterableColumnInfo: function(filterColumn) {
var filterInfo = this.filterableColumns[filterColumn];
if (!filterInfo) {
throw "Unregistered filter column '" + filterInfo + '"';
throw `Unregistered filter column '${filterInfo}"`;
}
return filterInfo;
},
@@ -91,7 +91,7 @@
sortableColumnInfo: function(sortColumn) {
var sortInfo = this.sortableColumns[sortColumn];
if (!sortInfo) {
throw "Unregistered sort column '" + sortColumn + '"';
throw `Unregistered sort column '${sortColumn}"`;
}
return sortInfo;
},

View File

@@ -22,7 +22,7 @@ define([
return [
'collection',
'partition-group-details',
'partition-group-details-' + index
`partition-group-details-${index}`
].join(' ');
},

View File

@@ -81,7 +81,7 @@ define(
gettext('Removing'),
function() {
return $.ajax({
url: videoView.videoHandlerUrl + '/' + videoView.model.get('edx_video_id'),
url: `${videoView.videoHandlerUrl}/${videoView.model.get('edx_video_id')}`,
type: 'DELETE'
}).done(function() {
videoView.remove();

View File

@@ -91,7 +91,7 @@ function(ValidatingView, $, _, gettext, CodeMirror, ValidationErrorModal, HtmlUt
var firstNonWhite = stringValue.substring(0, 1);
if (firstNonWhite !== '{' && firstNonWhite !== '[' && firstNonWhite !== "'") {
try {
stringValue = '"' + stringValue + '"';
stringValue = `"${stringValue}"`;
JSONValue = JSON.parse(stringValue);
mirror.setValue(stringValue);
} catch (quotedE) {

View File

@@ -114,11 +114,11 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) {
},
renderGracePeriod: function() {
var format = function(time) {
return time >= 10 ? time.toString() : '0' + time;
return time >= 10 ? time.toString() : `0${time}`;
};
var grace_period = this.model.get('grace_period');
this.$el.find('#course-grading-graceperiod').val(
format(grace_period.hours) + ':' + format(grace_period.minutes)
`${format(grace_period.hours)}:${format(grace_period.minutes)}`
);
},
renderMinimumGradeCredit: function() {
@@ -266,7 +266,7 @@ function(ValidatingView, _, $, ui, GraderView, StringUtils, HtmlUtils) {
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);
$(this).text(min + '-' + max);
$(this).text(`${min}-${max}`);
});
},

View File

@@ -87,33 +87,33 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
DateUtils.setupDatePicker('enrollment_end', this);
DateUtils.setupDatePicker('upgrade_deadline', 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') !== '') {
this.$el.find('#' + this.fieldToSelectorMap.title).val(this.model.get('title'));
this.$el.find(`#${this.fieldToSelectorMap.title}`).val(this.model.get('title'));
} else {
var displayName = this.$el.find('#' + this.fieldToSelectorMap.title).attr('data-display-name');
this.$el.find('#' + this.fieldToSelectorMap.title).val(displayName);
var displayName = this.$el.find(`#${this.fieldToSelectorMap.title}`).attr('data-display-name');
this.$el.find(`#${this.fieldToSelectorMap.title}`).val(displayName);
}
this.$el.find('#' + this.fieldToSelectorMap.subtitle).val(this.model.get('subtitle'));
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.subtitle}`).val(this.model.get('subtitle'));
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.about_sidebar_html).val(
this.$el.find(`#${this.fieldToSelectorMap.short_description}`).val(this.model.get('short_description'));
this.$el.find(`#${this.fieldToSelectorMap.about_sidebar_html}`).val(
this.model.get('about_sidebar_html')
);
this.codeMirrorize(null, $('#course-about-sidebar-html')[0]);
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(); }
this.$el.find('#' + this.fieldToSelectorMap.effort).val(this.model.get('effort'));
this.$el.find('#' + this.fieldToSelectorMap.certificates_display_behavior).val(this.model.get('certificates_display_behavior'));
this.$el.find(`#${this.fieldToSelectorMap.effort}`).val(this.model.get('effort'));
this.$el.find(`#${this.fieldToSelectorMap.certificates_display_behavior}`).val(this.model.get('certificates_display_behavior'));
this.updateCertificatesDisplayBehavior();
var courseImageURL = this.model.get('course_image_asset_path');
@@ -130,16 +130,16 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
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');
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'),
@@ -233,16 +233,16 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
var value;
var index = event.currentTarget.getAttribute('data-index');
switch (event.currentTarget.id) {
case 'course-learning-info-' + index:
case `course-learning-info-${index}`:
value = $(event.currentTarget).val();
var learningInfo = this.model.get('learning_info');
learningInfo[index] = value;
this.showNotificationBar();
break;
case 'course-instructor-name-' + index:
case 'course-instructor-title-' + index:
case 'course-instructor-organization-' + index:
case 'course-instructor-bio-' + index:
case `course-instructor-name-${index}`:
case `course-instructor-title-${index}`:
case `course-instructor-organization-${index}`:
case `course-instructor-bio-${index}`:
value = $(event.currentTarget).val();
var field = event.currentTarget.getAttribute('data-field'),
instructors = this.model.get('instructor_info').instructors.slice(0);
@@ -250,12 +250,12 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
this.model.set('instructor_info', {instructors: instructors});
this.showNotificationBar();
break;
case 'course-instructor-image-' + index:
case `course-instructor-image-${index}`:
instructors = this.model.get('instructor_info').instructors.slice(0);
instructors[index].image = $(event.currentTarget).val();
this.model.set('instructor_info', {instructors: instructors});
this.showNotificationBar();
this.updateImagePreview(event.currentTarget, '#course-instructor-image-preview-' + index);
this.updateImagePreview(event.currentTarget, `#course-instructor-image-preview-${index}`);
break;
case 'course-image-url':
this.updateImageField(event, 'course_image_name', '#course-image');
@@ -345,7 +345,7 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
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();
}
},
@@ -379,7 +379,7 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
}
});
cmTextArea = this.codeMirrors[thisTarget.id].getInputField();
cmTextArea.setAttribute('id', thisTarget.id + '-cm-textarea');
cmTextArea.setAttribute('id', `${thisTarget.id}-cm-textarea`);
}
},
@@ -388,7 +388,7 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
Hides and clears the certificate available date field if a display behavior that doesn't use it is
chosen. Because we are clearing it, toggling back to "end_with_date" will require re-entering the date
*/
if (!this.useV2CertDisplaySettings){
if (!this.useV2CertDisplaySettings) {
return;
}
let showDatepicker = this.model.get('certificates_display_behavior') == 'end_with_date';
@@ -402,7 +402,7 @@ function(ValidatingView, CodeMirror, _, $, ui, DateUtils, FileUploadModel,
datepicker.prop('disabled', true);
datepicker.val(null);
this.clearValidationErrors();
this.setAndValidate('certificate_available_date', null)
this.setAndValidate('certificate_available_date', null);
certificateAvailableDateField.addClass('hidden');
}
},

Some files were not shown because too many files have changed in this diff Show More