mirror of
https://github.com/wekan/wekan.git
synced 2026-02-05 08:01:49 +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
|
|
@ -22,14 +22,11 @@ Template.userAvatar.helpers({
|
|||
presenceStatusClassName() {
|
||||
const user = Users.findOne(this.userId);
|
||||
const userPresence = presences.findOne({ userId: this.userId });
|
||||
if (user && user.isInvitedTo(Session.get('currentBoard')))
|
||||
return 'pending';
|
||||
else if (!userPresence)
|
||||
return 'disconnected';
|
||||
if (user && user.isInvitedTo(Session.get('currentBoard'))) return 'pending';
|
||||
else if (!userPresence) return 'disconnected';
|
||||
else if (Session.equals('currentBoard', userPresence.state.currentBoardId))
|
||||
return 'active';
|
||||
else
|
||||
return 'idle';
|
||||
else return 'idle';
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -45,7 +42,7 @@ Template.userAvatarInitials.helpers({
|
|||
|
||||
viewPortWidth() {
|
||||
const user = Users.findOne(this.userId);
|
||||
return (user && user.getInitials().length || 1) * 12;
|
||||
return ((user && user.getInitials().length) || 1) * 12;
|
||||
},
|
||||
});
|
||||
|
||||
|
|
@ -64,7 +61,7 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
uploadedAvatars() {
|
||||
return Avatars.find({userId: Meteor.userId()});
|
||||
return Avatars.find({ userId: Meteor.userId() });
|
||||
},
|
||||
|
||||
isSelected() {
|
||||
|
|
@ -89,46 +86,48 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
events() {
|
||||
return [{
|
||||
'click .js-upload-avatar'() {
|
||||
this.$('.js-upload-avatar-input').click();
|
||||
},
|
||||
'change .js-upload-avatar-input'(evt) {
|
||||
let file, fileUrl;
|
||||
return [
|
||||
{
|
||||
'click .js-upload-avatar'() {
|
||||
this.$('.js-upload-avatar-input').click();
|
||||
},
|
||||
'change .js-upload-avatar-input'(event) {
|
||||
let file, fileUrl;
|
||||
|
||||
FS.Utility.eachFile(evt, (f) => {
|
||||
try {
|
||||
file = Avatars.insert(new FS.File(f));
|
||||
fileUrl = file.url(this.avatarUrlOptions());
|
||||
} catch (e) {
|
||||
this.setError('avatar-too-big');
|
||||
FS.Utility.eachFile(event, f => {
|
||||
try {
|
||||
file = Avatars.insert(new FS.File(f));
|
||||
fileUrl = file.url(this.avatarUrlOptions());
|
||||
} catch (e) {
|
||||
this.setError('avatar-too-big');
|
||||
}
|
||||
});
|
||||
|
||||
if (fileUrl) {
|
||||
this.setError('');
|
||||
const fetchAvatarInterval = window.setInterval(() => {
|
||||
$.ajax({
|
||||
url: fileUrl,
|
||||
success: () => {
|
||||
this.setAvatar(file.url(this.avatarUrlOptions()));
|
||||
window.clearInterval(fetchAvatarInterval);
|
||||
},
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
|
||||
if (fileUrl) {
|
||||
this.setError('');
|
||||
const fetchAvatarInterval = window.setInterval(() => {
|
||||
$.ajax({
|
||||
url: fileUrl,
|
||||
success: () => {
|
||||
this.setAvatar(file.url(this.avatarUrlOptions()));
|
||||
window.clearInterval(fetchAvatarInterval);
|
||||
},
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
'click .js-select-avatar'() {
|
||||
const avatarUrl = this.currentData().url(this.avatarUrlOptions());
|
||||
this.setAvatar(avatarUrl);
|
||||
},
|
||||
'click .js-select-initials'() {
|
||||
this.setAvatar('');
|
||||
},
|
||||
'click .js-delete-avatar'() {
|
||||
Avatars.remove(this.currentData()._id);
|
||||
},
|
||||
},
|
||||
'click .js-select-avatar'() {
|
||||
const avatarUrl = this.currentData().url(this.avatarUrlOptions());
|
||||
this.setAvatar(avatarUrl);
|
||||
},
|
||||
'click .js-select-initials'() {
|
||||
this.setAvatar('');
|
||||
},
|
||||
'click .js-delete-avatar'() {
|
||||
Avatars.remove(this.currentData()._id);
|
||||
},
|
||||
}];
|
||||
];
|
||||
},
|
||||
}).register('changeAvatarPopup');
|
||||
|
||||
|
|
@ -146,11 +145,11 @@ Template.cardMembersPopup.helpers({
|
|||
});
|
||||
|
||||
Template.cardMembersPopup.events({
|
||||
'click .js-select-member'(evt) {
|
||||
'click .js-select-member'(event) {
|
||||
const card = Cards.findOne(Session.get('currentCard'));
|
||||
const memberId = this.userId;
|
||||
card.toggleMember(memberId);
|
||||
evt.preventDefault();
|
||||
event.preventDefault();
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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