mirror of
https://github.com/wekan/wekan.git
synced 2025-12-22 10:20:14 +01:00
Teams/Organizations to Admin Panel. In Progress. Part 2.
Thanks to xet7 ! Related #802
This commit is contained in:
parent
e49d3923d0
commit
ad482d5cfb
3 changed files with 142 additions and 85 deletions
|
|
@ -296,7 +296,7 @@ template(name="editTeamPopup")
|
||||||
span.error.hide.teamname-taken
|
span.error.hide.teamname-taken
|
||||||
| {{_ 'error-teamname-taken'}}
|
| {{_ 'error-teamname-taken'}}
|
||||||
label
|
label
|
||||||
| {{_ 'desc'}}
|
| {{_ 'description'}}
|
||||||
input.js-orgDesc(type="text" value=org.desc required)
|
input.js-orgDesc(type="text" value=org.desc required)
|
||||||
label
|
label
|
||||||
| {{_ 'name'}}
|
| {{_ 'name'}}
|
||||||
|
|
@ -372,17 +372,20 @@ template(name="newOrgPopup")
|
||||||
form
|
form
|
||||||
//label.hide.userId(type="text" value=user._id)
|
//label.hide.userId(type="text" value=user._id)
|
||||||
label
|
label
|
||||||
| {{_ 'orgDisplayName'}}
|
| {{_ 'displayName'}}
|
||||||
input.js-orgDisplayName(type="text" value="" required)
|
input.js-displayName(type="text" value="" required)
|
||||||
label
|
label
|
||||||
| {{_ 'orgDesc'}}
|
| {{_ 'description'}}
|
||||||
input.js-orgDesc(type="text" value="" required)
|
input.js-desc(type="text" value="" required)
|
||||||
label
|
label
|
||||||
| {{_ 'orgName'}}
|
| {{_ 'shortName'}}
|
||||||
input.js-orgName(type="text" value="")
|
input.js-name(type="text" value="")
|
||||||
label
|
label
|
||||||
| {{_ 'orgWebsite'}}
|
| {{_ 'teams'}}
|
||||||
input.js-orgWebsite(type="text" value="")
|
input.js-teams(type="text" value="")
|
||||||
|
label
|
||||||
|
| {{_ 'website'}}
|
||||||
|
input.js-website(type="text" value="")
|
||||||
label
|
label
|
||||||
| {{_ 'active'}}
|
| {{_ 'active'}}
|
||||||
select.select-active.js-profile-isactive
|
select.select-active.js-profile-isactive
|
||||||
|
|
@ -399,7 +402,7 @@ template(name="newTeamPopup")
|
||||||
| {{_ 'displayName'}}
|
| {{_ 'displayName'}}
|
||||||
input.js-teamDisplayName(type="text" value="" required)
|
input.js-teamDisplayName(type="text" value="" required)
|
||||||
label
|
label
|
||||||
| {{_ 'desc'}}
|
| {{_ 'description'}}
|
||||||
input.js-teamDesc(type="text" value="" required)
|
input.js-teamDesc(type="text" value="" required)
|
||||||
label
|
label
|
||||||
| {{_ 'shortName'}}
|
| {{_ 'shortName'}}
|
||||||
|
|
|
||||||
|
|
@ -226,18 +226,6 @@ Template.editOrgPopup.helpers({
|
||||||
org() {
|
org() {
|
||||||
return Org.findOne(this.orgId);
|
return Org.findOne(this.orgId);
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
isSelected(match) {
|
|
||||||
const orgId = Template.instance().data.orgId;
|
|
||||||
const selected = Org.findOne(orgId).authenticationMethod;
|
|
||||||
return selected === match;
|
|
||||||
},
|
|
||||||
isLdap() {
|
|
||||||
const userId = Template.instance().data.userId;
|
|
||||||
const selected = Users.findOne(userId).authenticationMethod;
|
|
||||||
return selected === 'ldap';
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
errorMessage() {
|
errorMessage() {
|
||||||
return Template.instance().errorMessage.get();
|
return Template.instance().errorMessage.get();
|
||||||
},
|
},
|
||||||
|
|
@ -247,21 +235,6 @@ Template.editTeamPopup.helpers({
|
||||||
team() {
|
team() {
|
||||||
return Team.findOne(this.teamId);
|
return Team.findOne(this.teamId);
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
authentications() {
|
|
||||||
return Template.instance().authenticationMethods.get();
|
|
||||||
},
|
|
||||||
isSelected(match) {
|
|
||||||
const userId = Template.instance().data.userId;
|
|
||||||
const selected = Users.findOne(userId).authenticationMethod;
|
|
||||||
return selected === match;
|
|
||||||
},
|
|
||||||
isLdap() {
|
|
||||||
const userId = Template.instance().data.userId;
|
|
||||||
const selected = Users.findOne(userId).authenticationMethod;
|
|
||||||
return selected === 'ldap';
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
errorMessage() {
|
errorMessage() {
|
||||||
return Template.instance().errorMessage.get();
|
return Template.instance().errorMessage.get();
|
||||||
},
|
},
|
||||||
|
|
@ -290,43 +263,11 @@ Template.editUserPopup.helpers({
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.newOrgPopup.onCreated(function() {
|
Template.newOrgPopup.onCreated(function() {
|
||||||
//this.authenticationMethods = new ReactiveVar([]);
|
|
||||||
this.errorMessage = new ReactiveVar('');
|
this.errorMessage = new ReactiveVar('');
|
||||||
/*
|
|
||||||
Meteor.call('getAuthenticationsEnabled', (_, result) => {
|
|
||||||
if (result) {
|
|
||||||
// TODO : add a management of different languages
|
|
||||||
// (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')})
|
|
||||||
this.authenticationMethods.set([
|
|
||||||
{ value: 'password' },
|
|
||||||
// Gets only the authentication methods availables
|
|
||||||
...Object.entries(result)
|
|
||||||
.filter(e => e[1])
|
|
||||||
.map(e => ({ value: e[0] })),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.newTeamPopup.onCreated(function() {
|
Template.newTeamPopup.onCreated(function() {
|
||||||
//this.authenticationMethods = new ReactiveVar([]);
|
|
||||||
this.errorMessage = new ReactiveVar('');
|
this.errorMessage = new ReactiveVar('');
|
||||||
/*
|
|
||||||
Meteor.call('getAuthenticationsEnabled', (_, result) => {
|
|
||||||
if (result) {
|
|
||||||
// TODO : add a management of different languages
|
|
||||||
// (ex {value: ldap, text: TAPi18n.__('ldap', {}, T9n.getLanguage() || 'en')})
|
|
||||||
this.authenticationMethods.set([
|
|
||||||
{ value: 'password' },
|
|
||||||
// Gets only the authentication methods availables
|
|
||||||
...Object.entries(result)
|
|
||||||
.filter(e => e[1])
|
|
||||||
.map(e => ({ value: e[0] })),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.newUserPopup.onCreated(function() {
|
Template.newUserPopup.onCreated(function() {
|
||||||
|
|
@ -348,28 +289,76 @@ Template.newUserPopup.onCreated(function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.newUserPopup.helpers({
|
Template.newOrgPopup.helpers({
|
||||||
//user() {
|
org() {
|
||||||
// return Users.findOne(this.userId);
|
return Org.findOne(this.orgId);
|
||||||
//},
|
|
||||||
authentications() {
|
|
||||||
return Template.instance().authenticationMethods.get();
|
|
||||||
},
|
},
|
||||||
//isSelected(match) {
|
|
||||||
// const userId = Template.instance().data.userId;
|
|
||||||
// const selected = Users.findOne(userId).authenticationMethod;
|
|
||||||
// return selected === match;
|
|
||||||
//},
|
|
||||||
//isLdap() {
|
|
||||||
// const userId = Template.instance().data.userId;
|
|
||||||
// const selected = Users.findOne(userId).authenticationMethod;
|
|
||||||
// return selected === 'ldap';
|
|
||||||
//},
|
|
||||||
errorMessage() {
|
errorMessage() {
|
||||||
return Template.instance().errorMessage.get();
|
return Template.instance().errorMessage.get();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Template.newTeamPopup.helpers({
|
||||||
|
team() {
|
||||||
|
return Team.findOne(this.teamId);
|
||||||
|
},
|
||||||
|
errorMessage() {
|
||||||
|
return Template.instance().errorMessage.get();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
Template.newUserPopup.helpers({
|
||||||
|
user() {
|
||||||
|
return Users.findOne(this.userId);
|
||||||
|
},
|
||||||
|
authentications() {
|
||||||
|
return Template.instance().authenticationMethods.get();
|
||||||
|
},
|
||||||
|
isSelected(match) {
|
||||||
|
const userId = Template.instance().data.userId;
|
||||||
|
const selected = Users.findOne(userId).authenticationMethod;
|
||||||
|
return selected === match;
|
||||||
|
},
|
||||||
|
isLdap() {
|
||||||
|
const userId = Template.instance().data.userId;
|
||||||
|
const selected = Users.findOne(userId).authenticationMethod;
|
||||||
|
return selected === 'ldap';
|
||||||
|
},
|
||||||
|
errorMessage() {
|
||||||
|
return Template.instance().errorMessage.get();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
BlazeComponent.extendComponent({
|
||||||
|
onCreated() {},
|
||||||
|
org() {
|
||||||
|
return Org.findOne(this.orgId);
|
||||||
|
},
|
||||||
|
events() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'click a.edit-org': Popup.open('editOrg'),
|
||||||
|
'click a.more-settings-org': Popup.open('settingsOrg'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
}).register('orgRow');
|
||||||
|
|
||||||
|
BlazeComponent.extendComponent({
|
||||||
|
onCreated() {},
|
||||||
|
team() {
|
||||||
|
return Team.findOne(this.teamId);
|
||||||
|
},
|
||||||
|
events() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'click a.edit-team': Popup.open('editTeam'),
|
||||||
|
'click a.more-settings-team': Popup.open('settingsTeam'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
}).register('teamRow');
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
onCreated() {},
|
onCreated() {},
|
||||||
user() {
|
user() {
|
||||||
|
|
@ -385,6 +374,26 @@ BlazeComponent.extendComponent({
|
||||||
},
|
},
|
||||||
}).register('peopleRow');
|
}).register('peopleRow');
|
||||||
|
|
||||||
|
BlazeComponent.extendComponent({
|
||||||
|
events() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'click a.new-org': Popup.open('newOrg'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
}).register('newOrgRow');
|
||||||
|
|
||||||
|
BlazeComponent.extendComponent({
|
||||||
|
events() {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
'click a.new-team': Popup.open('newTeam'),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
},
|
||||||
|
}).register('newTeamRow');
|
||||||
|
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
events() {
|
events() {
|
||||||
return [
|
return [
|
||||||
|
|
@ -504,6 +513,47 @@ Template.editUserPopup.events({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Template.newOrgPopup.events({
|
||||||
|
submit(event, templateInstance) {
|
||||||
|
event.preventDefault();
|
||||||
|
const displayName = templateInstance.find('.js-displayName').value.trim();
|
||||||
|
const desc = templateInstance.find('.js-desc').value.trim();
|
||||||
|
const name = templateInstance.find('.js-name').value.trim();
|
||||||
|
const teams = templateInstance.find('.js-teams').value.trim();
|
||||||
|
const website = templateInstance.find('.js-website').value.trim();
|
||||||
|
const isActive = templateInstance.find('.js-profile-isactive').value.trim();
|
||||||
|
|
||||||
|
Meteor.call(
|
||||||
|
'setCreateOrg',
|
||||||
|
displayName,
|
||||||
|
desc,
|
||||||
|
name,
|
||||||
|
teams,
|
||||||
|
website,
|
||||||
|
isActive,
|
||||||
|
email.toLowerCase(),
|
||||||
|
function(error) {
|
||||||
|
const nameMessageElement = templateInstance.$('.name-taken');
|
||||||
|
if (error) {
|
||||||
|
const errorElement = error.error;
|
||||||
|
if (errorElement === 'name-already-taken') {
|
||||||
|
nameMessageElement.show();
|
||||||
|
emailMessageElement.hide();
|
||||||
|
} else if (errorElement === 'email-already-taken') {
|
||||||
|
usernameMessageElement.hide();
|
||||||
|
emailMessageElement.show();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
usernameMessageElement.hide();
|
||||||
|
emailMessageElement.hide();
|
||||||
|
Popup.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
Popup.close();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
Template.newUserPopup.events({
|
Template.newUserPopup.events({
|
||||||
submit(event, templateInstance) {
|
submit(event, templateInstance) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
|
||||||
|
|
@ -809,6 +809,10 @@
|
||||||
"addmore-detail": "Add a more detailed description",
|
"addmore-detail": "Add a more detailed description",
|
||||||
"show-on-card": "Show on Card",
|
"show-on-card": "Show on Card",
|
||||||
"new": "New",
|
"new": "New",
|
||||||
|
"editOrgPopup-title": "Edit Organization",
|
||||||
|
"newOrgPopup-title": "New Organization",
|
||||||
|
"editTeamPopup-title": "Edit Team",
|
||||||
|
"newTeamPopup-title": "New Team",
|
||||||
"editUserPopup-title": "Edit User",
|
"editUserPopup-title": "Edit User",
|
||||||
"newUserPopup-title": "New User",
|
"newUserPopup-title": "New User",
|
||||||
"notifications": "Notifications",
|
"notifications": "Notifications",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue