fix: eslint autofixable issues (#32181)
* 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 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 * fix: all autofixable eslint issues * fix: all react related fixable issues * fix: autofixable eslint issues * chore: remove all template literals * fix: remaining autofixable issues * fix: failing js test
This commit is contained in:
committed by
GitHub
parent
f2daf37d4a
commit
d7053a6783
@@ -1,4 +1,4 @@
|
||||
(function (define){
|
||||
(function(define) {
|
||||
'use strict';
|
||||
|
||||
define([
|
||||
@@ -19,10 +19,10 @@
|
||||
'js/student_account/views/account_settings_fields',
|
||||
'js/views/message_banner',
|
||||
'string_utils'
|
||||
], function (gettext, $, _, Backbone, Logger, StringUtils, PagingCollection, AccountSettingsModel,
|
||||
], function(gettext, $, _, Backbone, Logger, StringUtils, PagingCollection, AccountSettingsModel,
|
||||
AccountPreferencesModel, FieldsView, LearnerProfileFieldsView, LearnerProfileView, BadgeModel,
|
||||
BadgeListContainer, AccountSettingsFieldViews, MessageBannerView){
|
||||
return function (options) {
|
||||
BadgeListContainer, AccountSettingsFieldViews, MessageBannerView) {
|
||||
return function(options) {
|
||||
var $learnerProfileElement = $('.wrapper-profile');
|
||||
|
||||
var accountSettingsModel = new AccountSettingsModel(
|
||||
@@ -122,7 +122,7 @@
|
||||
helpMessage: '',
|
||||
userLanguage: accountSettingsModel.get('language'),
|
||||
userTimezone: accountPreferencesModel.get('time_zone'),
|
||||
dateFormat: 'MMMM YYYY' // not localized, but hopefully ok.
|
||||
dateFormat: 'MMMM YYYY' // not localized, but hopefully ok.
|
||||
}),
|
||||
|
||||
new FieldsView.DropdownFieldView({
|
||||
@@ -208,7 +208,7 @@
|
||||
platformName: options.platform_name
|
||||
});
|
||||
|
||||
getProfileVisibility = function (){
|
||||
getProfileVisibility = function() {
|
||||
if (options.has_preferences_access) {
|
||||
return accountPreferencesModel.get('account_privacy');
|
||||
} else {
|
||||
@@ -216,7 +216,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
showLearnerProfileView = function (){
|
||||
showLearnerProfileView = function() {
|
||||
// Record that the profile page was viewed
|
||||
Logger.log('edx.user.settings.viewed', {
|
||||
page: 'profile',
|
||||
|
||||
@@ -210,7 +210,6 @@ define(
|
||||
LearnerProfileHelpers.expectPage(learnerProfileView, LearnerProfileHelpers.firstPageBadges);
|
||||
});
|
||||
|
||||
|
||||
it('renders the limited profile for under 13 users', function() {
|
||||
var context = createProfilePage(
|
||||
true,
|
||||
|
||||
@@ -79,4 +79,3 @@ function(Backbone, $, _, PagingCollection, LearnerProfileHelpers, BadgeListView)
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -138,10 +138,12 @@ define(
|
||||
|
||||
// Upon successful image upload, account settings model will be fetched to
|
||||
// get the url for newly uploaded image, So we need to send the response for that GET
|
||||
data = {profile_image: {
|
||||
image_url_large: '/media/profile-images/' + imageName,
|
||||
has_image: true
|
||||
}};
|
||||
data = {
|
||||
profile_image: {
|
||||
image_url_large: '/media/profile-images/' + imageName,
|
||||
has_image: true
|
||||
}
|
||||
};
|
||||
AjaxHelpers.respondWithJson(requests, data);
|
||||
|
||||
// Verify uploaded image name
|
||||
@@ -160,7 +162,6 @@ define(
|
||||
var data;
|
||||
imageView.render();
|
||||
|
||||
|
||||
// Verify image remove title
|
||||
verifyImageRemoveButtonMessage(imageView, false);
|
||||
|
||||
@@ -177,10 +178,12 @@ define(
|
||||
|
||||
// Upon successful image removal, account settings model will be fetched to get default image url
|
||||
// So we need to send the response for that GET
|
||||
data = {profile_image: {
|
||||
image_url_large: '/media/profile-images/default.jpg',
|
||||
has_image: false
|
||||
}};
|
||||
data = {
|
||||
profile_image: {
|
||||
image_url_large: '/media/profile-images/default.jpg',
|
||||
has_image: false
|
||||
}
|
||||
};
|
||||
AjaxHelpers.respondWithJson(requests, data);
|
||||
|
||||
// Remove button should not be present for default image
|
||||
|
||||
@@ -124,8 +124,8 @@ define(
|
||||
editable: editable,
|
||||
showMessages: false,
|
||||
title: 'About me',
|
||||
placeholderValue: 'Tell other edX learners a little about yourself: where you live, ' +
|
||||
"what your interests are, why you're taking courses on edX, or what you hope to learn.",
|
||||
placeholderValue: 'Tell other edX learners a little about yourself: where you live, '
|
||||
+ "what your interests are, why you're taking courses on edX, or what you hope to learn.",
|
||||
valueAttribute: 'bio',
|
||||
helpMessage: '',
|
||||
messagePosition: 'header'
|
||||
|
||||
@@ -25,8 +25,8 @@ define(
|
||||
editable: editable,
|
||||
showMessages: false,
|
||||
title: 'About me',
|
||||
placeholderValue: 'Tell other edX learners a little about yourself: where you live, ' +
|
||||
"what your interests are, why you're taking courses on edX, or what you hope to learn.",
|
||||
placeholderValue: 'Tell other edX learners a little about yourself: where you live, '
|
||||
+ "what your interests are, why you're taking courses on edX, or what you hope to learn.",
|
||||
valueAttribute: 'bio',
|
||||
helpMessage: '',
|
||||
messagePosition: 'header'
|
||||
|
||||
@@ -150,8 +150,8 @@ define(['underscore', 'URI', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers'
|
||||
var expectPage = function(learnerProfileView, pageData) {
|
||||
var $badgeListContainer = $('#tabpanel-accomplishments');
|
||||
var index = $badgeListContainer.find('span.search-count').text().trim();
|
||||
expect(index).toBe('Showing ' + (pageData.start + 1) + '-' + (pageData.start + pageData.results.length) +
|
||||
' out of ' + pageData.count + ' total');
|
||||
expect(index).toBe('Showing ' + (pageData.start + 1) + '-' + (pageData.start + pageData.results.length)
|
||||
+ ' out of ' + pageData.count + ' total');
|
||||
expect($badgeListContainer.find('.current-page').text()).toBe('' + pageData.current_page);
|
||||
_.each(pageData.results, function(badge) {
|
||||
expect($('.badge-display:contains(' + badge.badge_class.display_name + ')').length).toBe(1);
|
||||
@@ -161,8 +161,8 @@ define(['underscore', 'URI', 'edx-ui-toolkit/js/utils/spec-helpers/ajax-helpers'
|
||||
var expectBadgeLoadingErrorIsRendered = function() {
|
||||
var errorMessage = $('.badge-set-display').text();
|
||||
expect(errorMessage).toBe(
|
||||
'Your request could not be completed. Reload the page and try again. If the issue persists, click the ' +
|
||||
'Help tab to report the problem.'
|
||||
'Your request could not be completed. Reload the page and try again. If the issue persists, click the '
|
||||
+ 'Help tab to report the problem.'
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -41,14 +41,14 @@
|
||||
if (this.profileIsPrivate) {
|
||||
this._super(
|
||||
HtmlUtils.interpolateHtml(
|
||||
gettext('You must specify your birth year before you can share your full profile. To specify your birth year, go to the {account_settings_page_link}'), // eslint-disable-line max-len
|
||||
gettext('You must specify your birth year before you can share your full profile. To specify your birth year, go to the {account_settings_page_link}'), // eslint-disable-line max-len
|
||||
{account_settings_page_link: accountSettingsLink}
|
||||
)
|
||||
);
|
||||
} else if (this.requiresParentalConsent) {
|
||||
this._super(
|
||||
HtmlUtils.interpolateHtml(
|
||||
gettext('You must be over 13 to share a full profile. If you are over 13, make sure that you have specified a birth year on the {account_settings_page_link}'), // eslint-disable-line max-len
|
||||
gettext('You must be over 13 to share a full profile. If you are over 13, make sure that you have specified a birth year on the {account_settings_page_link}'), // eslint-disable-line max-len
|
||||
{account_settings_page_link: accountSettingsLink}
|
||||
)
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
(function (define){
|
||||
(function(define) {
|
||||
'use strict';
|
||||
|
||||
define(
|
||||
@@ -7,10 +7,10 @@
|
||||
'common/js/components/views/tabbed_view',
|
||||
'learner_profile/js/views/section_two_tab'
|
||||
],
|
||||
function (gettext, $, _, Backbone, HtmlUtils, TabbedView, SectionTwoTab){
|
||||
function(gettext, $, _, Backbone, HtmlUtils, TabbedView, SectionTwoTab) {
|
||||
var LearnerProfileView = Backbone.View.extend({
|
||||
|
||||
initialize: function (options){
|
||||
initialize: function(options) {
|
||||
var Router;
|
||||
this.options = _.extend({}, options);
|
||||
_.bindAll(this, 'showFullProfile', 'render', 'renderFields', 'showLoadingError');
|
||||
@@ -23,7 +23,7 @@
|
||||
this.firstRender = true;
|
||||
},
|
||||
|
||||
showFullProfile: function () {
|
||||
showFullProfile: function() {
|
||||
var isAboveMinimumAge = this.options.accountSettingsModel.isAboveMinimumAge();
|
||||
if (this.options.ownProfile) {
|
||||
return isAboveMinimumAge
|
||||
@@ -33,14 +33,14 @@
|
||||
}
|
||||
},
|
||||
|
||||
setActiveTab: function (tab){
|
||||
setActiveTab: function(tab) {
|
||||
// This tab may not actually exist.
|
||||
if (this.tabbedView.getTabMeta(tab).tab) {
|
||||
this.tabbedView.setActiveTab(tab);
|
||||
}
|
||||
},
|
||||
|
||||
render: function (){
|
||||
render: function() {
|
||||
var tabs,
|
||||
$tabbedViewElement,
|
||||
$wrapperProfileBioElement = this.$el.find('.wrapper-profile-bio'),
|
||||
@@ -77,9 +77,9 @@
|
||||
];
|
||||
|
||||
// Build the accomplishments Tab and fill with data
|
||||
this.options.badgeListContainer.collection.fetch().done(function (){
|
||||
this.options.badgeListContainer.collection.fetch().done(function() {
|
||||
self.options.badgeListContainer.render();
|
||||
}).error(function (){
|
||||
}).error(function() {
|
||||
self.options.badgeListContainer.renderError();
|
||||
});
|
||||
|
||||
@@ -115,13 +115,13 @@
|
||||
return this;
|
||||
},
|
||||
|
||||
isCoppaCompliant: function (){
|
||||
isCoppaCompliant: function() {
|
||||
var enableCoppaCompliance = this.options.accountSettingsModel.get('enable_coppa_compliance'),
|
||||
isAboveAge = this.options.accountSettingsModel.isAboveMinimumAge();
|
||||
return !enableCoppaCompliance || (enableCoppaCompliance && isAboveAge);
|
||||
},
|
||||
|
||||
renderFields: function (){
|
||||
renderFields: function() {
|
||||
var view = this,
|
||||
fieldView,
|
||||
imageView,
|
||||
@@ -150,14 +150,14 @@
|
||||
imageView = this.options.profileImageFieldView;
|
||||
this.$('.profile-image-field').append(imageView.render().el);
|
||||
|
||||
if (this.showFullProfile()){
|
||||
_.each(this.options.sectionOneFieldViews, function (childFieldView) {
|
||||
if (this.showFullProfile()) {
|
||||
_.each(this.options.sectionOneFieldViews, function(childFieldView) {
|
||||
view.$('.profile-section-one-fields').append(childFieldView.render().el);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
showLoadingError: function (){
|
||||
showLoadingError: function() {
|
||||
this.$('.ui-loading-indicator').addClass('is-hidden');
|
||||
this.$('.ui-loading-error').removeClass('is-hidden');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user