Merge branch 'edge' of https://github.com/Akuket/wekan into Akuket-edge

This commit is contained in:
Lauri Ojansivu 2019-04-20 16:22:20 +03:00
commit b8275b3404
5 changed files with 69 additions and 7 deletions

View file

@ -3,8 +3,13 @@ template(name="people")
unless currentUser.isAdmin unless currentUser.isAdmin
| {{_ 'error-notAuthorized'}} | {{_ 'error-notAuthorized'}}
else else
.content-title .content-title.ext-box
span {{_ 'people'}} .ext-box-left
span {{_ 'people'}}
input#searchInput(placeholder="{{_ 'search'}}")
button#searchButton {{_ 'enter'}}
.ext-box-right
span {{_ 'people-number'}} #{peopleNumber}
.content-body .content-body
.side-menu .side-menu
ul ul

View file

@ -8,6 +8,8 @@ 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.number = new ReactiveVar(0);
this.page = new ReactiveVar(1); this.page = new ReactiveVar(1);
this.loadNextPageLocked = false; 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() { loadNextPage() {
if (this.loadNextPageLocked === false) { if (this.loadNextPageLocked === false) {
this.page.set(this.page.get() + 1); this.page.set(this.page.get() + 1);
@ -49,9 +78,14 @@ BlazeComponent.extendComponent({
this.loading.set(w); this.loading.set(w);
}, },
peopleList() { peopleList() {
return Users.find({}, { const users = Users.find(this.findUsersOptions.get(), {
fields: {_id: true}, fields: {_id: true},
}); });
this.number.set(users.count());
return users;
},
peopleNumber() {
return this.number.get();
}, },
}).register('people'); }).register('people');

View file

@ -13,3 +13,24 @@ table
tr:nth-child(even) tr:nth-child(even)
background-color: #dddddd; 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;

View file

@ -686,5 +686,6 @@
"error-ldap-login": "An error occurred while trying to login", "error-ldap-login": "An error occurred while trying to login",
"display-authentication-method": "Display Authentication Method", "display-authentication-method": "Display Authentication Method",
"default-authentication-method": "Default Authentication Method", "default-authentication-method": "Default Authentication Method",
"duplicate-board": "Duplicate Board" "duplicate-board": "Duplicate Board",
"people-number": "The number of people is: "
} }

View file

@ -683,5 +683,6 @@
"error-ldap-login": "Une erreur s'est produite lors de la tentative de connexion", "error-ldap-login": "Une erreur s'est produite lors de la tentative de connexion",
"display-authentication-method": "Afficher la méthode d'authentification", "display-authentication-method": "Afficher la méthode d'authentification",
"default-authentication-method": "Méthode d'authentification par défaut", "default-authentication-method": "Méthode d'authentification par défaut",
"duplicate-board": "Dupliquer le tableau" "duplicate-board": "Dupliquer le tableau",
"people-number": "Le nombre d'utilisateurs est de : "
} }