mirror of
https://github.com/wekan/wekan.git
synced 2025-12-23 19:00:12 +01:00
Prettier & eslint project style update
This commit is contained in:
parent
a0a482aa8e
commit
3eb4d2c341
116 changed files with 6216 additions and 5240 deletions
|
|
@ -18,8 +18,8 @@ Template.memberMenuPopup.events({
|
|||
'click .js-change-avatar': Popup.open('changeAvatar'),
|
||||
'click .js-change-password': Popup.open('changePassword'),
|
||||
'click .js-change-language': Popup.open('changeLanguage'),
|
||||
'click .js-logout'(evt) {
|
||||
evt.preventDefault();
|
||||
'click .js-logout'(event) {
|
||||
event.preventDefault();
|
||||
|
||||
AccountsTemplates.logout();
|
||||
},
|
||||
|
|
@ -38,12 +38,12 @@ Template.editProfilePopup.helpers({
|
|||
});
|
||||
|
||||
Template.editProfilePopup.events({
|
||||
submit(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const fullname = tpl.find('.js-profile-fullname').value.trim();
|
||||
const username = tpl.find('.js-profile-username').value.trim();
|
||||
const initials = tpl.find('.js-profile-initials').value.trim();
|
||||
const email = tpl.find('.js-profile-email').value.trim();
|
||||
submit(event, templateInstance) {
|
||||
event.preventDefault();
|
||||
const fullname = templateInstance.find('.js-profile-fullname').value.trim();
|
||||
const username = templateInstance.find('.js-profile-username').value.trim();
|
||||
const initials = templateInstance.find('.js-profile-initials').value.trim();
|
||||
const email = templateInstance.find('.js-profile-email').value.trim();
|
||||
let isChangeUserName = false;
|
||||
let isChangeEmail = false;
|
||||
Users.update(Meteor.userId(), {
|
||||
|
|
@ -53,29 +53,36 @@ Template.editProfilePopup.events({
|
|||
},
|
||||
});
|
||||
isChangeUserName = username !== Meteor.user().username;
|
||||
isChangeEmail = email.toLowerCase() !== Meteor.user().emails[0].address.toLowerCase();
|
||||
isChangeEmail =
|
||||
email.toLowerCase() !== Meteor.user().emails[0].address.toLowerCase();
|
||||
if (isChangeUserName && isChangeEmail) {
|
||||
Meteor.call('setUsernameAndEmail', username, email.toLowerCase(), Meteor.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(),
|
||||
Meteor.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.back();
|
||||
}
|
||||
} else {
|
||||
usernameMessageElement.hide();
|
||||
emailMessageElement.hide();
|
||||
Popup.back();
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
} else if (isChangeUserName) {
|
||||
Meteor.call('setUsername', username, Meteor.userId(), function (error) {
|
||||
const messageElement = tpl.$('.username-taken');
|
||||
Meteor.call('setUsername', username, Meteor.userId(), function(error) {
|
||||
const messageElement = templateInstance.$('.username-taken');
|
||||
if (error) {
|
||||
messageElement.show();
|
||||
} else {
|
||||
|
|
@ -84,8 +91,10 @@ Template.editProfilePopup.events({
|
|||
}
|
||||
});
|
||||
} else if (isChangeEmail) {
|
||||
Meteor.call('setEmail', email.toLowerCase(), Meteor.userId(), function (error) {
|
||||
const messageElement = tpl.$('.email-taken');
|
||||
Meteor.call('setEmail', email.toLowerCase(), Meteor.userId(), function(
|
||||
error,
|
||||
) {
|
||||
const messageElement = templateInstance.$('.email-taken');
|
||||
if (error) {
|
||||
messageElement.show();
|
||||
} else {
|
||||
|
|
@ -104,7 +113,7 @@ Template.editProfilePopup.events({
|
|||
|
||||
// XXX For some reason the useraccounts autofocus isnt working in this case.
|
||||
// See https://github.com/meteor-useraccounts/core/issues/384
|
||||
Template.changePasswordPopup.onRendered(function () {
|
||||
Template.changePasswordPopup.onRendered(function() {
|
||||
this.find('#at-field-current_password').focus();
|
||||
});
|
||||
|
||||
|
|
@ -123,7 +132,7 @@ Template.changeLanguagePopup.helpers({
|
|||
name = 'Occitan';
|
||||
}
|
||||
return { tag, name };
|
||||
}).sort(function (a, b) {
|
||||
}).sort(function(a, b) {
|
||||
if (a.name === b.name) {
|
||||
return 0;
|
||||
} else {
|
||||
|
|
@ -138,13 +147,13 @@ Template.changeLanguagePopup.helpers({
|
|||
});
|
||||
|
||||
Template.changeLanguagePopup.events({
|
||||
'click .js-set-language'(evt) {
|
||||
'click .js-set-language'(event) {
|
||||
Users.update(Meteor.userId(), {
|
||||
$set: {
|
||||
'profile.language': this.tag,
|
||||
},
|
||||
});
|
||||
evt.preventDefault();
|
||||
event.preventDefault();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -161,9 +170,12 @@ Template.changeSettingsPopup.events({
|
|||
'click .js-toggle-system-messages'() {
|
||||
Meteor.call('toggleSystemMessages');
|
||||
},
|
||||
'click .js-apply-show-cards-at'(evt, tpl) {
|
||||
evt.preventDefault();
|
||||
const minLimit = parseInt(tpl.$('#show-cards-count-at').val(), 10);
|
||||
'click .js-apply-show-cards-at'(event, templateInstance) {
|
||||
event.preventDefault();
|
||||
const minLimit = parseInt(
|
||||
templateInstance.$('#show-cards-count-at').val(),
|
||||
10,
|
||||
);
|
||||
if (!isNaN(minLimit)) {
|
||||
Meteor.call('changeLimitToShowCardsCount', minLimit);
|
||||
Popup.back();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue