diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-04-20 16:22:20 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2019-04-20 16:22:20 +0300 |
commit | b8275b340484919d72dc7bb59cccb8dba9f04d0a (patch) | |
tree | a0cb30edd154d2719fe6d5eeccea0e1f09e58e4e | |
parent | 6e4da08164fd44472c34c009acfdce843657d8d3 (diff) | |
parent | e63eee0c68d35a155da79f31ab18ddc5a76bde13 (diff) | |
download | wekan-b8275b340484919d72dc7bb59cccb8dba9f04d0a.tar.gz wekan-b8275b340484919d72dc7bb59cccb8dba9f04d0a.tar.bz2 wekan-b8275b340484919d72dc7bb59cccb8dba9f04d0a.zip |
Merge branch 'edge' of https://github.com/Akuket/wekan into Akuket-edge
-rw-r--r-- | client/components/settings/peopleBody.jade | 11 | ||||
-rw-r--r-- | client/components/settings/peopleBody.js | 36 | ||||
-rw-r--r-- | client/components/settings/peopleBody.styl | 21 | ||||
-rw-r--r-- | i18n/en.i18n.json | 3 | ||||
-rw-r--r-- | i18n/fr.i18n.json | 5 |
5 files changed, 69 insertions, 7 deletions
diff --git a/client/components/settings/peopleBody.jade b/client/components/settings/peopleBody.jade index 4d06637e..30b7a807 100644 --- a/client/components/settings/peopleBody.jade +++ b/client/components/settings/peopleBody.jade @@ -3,8 +3,13 @@ template(name="people") unless currentUser.isAdmin | {{_ 'error-notAuthorized'}} else - .content-title - span {{_ 'people'}} + .content-title.ext-box + .ext-box-left + span {{_ 'people'}} + input#searchInput(placeholder="{{_ 'search'}}") + button#searchButton {{_ 'enter'}} + .ext-box-right + span {{_ 'people-number'}} #{peopleNumber} .content-body .side-menu ul @@ -103,4 +108,4 @@ template(name="editUserPopup") | {{_ 'password'}} input.js-profile-password(type="password") - input.primary.wide(type="submit" value="{{_ 'save'}}")
\ No newline at end of file + input.primary.wide(type="submit" value="{{_ 'save'}}") diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js index a4d70974..3ec96bb0 100644 --- a/client/components/settings/peopleBody.js +++ b/client/components/settings/peopleBody.js @@ -8,6 +8,8 @@ BlazeComponent.extendComponent({ this.error = new ReactiveVar(''); this.loading = new ReactiveVar(false); this.people = new ReactiveVar(true); + this.findUsersOptions = new ReactiveVar({}); + this.number = new ReactiveVar(0); this.page = new ReactiveVar(1); this.loadNextPageLocked = false; @@ -26,6 +28,33 @@ BlazeComponent.extendComponent({ }); }); }, + events() { + return [{ + 'click #searchButton'() { + this.filterPeople(); + }, + 'keydown #searchInput'(event) { + if (event.keyCode === 13 && !event.shiftKey) { + this.filterPeople(); + } + }, + }]; + }, + filterPeople() { + const value = $('#searchInput').first().val(); + if (value === '') { + this.findUsersOptions.set({}); + } else { + const regex = new RegExp(value, 'i'); + this.findUsersOptions.set({ + $or: [ + { username: regex }, + { 'profile.fullname': regex }, + { 'emails.address': regex }, + ], + }); + } + }, loadNextPage() { if (this.loadNextPageLocked === false) { this.page.set(this.page.get() + 1); @@ -49,9 +78,14 @@ BlazeComponent.extendComponent({ this.loading.set(w); }, peopleList() { - return Users.find({}, { + const users = Users.find(this.findUsersOptions.get(), { fields: {_id: true}, }); + this.number.set(users.count()); + return users; + }, + peopleNumber() { + return this.number.get(); }, }).register('people'); diff --git a/client/components/settings/peopleBody.styl b/client/components/settings/peopleBody.styl index 84db44a7..b98c5340 100644 --- a/client/components/settings/peopleBody.styl +++ b/client/components/settings/peopleBody.styl @@ -13,3 +13,24 @@ table tr:nth-child(even) background-color: #dddddd; + +.ext-box + display: flex; + flex-direction: row; + height: 34px; + + .ext-box-left + display: flex; + width: 40% + + span + vertical-align: center; + line-height: 34px; + margin-right: 10px; + + input, button + margin: 0 10px 0 0; + padding: 0; + + button + min-width: 60px; diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 4e4af38b..22e15934 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -686,5 +686,6 @@ "error-ldap-login": "An error occurred while trying to login", "display-authentication-method": "Display Authentication Method", "default-authentication-method": "Default Authentication Method", - "duplicate-board": "Duplicate Board" + "duplicate-board": "Duplicate Board", + "people-number": "The number of people is: " } diff --git a/i18n/fr.i18n.json b/i18n/fr.i18n.json index bc7614d5..1eb2a278 100644 --- a/i18n/fr.i18n.json +++ b/i18n/fr.i18n.json @@ -683,5 +683,6 @@ "error-ldap-login": "Une erreur s'est produite lors de la tentative de connexion", "display-authentication-method": "Afficher la méthode d'authentification", "default-authentication-method": "Méthode d'authentification par défaut", - "duplicate-board": "Dupliquer le tableau" -}
\ No newline at end of file + "duplicate-board": "Dupliquer le tableau", + "people-number": "Le nombre d'utilisateurs est de : " +} |