mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04:00
Added some controls and warning messages when user try to delete an organization or team that has at least one user belongs to it
This commit is contained in:
parent
362fd86dbf
commit
220c52373a
2 changed files with 43 additions and 11 deletions
|
@ -531,6 +531,9 @@ template(name="settingsOrgPopup")
|
|||
ul.pop-over-list
|
||||
li
|
||||
form
|
||||
label#deleteOrgWarningMsg.hide
|
||||
| {{_ 'delete-org-warning-message'}}
|
||||
br
|
||||
label
|
||||
| {{_ 'delete-org-confirm-popup'}}
|
||||
br
|
||||
|
@ -552,6 +555,9 @@ template(name="settingsTeamPopup")
|
|||
ul.pop-over-list
|
||||
li
|
||||
form
|
||||
label#deleteTeamWarningMsg.hide
|
||||
| {{_ 'delete-team-warning-message'}}
|
||||
br
|
||||
label
|
||||
| {{_ 'delete-team-confirm-popup'}}
|
||||
br
|
||||
|
|
|
@ -551,12 +551,15 @@ Template.editUserPopup.events({
|
|||
let userTeamsList = userTeams.split(",");
|
||||
let userTeamsIdsList = userTeamsIds.split(",");
|
||||
let userTms = [];
|
||||
for(let i = 0; i < userTeamsList.length; i++){
|
||||
userTms.push({
|
||||
"teamId": userTeamsIdsList[i],
|
||||
"teamDisplayName": userTeamsList[i],
|
||||
})
|
||||
if(userTeams != ''){
|
||||
for(let i = 0; i < userTeamsList.length; i++){
|
||||
userTms.push({
|
||||
"teamId": userTeamsIdsList[i],
|
||||
"teamDisplayName": userTeamsList[i],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Users.update(this.userId, {
|
||||
$set:{
|
||||
teams: userTms
|
||||
|
@ -566,12 +569,15 @@ Template.editUserPopup.events({
|
|||
let userOrgsList = userOrgs.split(",");
|
||||
let userOrgsIdsList = userOrgsIds.split(",");
|
||||
let userOrganizations = [];
|
||||
for(let i = 0; i < userOrgsList.length; i++){
|
||||
userOrganizations.push({
|
||||
"orgId": userOrgsIdsList[i],
|
||||
"orgDisplayName": userOrgsList[i],
|
||||
})
|
||||
if(userOrgs != ''){
|
||||
for(let i = 0; i < userOrgsList.length; i++){
|
||||
userOrganizations.push({
|
||||
"orgId": userOrgsIdsList[i],
|
||||
"orgDisplayName": userOrgsList[i],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Users.update(this.userId, {
|
||||
$set:{
|
||||
orgs: userOrganizations
|
||||
|
@ -724,7 +730,7 @@ UpdateUserOrgsOrTeamsElement = function(isNewUser = false){
|
|||
lstInputValuesIds = [];
|
||||
}
|
||||
index = lstInputValues.indexOf(selectedEltValue);
|
||||
indexId = lstInputValuesIds.indexOf(selectedEltValue);
|
||||
indexId = lstInputValuesIds.indexOf(selectedEltValueId);
|
||||
if(userOrgsTeamsAction == "addOrg" || userOrgsTeamsAction == "addTeam"){
|
||||
if(index <= -1 && selectedEltValueId != "-1"){
|
||||
lstInputValues.push(selectedEltValue);
|
||||
|
@ -923,6 +929,16 @@ Template.newUserPopup.events({
|
|||
Template.settingsOrgPopup.events({
|
||||
'click #deleteButton'(event) {
|
||||
event.preventDefault();
|
||||
if(Users.find({"orgs.orgId": this.orgId}).count() > 0)
|
||||
{
|
||||
let orgClassList = document.getElementById("deleteOrgWarningMsg").classList;
|
||||
if(orgClassList.contains('hide'))
|
||||
{
|
||||
orgClassList.remove('hide');
|
||||
document.getElementById("deleteOrgWarningMsg").style.color = "red";
|
||||
}
|
||||
return;
|
||||
}
|
||||
Org.remove(this.orgId);
|
||||
Popup.close();
|
||||
}
|
||||
|
@ -931,6 +947,16 @@ Template.settingsOrgPopup.events({
|
|||
Template.settingsTeamPopup.events({
|
||||
'click #deleteButton'(event) {
|
||||
event.preventDefault();
|
||||
if(Users.find({"teams.teamId": this.teamId}).count() > 0)
|
||||
{
|
||||
let teamClassList = document.getElementById("deleteTeamWarningMsg").classList;
|
||||
if(teamClassList.contains('hide'))
|
||||
{
|
||||
teamClassList.remove('hide');
|
||||
document.getElementById("deleteTeamWarningMsg").style.color = "red";
|
||||
}
|
||||
return;
|
||||
}
|
||||
Team.remove(this.teamId);
|
||||
Popup.close();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue