summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorguillaume <guillaume.cassou@orange.fr>2019-04-19 14:57:52 +0200
committerguillaume <guillaume.cassou@orange.fr>2019-04-19 14:57:52 +0200
commit308417852c218501af60aeae3f947707cc7c64cc (patch)
treea2b9a900eff50e6277b3914590e97fb0e0a0e32c /client
parent9c3a976250bf381bcf36eee26c16ee4dec493d6e (diff)
downloadwekan-308417852c218501af60aeae3f947707cc7c64cc.tar.gz
wekan-308417852c218501af60aeae3f947707cc7c64cc.tar.bz2
wekan-308417852c218501af60aeae3f947707cc7c64cc.zip
Search user in admin panel
Diffstat (limited to 'client')
-rw-r--r--client/components/settings/peopleBody.jade6
-rw-r--r--client/components/settings/peopleBody.js23
-rw-r--r--client/components/settings/peopleBody.styl17
3 files changed, 43 insertions, 3 deletions
diff --git a/client/components/settings/peopleBody.jade b/client/components/settings/peopleBody.jade
index 4d06637e..e459da6e 100644
--- a/client/components/settings/peopleBody.jade
+++ b/client/components/settings/peopleBody.jade
@@ -3,8 +3,10 @@ template(name="people")
unless currentUser.isAdmin
| {{_ 'error-notAuthorized'}}
else
- .content-title
+ .content-title.ext-box
span {{_ 'people'}}
+ input#searchInput(placeholder="{{_ 'search'}}")
+ button#searchButton {{_ 'enter'}}
.content-body
.side-menu
ul
@@ -103,4 +105,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..245c8884 100644
--- a/client/components/settings/peopleBody.js
+++ b/client/components/settings/peopleBody.js
@@ -8,6 +8,7 @@ BlazeComponent.extendComponent({
this.error = new ReactiveVar('');
this.loading = new ReactiveVar(false);
this.people = new ReactiveVar(true);
+ this.findUsersOptions = new ReactiveVar({});
this.page = new ReactiveVar(1);
this.loadNextPageLocked = false;
@@ -26,6 +27,25 @@ 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 },
+ ]
+ });
+ }
+ }
+ }];
+ },
loadNextPage() {
if (this.loadNextPageLocked === false) {
this.page.set(this.page.get() + 1);
@@ -49,7 +69,8 @@ BlazeComponent.extendComponent({
this.loading.set(w);
},
peopleList() {
- return Users.find({}, {
+ // get users in front to cache them
+ return Users.find(this.findUsersOptions.get(), {
fields: {_id: true},
});
},
diff --git a/client/components/settings/peopleBody.styl b/client/components/settings/peopleBody.styl
index 84db44a7..fb9d5c6b 100644
--- a/client/components/settings/peopleBody.styl
+++ b/client/components/settings/peopleBody.styl
@@ -13,3 +13,20 @@ table
tr:nth-child(even)
background-color: #dddddd;
+
+.ext-box
+ display: flex;
+ flex-direction: row;
+ height: 34px;
+
+ span
+ vertical-align: center;
+ line-height: 34px;
+ margin-right: 10px;
+
+ input, button
+ margin: 0 10px 0 0;
+ padding: 0;
+
+ button
+ min-width: 60px;