mirror of
https://github.com/wekan/wekan.git
synced 2026-01-30 05:05:17 +01:00
parent
7e036b9df3
commit
14b2c1309f
5 changed files with 237 additions and 118 deletions
|
|
@ -101,9 +101,7 @@ BlazeComponent.extendComponent({
|
|||
];
|
||||
},
|
||||
filterPeople() {
|
||||
const value = $('#searchInput')
|
||||
.first()
|
||||
.val();
|
||||
const value = $('#searchInput').first().val();
|
||||
if (value === '') {
|
||||
this.findUsersOptions.set({});
|
||||
} else {
|
||||
|
|
@ -203,7 +201,7 @@ Template.peopleRow.helpers({
|
|||
},
|
||||
});
|
||||
|
||||
Template.editUserPopup.onCreated(function() {
|
||||
Template.editUserPopup.onCreated(function () {
|
||||
this.authenticationMethods = new ReactiveVar([]);
|
||||
this.errorMessage = new ReactiveVar('');
|
||||
|
||||
|
|
@ -215,8 +213,8 @@ Template.editUserPopup.onCreated(function() {
|
|||
{ value: 'password' },
|
||||
// Gets only the authentication methods availables
|
||||
...Object.entries(result)
|
||||
.filter(e => e[1])
|
||||
.map(e => ({ value: e[0] })),
|
||||
.filter((e) => e[1])
|
||||
.map((e) => ({ value: e[0] })),
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
|
@ -262,15 +260,15 @@ Template.editUserPopup.helpers({
|
|||
},
|
||||
});
|
||||
|
||||
Template.newOrgPopup.onCreated(function() {
|
||||
Template.newOrgPopup.onCreated(function () {
|
||||
this.errorMessage = new ReactiveVar('');
|
||||
});
|
||||
|
||||
Template.newTeamPopup.onCreated(function() {
|
||||
Template.newTeamPopup.onCreated(function () {
|
||||
this.errorMessage = new ReactiveVar('');
|
||||
});
|
||||
|
||||
Template.newUserPopup.onCreated(function() {
|
||||
Template.newUserPopup.onCreated(function () {
|
||||
this.authenticationMethods = new ReactiveVar([]);
|
||||
this.errorMessage = new ReactiveVar('');
|
||||
|
||||
|
|
@ -282,8 +280,8 @@ Template.newUserPopup.onCreated(function() {
|
|||
{ value: 'password' },
|
||||
// Gets only the authentication methods availables
|
||||
...Object.entries(result)
|
||||
.filter(e => e[1])
|
||||
.map(e => ({ value: e[0] })),
|
||||
.filter((e) => e[1])
|
||||
.map((e) => ({ value: e[0] })),
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
|
@ -415,7 +413,8 @@ Template.editOrgPopup.events({
|
|||
const orgDesc = templateInstance.find('.js-orgDesc').value.trim();
|
||||
const orgShortName = templateInstance.find('.js-orgShortName').value.trim();
|
||||
const orgWebsite = templateInstance.find('.js-orgWebsite').value.trim();
|
||||
const orgIsActive = templateInstance.find('.js-org-isactive').value.trim() == 'true';
|
||||
const orgIsActive =
|
||||
templateInstance.find('.js-org-isactive').value.trim() == 'true';
|
||||
|
||||
const isChangeOrgDisplayName = orgDisplayName !== org.orgDisplayName;
|
||||
const isChangeOrgDesc = orgDesc !== org.orgDesc;
|
||||
|
|
@ -423,26 +422,24 @@ Template.editOrgPopup.events({
|
|||
const isChangeOrgWebsite = orgWebsite !== org.orgWebsite;
|
||||
const isChangeOrgIsActive = orgIsActive !== org.orgIsActive;
|
||||
|
||||
if(isChangeOrgDisplayName || isChangeOrgDesc || isChangeOrgShortName || isChangeOrgWebsite || isChangeOrgIsActive){
|
||||
Meteor.call('setOrgAllFields', org, orgDisplayName, orgDesc, orgShortName, orgWebsite, orgIsActive);
|
||||
if (
|
||||
isChangeOrgDisplayName ||
|
||||
isChangeOrgDesc ||
|
||||
isChangeOrgShortName ||
|
||||
isChangeOrgWebsite ||
|
||||
isChangeOrgIsActive
|
||||
) {
|
||||
Meteor.call(
|
||||
'setOrgAllFields',
|
||||
org,
|
||||
orgDisplayName,
|
||||
orgDesc,
|
||||
orgShortName,
|
||||
orgWebsite,
|
||||
orgIsActive,
|
||||
);
|
||||
}
|
||||
|
||||
// if (isChangeOrgDisplayName) {
|
||||
// Meteor.call('setOrgDisplayName', org, orgDisplayName);
|
||||
// }
|
||||
|
||||
// if (isChangeOrgDesc) {
|
||||
// Meteor.call('setOrgDesc', org, orgDesc);
|
||||
// }
|
||||
|
||||
// if (isChangeOrgShortName) {
|
||||
// Meteor.call('setOrgShortName', org, orgShortName);
|
||||
// }
|
||||
|
||||
// if (isChangeOrgIsActive) {
|
||||
// Meteor.call('setOrgIsActive', org, orgIsActive);
|
||||
// }
|
||||
|
||||
Popup.close();
|
||||
},
|
||||
});
|
||||
|
|
@ -460,7 +457,8 @@ Template.editTeamPopup.events({
|
|||
.find('.js-teamShortName')
|
||||
.value.trim();
|
||||
const teamWebsite = templateInstance.find('.js-teamWebsite').value.trim();
|
||||
const teamIsActive = templateInstance.find('.js-team-isactive').value.trim() == 'true';
|
||||
const teamIsActive =
|
||||
templateInstance.find('.js-team-isactive').value.trim() == 'true';
|
||||
|
||||
const isChangeTeamDisplayName = teamDisplayName !== team.teamDisplayName;
|
||||
const isChangeTeamDesc = teamDesc !== team.teamDesc;
|
||||
|
|
@ -468,24 +466,23 @@ Template.editTeamPopup.events({
|
|||
const isChangeTeamWebsite = teamWebsite !== team.teamWebsite;
|
||||
const isChangeTeamIsActive = teamIsActive !== team.teamIsActive;
|
||||
|
||||
if(isChangeTeamDisplayName || isChangeTeamDesc || isChangeTeamShortName || isChangeTeamWebsite || isChangeTeamIsActive){
|
||||
Meteor.call('setTeamAllFields', team, teamDisplayName, teamDesc, teamShortName, teamWebsite, teamIsActive);
|
||||
if (
|
||||
isChangeTeamDisplayName ||
|
||||
isChangeTeamDesc ||
|
||||
isChangeTeamShortName ||
|
||||
isChangeTeamWebsite ||
|
||||
isChangeTeamIsActive
|
||||
) {
|
||||
Meteor.call(
|
||||
'setTeamAllFields',
|
||||
team,
|
||||
teamDisplayName,
|
||||
teamDesc,
|
||||
teamShortName,
|
||||
teamWebsite,
|
||||
teamIsActive,
|
||||
);
|
||||
}
|
||||
// if (isChangeTeamDisplayName) {
|
||||
// Meteor.call('setTeamDisplayName', team, teamDisplayName);
|
||||
// }
|
||||
|
||||
// if (isChangeTeamDesc) {
|
||||
// Meteor.call('setTeamDesc', team, teamDesc);
|
||||
// }
|
||||
|
||||
// if (isChangeTeamShortName) {
|
||||
// Meteor.call('setTeamShortName', team, teamShortName);
|
||||
// }
|
||||
|
||||
// if (isChangeTeamIsActive) {
|
||||
// Meteor.call('setTeamIsActive', team, teamIsActive);
|
||||
// }
|
||||
|
||||
Popup.close();
|
||||
},
|
||||
|
|
@ -553,7 +550,7 @@ Template.editUserPopup.events({
|
|||
username,
|
||||
email.toLowerCase(),
|
||||
this.userId,
|
||||
function(error) {
|
||||
function (error) {
|
||||
const usernameMessageElement = templateInstance.$('.username-taken');
|
||||
const emailMessageElement = templateInstance.$('.email-taken');
|
||||
if (error) {
|
||||
|
|
@ -573,7 +570,7 @@ Template.editUserPopup.events({
|
|||
},
|
||||
);
|
||||
} else if (isChangeUserName) {
|
||||
Meteor.call('setUsername', username, this.userId, function(error) {
|
||||
Meteor.call('setUsername', username, this.userId, function (error) {
|
||||
const usernameMessageElement = templateInstance.$('.username-taken');
|
||||
if (error) {
|
||||
const errorElement = error.error;
|
||||
|
|
@ -586,20 +583,23 @@ Template.editUserPopup.events({
|
|||
}
|
||||
});
|
||||
} else if (isChangeEmail) {
|
||||
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') {
|
||||
emailMessageElement.show();
|
||||
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') {
|
||||
emailMessageElement.show();
|
||||
}
|
||||
} else {
|
||||
emailMessageElement.hide();
|
||||
Popup.close();
|
||||
}
|
||||
} else {
|
||||
emailMessageElement.hide();
|
||||
Popup.close();
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
} else Popup.close();
|
||||
},
|
||||
});
|
||||
|
|
@ -613,7 +613,8 @@ Template.newOrgPopup.events({
|
|||
const orgDesc = templateInstance.find('.js-orgDesc').value.trim();
|
||||
const orgShortName = templateInstance.find('.js-orgShortName').value.trim();
|
||||
const orgWebsite = templateInstance.find('.js-orgWebsite').value.trim();
|
||||
const orgIsActive = templateInstance.find('.js-org-isactive').value.trim() == 'true';
|
||||
const orgIsActive =
|
||||
templateInstance.find('.js-org-isactive').value.trim() == 'true';
|
||||
|
||||
Meteor.call(
|
||||
'setCreateOrg',
|
||||
|
|
@ -638,7 +639,8 @@ Template.newTeamPopup.events({
|
|||
.find('.js-teamShortName')
|
||||
.value.trim();
|
||||
const teamWebsite = templateInstance.find('.js-teamWebsite').value.trim();
|
||||
const teamIsActive = templateInstance.find('.js-team-isactive').value.trim() == 'true';
|
||||
const teamIsActive =
|
||||
templateInstance.find('.js-team-isactive').value.trim() == 'true';
|
||||
|
||||
Meteor.call(
|
||||
'setCreateTeam',
|
||||
|
|
@ -676,7 +678,7 @@ Template.newUserPopup.events({
|
|||
isActive,
|
||||
email.toLowerCase(),
|
||||
importUsernames,
|
||||
function(error) {
|
||||
function (error) {
|
||||
const usernameMessageElement = templateInstance.$('.username-taken');
|
||||
const emailMessageElement = templateInstance.$('.email-taken');
|
||||
if (error) {
|
||||
|
|
@ -699,11 +701,27 @@ Template.newUserPopup.events({
|
|||
},
|
||||
});
|
||||
|
||||
Template.settingsOrgPopup.events({
|
||||
'click #deleteButton'(event) {
|
||||
event.preventDefault();
|
||||
Org.remove(this.orgId);
|
||||
Popup.close();
|
||||
},
|
||||
});
|
||||
|
||||
Template.settingsTeamPopup.events({
|
||||
'click #deleteButton'(event) {
|
||||
event.preventDefault();
|
||||
Team.remove(this.teamId);
|
||||
Popup.close();
|
||||
},
|
||||
});
|
||||
|
||||
Template.settingsUserPopup.events({
|
||||
'click .impersonate-user'(event) {
|
||||
event.preventDefault();
|
||||
|
||||
Meteor.call('impersonate', this.userId, err => {
|
||||
Meteor.call('impersonate', this.userId, (err) => {
|
||||
if (!err) {
|
||||
FlowRouter.go('/');
|
||||
Meteor.connection.setUserId(this.userId);
|
||||
|
|
@ -723,21 +741,6 @@ Template.settingsUserPopup.events({
|
|||
// but that should be used to remove user from all boards similarly
|
||||
// - wekan/models/users.js Delete is not enabled
|
||||
//
|
||||
//console.log('user id: ' + this.userId);
|
||||
//Popup.afterConfirm('userDelete', function(event) {
|
||||
//Boards.find({ members: this.userId }).forEach(board => {
|
||||
// console.log('board id: ' + board._id);
|
||||
//Cards.find({ boardId: board._id, members: this.userId }).forEach(card => {
|
||||
// card.unassignMember(this.userId);
|
||||
//});
|
||||
//Cards.find({ boardId: board._id, members: this.userId }).forEach(card => {
|
||||
// card.unassignMember(this.userId);
|
||||
//});
|
||||
//Cards.find({ boardId: board._id, assignees: this.userId }).forEach(card => {
|
||||
// card.unassignAssignee(this.userId);
|
||||
//});
|
||||
//Boards.findOne({ boardId: board._id }).removeMember(this.userId);
|
||||
//});
|
||||
//Users.remove(this.userId);
|
||||
*/
|
||||
Popup.close();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue