mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Search user in admin panel
This commit is contained in:
parent
9c3a976250
commit
308417852c
3 changed files with 43 additions and 3 deletions
|
|
@ -3,8 +3,10 @@ template(name="people")
|
||||||
unless currentUser.isAdmin
|
unless currentUser.isAdmin
|
||||||
| {{_ 'error-notAuthorized'}}
|
| {{_ 'error-notAuthorized'}}
|
||||||
else
|
else
|
||||||
.content-title
|
.content-title.ext-box
|
||||||
span {{_ 'people'}}
|
span {{_ 'people'}}
|
||||||
|
input#searchInput(placeholder="{{_ 'search'}}")
|
||||||
|
button#searchButton {{_ 'enter'}}
|
||||||
.content-body
|
.content-body
|
||||||
.side-menu
|
.side-menu
|
||||||
ul
|
ul
|
||||||
|
|
@ -103,4 +105,4 @@ template(name="editUserPopup")
|
||||||
| {{_ 'password'}}
|
| {{_ 'password'}}
|
||||||
input.js-profile-password(type="password")
|
input.js-profile-password(type="password")
|
||||||
|
|
||||||
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
input.primary.wide(type="submit" value="{{_ 'save'}}")
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ BlazeComponent.extendComponent({
|
||||||
this.error = new ReactiveVar('');
|
this.error = new ReactiveVar('');
|
||||||
this.loading = new ReactiveVar(false);
|
this.loading = new ReactiveVar(false);
|
||||||
this.people = new ReactiveVar(true);
|
this.people = new ReactiveVar(true);
|
||||||
|
this.findUsersOptions = new ReactiveVar({});
|
||||||
|
|
||||||
this.page = new ReactiveVar(1);
|
this.page = new ReactiveVar(1);
|
||||||
this.loadNextPageLocked = false;
|
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() {
|
loadNextPage() {
|
||||||
if (this.loadNextPageLocked === false) {
|
if (this.loadNextPageLocked === false) {
|
||||||
this.page.set(this.page.get() + 1);
|
this.page.set(this.page.get() + 1);
|
||||||
|
|
@ -49,7 +69,8 @@ BlazeComponent.extendComponent({
|
||||||
this.loading.set(w);
|
this.loading.set(w);
|
||||||
},
|
},
|
||||||
peopleList() {
|
peopleList() {
|
||||||
return Users.find({}, {
|
// get users in front to cache them
|
||||||
|
return Users.find(this.findUsersOptions.get(), {
|
||||||
fields: {_id: true},
|
fields: {_id: true},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -13,3 +13,20 @@ table
|
||||||
|
|
||||||
tr:nth-child(even)
|
tr:nth-child(even)
|
||||||
background-color: #dddddd;
|
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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue