summaryrefslogtreecommitdiffstats
path: root/client/components/settings
diff options
context:
space:
mode:
authorguillaume <guillaume.cassou@orange.fr>2019-04-19 16:17:17 +0200
committerguillaume <guillaume.cassou@orange.fr>2019-04-19 16:17:17 +0200
commit070feb4b664cf84613fed378d568a9449c3780e6 (patch)
tree10a0dd43f6d39a9c8a17e2df3daec9ecb9a382d0 /client/components/settings
parent308417852c218501af60aeae3f947707cc7c64cc (diff)
downloadwekan-070feb4b664cf84613fed378d568a9449c3780e6.tar.gz
wekan-070feb4b664cf84613fed378d568a9449c3780e6.tar.bz2
wekan-070feb4b664cf84613fed378d568a9449c3780e6.zip
Number of users
Diffstat (limited to 'client/components/settings')
-rw-r--r--client/components/settings/peopleBody.jade9
-rw-r--r--client/components/settings/peopleBody.js42
-rw-r--r--client/components/settings/peopleBody.styl4
3 files changed, 38 insertions, 17 deletions
diff --git a/client/components/settings/peopleBody.jade b/client/components/settings/peopleBody.jade
index e459da6e..30b7a807 100644
--- a/client/components/settings/peopleBody.jade
+++ b/client/components/settings/peopleBody.jade
@@ -4,9 +4,12 @@ template(name="people")
| {{_ 'error-notAuthorized'}}
else
.content-title.ext-box
- span {{_ 'people'}}
- input#searchInput(placeholder="{{_ 'search'}}")
- button#searchButton {{_ 'enter'}}
+ .ext-box-left
+ span {{_ 'people'}}
+ input#searchInput(placeholder="{{_ 'search'}}")
+ button#searchButton {{_ 'enter'}}
+ .ext-box-right
+ span {{_ 'people-number'}} #{peopleNumber}
.content-body
.side-menu
ul
diff --git a/client/components/settings/peopleBody.js b/client/components/settings/peopleBody.js
index 245c8884..db7be138 100644
--- a/client/components/settings/peopleBody.js
+++ b/client/components/settings/peopleBody.js
@@ -9,6 +9,7 @@ BlazeComponent.extendComponent({
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;
@@ -30,22 +31,30 @@ BlazeComponent.extendComponent({
events() {
return [{
'click #searchButton'(event) {
- 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 },
- ]
- });
+ this.filterPeople(event);
+ },
+ 'keydown #searchInput'(event) {
+ if (event.keyCode === 13 && !event.shiftKey) {
+ this.filterPeople(event);
}
}
}];
},
+ filterPeople(event) {
+ 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);
@@ -69,11 +78,16 @@ BlazeComponent.extendComponent({
this.loading.set(w);
},
peopleList() {
- // get users in front to cache them
- return Users.find(this.findUsersOptions.get(), {
+ const users = Users.find(this.findUsersOptions.get(), {
fields: {_id: true},
});
+ this.number.set(users.count());
+ return users;
},
+ peopleNumber() {
+ return this.number.get();
+ }
+
}).register('people');
Template.peopleRow.helpers({
diff --git a/client/components/settings/peopleBody.styl b/client/components/settings/peopleBody.styl
index fb9d5c6b..b98c5340 100644
--- a/client/components/settings/peopleBody.styl
+++ b/client/components/settings/peopleBody.styl
@@ -19,6 +19,10 @@ table
flex-direction: row;
height: 34px;
+ .ext-box-left
+ display: flex;
+ width: 40%
+
span
vertical-align: center;
line-height: 34px;