diff --git a/CHANGELOG.md b/CHANGELOG.md index 32e1b9a84..22772b9de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Upcoming Wekan release -This release fixes the following bugs: +This release adds the following new features: + +- Teams/Organizations to Admin Panel. In Progress. + [Part 2](https://github.com/wekan/wekan/commit/ad482d5cfb72591f1b5c749c3c0156000dbf660a). + [Part 3](https://github.com/wekan/wekan/commit/b64cd358ed0af4395357423ad172b8dac9dc3178). + Thanks to xet7. + +and fixes the following bugs: - [New Checklistitems are now autoresized too](https://github.com/wekan/wekan/pull/3411). Thanks to mfilser. diff --git a/client/components/settings/peopleBody.jade b/client/components/settings/peopleBody.jade index d2d256ab8..bc88e3dc0 100644 --- a/client/components/settings/peopleBody.jade +++ b/client/components/settings/peopleBody.jade @@ -296,7 +296,7 @@ template(name="editTeamPopup") span.error.hide.teamname-taken | {{_ 'error-teamname-taken'}} label - | {{_ 'desc'}} + | {{_ 'description'}} input.js-orgDesc(type="text" value=org.desc required) label | {{_ 'name'}} @@ -372,17 +372,20 @@ template(name="newOrgPopup") form //label.hide.userId(type="text" value=user._id) label - | {{_ 'orgDisplayName'}} - input.js-orgDisplayName(type="text" value="" required) + | {{_ 'displayName'}} + input.js-displayName(type="text" value="" required) label - | {{_ 'orgDesc'}} - input.js-orgDesc(type="text" value="" required) + | {{_ 'description'}} + input.js-desc(type="text" value="" required) label - | {{_ 'orgName'}} - input.js-orgName(type="text" value="") + | {{_ 'shortName'}} + input.js-name(type="text" value="") label - | {{_ 'orgWebsite'}} - input.js-orgWebsite(type="text" value="") + | {{_ 'teams'}} + input.js-teams(type="text" value="") + label + | {{_ 'website'}} + input.js-website(type="text" value="") label | {{_ 'active'}} select.select-active.js-profile-isactive @@ -399,7 +402,7 @@ template(name="newTeamPopup") | {{_ 'displayName'}} input.js-teamDisplayName(type="text" value="" required) label - | {{_ 'desc'}} + | {{_ 'description'}} input.js-teamDesc(type="text" value="" required) label | {{_ 'shortName'}} diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js index 75fc48c15..42a692eb3 100644 --- a/client/components/settings/peopleBody.js +++ b/client/components/settings/peopleBody.js @@ -226,18 +226,6 @@ Template.editOrgPopup.helpers({ org() { 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() { return Template.instance().errorMessage.get(); }, @@ -247,21 +235,6 @@ Template.editTeamPopup.helpers({ team() { 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() { return Template.instance().errorMessage.get(); }, @@ -290,43 +263,11 @@ Template.editUserPopup.helpers({ }); Template.newOrgPopup.onCreated(function() { - //this.authenticationMethods = 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() { - //this.authenticationMethods = 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() { @@ -348,28 +289,76 @@ Template.newUserPopup.onCreated(function() { }); }); -Template.newUserPopup.helpers({ - //user() { - // return Users.findOne(this.userId); - //}, - authentications() { - return Template.instance().authenticationMethods.get(); +Template.newOrgPopup.helpers({ + org() { + return Org.findOne(this.orgId); }, - //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(); }, }); +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({ onCreated() {}, user() { @@ -385,6 +374,26 @@ BlazeComponent.extendComponent({ }, }).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({ events() { 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({ submit(event, templateInstance) { event.preventDefault(); diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index e96bbb3cb..306abe799 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -809,6 +809,10 @@ "addmore-detail": "Add a more detailed description", "show-on-card": "Show on Card", "new": "New", + "editOrgPopup-title": "Edit Organization", + "newOrgPopup-title": "New Organization", + "editTeamPopup-title": "Edit Team", + "newTeamPopup-title": "New Team", "editUserPopup-title": "Edit User", "newUserPopup-title": "New User", "notifications": "Notifications",