summaryrefslogtreecommitdiffstats
path: root/client/components/settings
diff options
context:
space:
mode:
authorJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:52:09 -0500
committerJustin Reynolds <justinr1234@gmail.com>2019-06-28 12:56:51 -0500
commit3eb4d2c341b712268bd321173909e0a7b19a88c9 (patch)
tree25a8fcb088f3984e72a5bd3ded9e6a45376e0693 /client/components/settings
parenta0a482aa8efb3255a523de4524c8e09453d5571f (diff)
downloadwekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.gz
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.bz2
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.zip
Prettier & eslint project style update
Diffstat (limited to 'client/components/settings')
-rw-r--r--client/components/settings/connectionMethod.js10
-rw-r--r--client/components/settings/peopleBody.js120
-rw-r--r--client/components/settings/settingBody.js143
3 files changed, 166 insertions, 107 deletions
diff --git a/client/components/settings/connectionMethod.js b/client/components/settings/connectionMethod.js
index db9da25f..6abfd743 100644
--- a/client/components/settings/connectionMethod.js
+++ b/client/components/settings/connectionMethod.js
@@ -6,9 +6,11 @@ Template.connectionMethod.onCreated(function() {
// TODO : add a management of different languages
// (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')})
this.authenticationMethods.set([
- {value: 'password'},
+ { value: 'password' },
// Gets only the authentication methods availables
- ...Object.entries(result).filter((e) => e[1]).map((e) => ({value: e[0]})),
+ ...Object.entries(result)
+ .filter(e => e[1])
+ .map(e => ({ value: e[0] })),
]);
}
@@ -24,7 +26,9 @@ Template.connectionMethod.onCreated(function() {
Template.connectionMethod.onRendered(() => {
// Moves the select boxe in the first place of the at-pwd-form div
- $('.at-form-authentication').detach().prependTo('.at-pwd-form');
+ $('.at-form-authentication')
+ .detach()
+ .prependTo('.at-pwd-form');
});
Template.connectionMethod.helpers({
diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js
index 83cf14fa..b09f6599 100644
--- a/client/components/settings/peopleBody.js
+++ b/client/components/settings/peopleBody.js
@@ -29,19 +29,23 @@ BlazeComponent.extendComponent({
});
},
events() {
- return [{
- 'click #searchButton'() {
- this.filterPeople();
- },
- 'keydown #searchInput'(event) {
- if (event.keyCode === 13 && !event.shiftKey) {
+ return [
+ {
+ 'click #searchButton'() {
this.filterPeople();
- }
+ },
+ 'keydown #searchInput'(event) {
+ if (event.keyCode === 13 && !event.shiftKey) {
+ this.filterPeople();
+ }
+ },
},
- }];
+ ];
},
filterPeople() {
- const value = $('#searchInput').first().val();
+ const value = $('#searchInput')
+ .first()
+ .val();
if (value === '') {
this.findUsersOptions.set({});
} else {
@@ -79,7 +83,7 @@ BlazeComponent.extendComponent({
},
peopleList() {
const users = Users.find(this.findUsersOptions.get(), {
- fields: {_id: true},
+ fields: { _id: true },
});
this.number.set(users.count());
return users;
@@ -105,9 +109,11 @@ Template.editUserPopup.onCreated(function() {
// TODO : add a management of different languages
// (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')})
this.authenticationMethods.set([
- {value: 'password'},
+ { value: 'password' },
// Gets only the authentication methods availables
- ...Object.entries(result).filter((e) => e[1]).map((e) => ({value: e[0]})),
+ ...Object.entries(result)
+ .filter(e => e[1])
+ .map(e => ({ value: e[0] })),
]);
}
});
@@ -136,69 +142,79 @@ Template.editUserPopup.helpers({
});
BlazeComponent.extendComponent({
- onCreated() {
- },
+ onCreated() {},
user() {
return Users.findOne(this.userId);
},
events() {
- return [{
- 'click a.edit-user': Popup.open('editUser'),
- }];
+ return [
+ {
+ 'click a.edit-user': Popup.open('editUser'),
+ },
+ ];
},
}).register('peopleRow');
Template.editUserPopup.events({
- submit(evt, tpl) {
- evt.preventDefault();
+ submit(event, templateInstance) {
+ event.preventDefault();
const user = Users.findOne(this.userId);
- const fullname = tpl.find('.js-profile-fullname').value.trim();
- const username = tpl.find('.js-profile-username').value.trim();
- const password = tpl.find('.js-profile-password').value;
- const isAdmin = tpl.find('.js-profile-isadmin').value.trim();
- const isActive = tpl.find('.js-profile-isactive').value.trim();
- const email = tpl.find('.js-profile-email').value.trim();
- const authentication = tpl.find('.js-authenticationMethod').value.trim();
+ const fullname = templateInstance.find('.js-profile-fullname').value.trim();
+ const username = templateInstance.find('.js-profile-username').value.trim();
+ const password = templateInstance.find('.js-profile-password').value;
+ const isAdmin = templateInstance.find('.js-profile-isadmin').value.trim();
+ const isActive = templateInstance.find('.js-profile-isactive').value.trim();
+ const email = templateInstance.find('.js-profile-email').value.trim();
+ const authentication = templateInstance
+ .find('.js-authenticationMethod')
+ .value.trim();
const isChangePassword = password.length > 0;
const isChangeUserName = username !== user.username;
- const isChangeEmail = email.toLowerCase() !== user.emails[0].address.toLowerCase();
+ const isChangeEmail =
+ email.toLowerCase() !== user.emails[0].address.toLowerCase();
Users.update(this.userId, {
$set: {
'profile.fullname': fullname,
- 'isAdmin': isAdmin === 'true',
- 'loginDisabled': isActive === 'true',
- 'authenticationMethod': authentication,
+ isAdmin: isAdmin === 'true',
+ loginDisabled: isActive === 'true',
+ authenticationMethod: authentication,
},
});
- if(isChangePassword){
+ if (isChangePassword) {
Meteor.call('setPassword', password, this.userId);
}
if (isChangeUserName && isChangeEmail) {
- Meteor.call('setUsernameAndEmail', username, email.toLowerCase(), this.userId, function (error) {
- const usernameMessageElement = tpl.$('.username-taken');
- const emailMessageElement = tpl.$('.email-taken');
- if (error) {
- const errorElement = error.error;
- if (errorElement === 'username-already-taken') {
- usernameMessageElement.show();
- emailMessageElement.hide();
- } else if (errorElement === 'email-already-taken') {
+ Meteor.call(
+ 'setUsernameAndEmail',
+ username,
+ email.toLowerCase(),
+ this.userId,
+ function(error) {
+ const usernameMessageElement = templateInstance.$('.username-taken');
+ const emailMessageElement = templateInstance.$('.email-taken');
+ if (error) {
+ const errorElement = error.error;
+ if (errorElement === 'username-already-taken') {
+ usernameMessageElement.show();
+ emailMessageElement.hide();
+ } else if (errorElement === 'email-already-taken') {
+ usernameMessageElement.hide();
+ emailMessageElement.show();
+ }
+ } else {
usernameMessageElement.hide();
- emailMessageElement.show();
+ emailMessageElement.hide();
+ Popup.close();
}
- } else {
- usernameMessageElement.hide();
- emailMessageElement.hide();
- Popup.close();
- }
- });
+ },
+ );
} else if (isChangeUserName) {
- Meteor.call('setUsername', username, this.userId, function (error) {
- const usernameMessageElement = tpl.$('.username-taken');
+ Meteor.call('setUsername', username, this.userId, function(error) {
+ const usernameMessageElement = templateInstance.$('.username-taken');
if (error) {
const errorElement = error.error;
if (errorElement === 'username-already-taken') {
@@ -210,8 +226,10 @@ Template.editUserPopup.events({
}
});
} else if (isChangeEmail) {
- Meteor.call('setEmail', email.toLowerCase(), this.userId, function (error) {
- const emailMessageElement = tpl.$('.email-taken');
+ Meteor.call('setEmail', email.toLowerCase(), this.userId, function(
+ error,
+ ) {
+ const emailMessageElement = templateInstance.$('.email-taken');
if (error) {
const errorElement = error.error;
if (errorElement === 'email-already-taken') {
diff --git a/client/components/settings/settingBody.js b/client/components/settings/settingBody.js
index 8279a092..4ec0c759 100644
--- a/client/components/settings/settingBody.js
+++ b/client/components/settings/settingBody.js
@@ -25,7 +25,9 @@ BlazeComponent.extendComponent({
checkField(selector) {
const value = $(selector).val();
if (!value || value.trim() === '') {
- $(selector).parents('li.smtp-form').addClass('has-error');
+ $(selector)
+ .parents('li.smtp-form')
+ .addClass('has-error');
throw Error('blank field');
} else {
return value;
@@ -37,18 +39,23 @@ BlazeComponent.extendComponent({
},
boards() {
- return Boards.find({
- archived: false,
- 'members.userId': Meteor.userId(),
- 'members.isAdmin': true,
- }, {
- sort: ['title'],
- });
+ return Boards.find(
+ {
+ archived: false,
+ 'members.userId': Meteor.userId(),
+ 'members.isAdmin': true,
+ },
+ {
+ sort: ['title'],
+ },
+ );
},
toggleRegistration() {
this.setLoading(true);
const registrationClosed = this.currentSetting().disableRegistration;
- Settings.update(Settings.findOne()._id, {$set: {disableRegistration: !registrationClosed}});
+ Settings.update(Settings.findOne()._id, {
+ $set: { disableRegistration: !registrationClosed },
+ });
this.setLoading(false);
if (registrationClosed) {
$('.invite-people').slideUp();
@@ -90,13 +97,19 @@ BlazeComponent.extendComponent({
},
inviteThroughEmail() {
- const emails = $('#email-to-invite').val().toLowerCase().trim().split('\n').join(',').split(',');
+ const emails = $('#email-to-invite')
+ .val()
+ .toLowerCase()
+ .trim()
+ .split('\n')
+ .join(',')
+ .split(',');
const boardsToInvite = [];
- $('.js-toggle-board-choose .materialCheckBox.is-checked').each(function () {
+ $('.js-toggle-board-choose .materialCheckBox.is-checked').each(function() {
boardsToInvite.push($(this).data('id'));
});
const validEmails = [];
- emails.forEach((email) => {
+ emails.forEach(email => {
if (email && SimpleSchema.RegEx.Email.test(email.trim())) {
validEmails.push(email.trim());
}
@@ -119,14 +132,22 @@ BlazeComponent.extendComponent({
try {
const host = this.checkField('#mail-server-host');
const port = this.checkField('#mail-server-port');
- const username = $('#mail-server-username').val().trim();
- const password = $('#mail-server-password').val().trim();
+ const username = $('#mail-server-username')
+ .val()
+ .trim();
+ const password = $('#mail-server-password')
+ .val()
+ .trim();
const from = this.checkField('#mail-server-from');
const tls = $('#mail-server-tls.is-checked').length > 0;
Settings.update(Settings.findOne()._id, {
$set: {
- 'mailServer.host': host, 'mailServer.port': port, 'mailServer.username': username,
- 'mailServer.password': password, 'mailServer.enableTLS': tls, 'mailServer.from': from,
+ 'mailServer.host': host,
+ 'mailServer.port': port,
+ 'mailServer.username': username,
+ 'mailServer.password': password,
+ 'mailServer.enableTLS': tls,
+ 'mailServer.from': from,
},
});
} catch (e) {
@@ -134,19 +155,25 @@ BlazeComponent.extendComponent({
} finally {
this.setLoading(false);
}
-
},
saveLayout() {
this.setLoading(true);
$('li').removeClass('has-error');
- const productName = $('#product-name').val().trim();
- const hideLogoChange = ($('input[name=hideLogo]:checked').val() === 'true');
- const displayAuthenticationMethod = ($('input[name=displayAuthenticationMethod]:checked').val() === 'true');
+ const productName = $('#product-name')
+ .val()
+ .trim();
+ const hideLogoChange = $('input[name=hideLogo]:checked').val() === 'true';
+ const displayAuthenticationMethod =
+ $('input[name=displayAuthenticationMethod]:checked').val() === 'true';
const defaultAuthenticationMethod = $('#defaultAuthenticationMethod').val();
- const customHTMLafterBodyStart = $('#customHTMLafterBodyStart').val().trim();
- const customHTMLbeforeBodyEnd = $('#customHTMLbeforeBodyEnd').val().trim();
+ const customHTMLafterBodyStart = $('#customHTMLafterBodyStart')
+ .val()
+ .trim();
+ const customHTMLbeforeBodyEnd = $('#customHTMLbeforeBodyEnd')
+ .val()
+ .trim();
try {
Settings.update(Settings.findOne()._id, {
@@ -166,7 +193,6 @@ BlazeComponent.extendComponent({
}
DocHead.setTitle(productName);
-
},
sendSMTPTestEmail() {
@@ -183,31 +209,35 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click a.js-toggle-registration': this.toggleRegistration,
- 'click a.js-toggle-tls': this.toggleTLS,
- 'click a.js-setting-menu': this.switchMenu,
- 'click a.js-toggle-board-choose': this.checkBoard,
- 'click button.js-email-invite': this.inviteThroughEmail,
- 'click button.js-save': this.saveMailServerInfo,
- 'click button.js-send-smtp-test-email': this.sendSMTPTestEmail,
- 'click a.js-toggle-hide-logo': this.toggleHideLogo,
- 'click button.js-save-layout': this.saveLayout,
- 'click a.js-toggle-display-authentication-method': this.toggleDisplayAuthenticationMethod,
- }];
+ return [
+ {
+ 'click a.js-toggle-registration': this.toggleRegistration,
+ 'click a.js-toggle-tls': this.toggleTLS,
+ 'click a.js-setting-menu': this.switchMenu,
+ 'click a.js-toggle-board-choose': this.checkBoard,
+ 'click button.js-email-invite': this.inviteThroughEmail,
+ 'click button.js-save': this.saveMailServerInfo,
+ 'click button.js-send-smtp-test-email': this.sendSMTPTestEmail,
+ 'click a.js-toggle-hide-logo': this.toggleHideLogo,
+ 'click button.js-save-layout': this.saveLayout,
+ 'click a.js-toggle-display-authentication-method': this
+ .toggleDisplayAuthenticationMethod,
+ },
+ ];
},
}).register('setting');
BlazeComponent.extendComponent({
-
saveAccountsChange() {
- const allowEmailChange = ($('input[name=allowEmailChange]:checked').val() === 'true');
- const allowUserNameChange = ($('input[name=allowUserNameChange]:checked').val() === 'true');
+ const allowEmailChange =
+ $('input[name=allowEmailChange]:checked').val() === 'true';
+ const allowUserNameChange =
+ $('input[name=allowUserNameChange]:checked').val() === 'true';
AccountSettings.update('accounts-allowEmailChange', {
- $set: {'booleanValue': allowEmailChange},
+ $set: { booleanValue: allowEmailChange },
});
AccountSettings.update('accounts-allowUserNameChange', {
- $set: {'booleanValue': allowUserNameChange},
+ $set: { booleanValue: allowUserNameChange },
});
},
@@ -219,9 +249,11 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click button.js-accounts-save': this.saveAccountsChange,
- }];
+ return [
+ {
+ 'click button.js-accounts-save': this.saveAccountsChange,
+ },
+ ];
},
}).register('accountSettings');
@@ -239,9 +271,11 @@ BlazeComponent.extendComponent({
},
saveMessage() {
- const message = $('#admin-announcement').val().trim();
+ const message = $('#admin-announcement')
+ .val()
+ .trim();
Announcements.update(Announcements.findOne()._id, {
- $set: {'body': message},
+ $set: { body: message },
});
},
@@ -249,7 +283,7 @@ BlazeComponent.extendComponent({
this.setLoading(true);
const isActive = this.currentSetting().enabled;
Announcements.update(Announcements.findOne()._id, {
- $set: {'enabled': !isActive},
+ $set: { enabled: !isActive },
});
this.setLoading(false);
if (isActive) {
@@ -260,14 +294,15 @@ BlazeComponent.extendComponent({
},
events() {
- return [{
- 'click a.js-toggle-activemessage': this.toggleActive,
- 'click button.js-announcement-save': this.saveMessage,
- }];
+ return [
+ {
+ 'click a.js-toggle-activemessage': this.toggleActive,
+ 'click button.js-announcement-save': this.saveMessage,
+ },
+ ];
},
}).register('announcementSettings');
-
Template.selectAuthenticationMethod.onCreated(function() {
this.authenticationMethods = new ReactiveVar([]);
@@ -276,9 +311,11 @@ Template.selectAuthenticationMethod.onCreated(function() {
// TODO : add a management of different languages
// (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')})
this.authenticationMethods.set([
- {value: 'password'},
+ { value: 'password' },
// Gets only the authentication methods availables
- ...Object.entries(result).filter((e) => e[1]).map((e) => ({value: e[0]})),
+ ...Object.entries(result)
+ .filter(e => e[1])
+ .map(e => ({ value: e[0] })),
]);
}
});