Fix and update easysearch

This commit is contained in:
Daniel Kaiser 2022-08-05 13:06:02 +02:00
parent 3ddb97c8c9
commit 339e044a30
11 changed files with 40 additions and 45 deletions

View file

@ -561,7 +561,7 @@ template(name="removeBoardTeamPopup")
template(name="addMemberPopup")
.js-search-member
+esInput(index="users")
+EasySearch.Input(index=searchIndex)
if loading.get
+spinner
@ -569,20 +569,20 @@ template(name="addMemberPopup")
.warning {{_ error.get}}
else
ul.pop-over-list
+esEach(index="users")
+EasySearch.Each(index=searchIndex)
li.item.js-member-item(class="{{#if isBoardMember}}disabled{{/if}}")
a.name.js-select-member(title="{{profile.fullname}} ({{username}})")
+userAvatar(userId=_id esSearch=true)
+userAvatar(userId=__originalId)
span.full-name
= profile.fullname
| (<span class="username">{{username}}</span>)
if isBoardMember
.quiet ({{_ 'joined'}})
+ifEsIsSearching(index='users')
+EasySearch.IfSearching(index=searchIndex)
+spinner
+ifEsHasNoResults(index="users")
+EasySearch.IfNoResults(index=searchIndex)
.manage-member-section
p.quiet {{_ 'no-results'}}
button.js-email-invite.primary.full {{_ 'email-invite'}}

View file

@ -1333,7 +1333,7 @@ BlazeComponent.extendComponent({
},
isBoardMember() {
const userId = this.currentData()._id;
const userId = this.currentData().__originalId;
const user = Users.findOne(userId);
return user && user.isBoardMember();
},
@ -1373,7 +1373,7 @@ BlazeComponent.extendComponent({
this.setError('');
},
'click .js-select-member'() {
const userId = this.currentData()._id;
const userId = this.currentData().__originalId;
const currentBoard = Boards.findOne(Session.get('currentBoard'));
if (!currentBoard.hasMember(userId)) {
this.inviteUser(userId);
@ -1390,6 +1390,10 @@ BlazeComponent.extendComponent({
},
}).register('addMemberPopup');
Template.addMemberPopup.helpers({
searchIndex: () => Users.search_index,
})
BlazeComponent.extendComponent({
onCreated() {
this.error = new ReactiveVar('');