summaryrefslogtreecommitdiffstats
path: root/client/components/settings/peopleBody.js
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/peopleBody.js
parenta0a482aa8efb3255a523de4524c8e09453d5571f (diff)
downloadwekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.gz
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.tar.bz2
wekan-3eb4d2c341b712268bd321173909e0a7b19a88c9.zip
Prettier & eslint project style update
Diffstat (limited to 'client/components/settings/peopleBody.js')
-rw-r--r--client/components/settings/peopleBody.js120
1 files changed, 69 insertions, 51 deletions
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') {