mirror of
https://github.com/wekan/wekan.git
synced 2026-02-04 07:31:47 +01:00
Fix and update easysearch
This commit is contained in:
parent
3ddb97c8c9
commit
339e044a30
11 changed files with 40 additions and 45 deletions
|
|
@ -1811,13 +1811,7 @@ Template.cardAssigneesPopup.helpers({
|
|||
|
||||
Template.cardAssigneePopup.helpers({
|
||||
userData() {
|
||||
// We need to handle a special case for the search results provided by the
|
||||
// `matteodem:easy-search` package. Since these results gets published in a
|
||||
// separate collection, and not in the standard Meteor.Users collection as
|
||||
// expected, we use a component parameter ("property") to distinguish the
|
||||
// two cases.
|
||||
const userCollection = this.esSearch ? ESSearchResults : Users;
|
||||
return userCollection.findOne(this.userId, {
|
||||
return Users.findOne(this.userId, {
|
||||
fields: {
|
||||
profile: 1,
|
||||
username: 1,
|
||||
|
|
|
|||
|
|
@ -56,17 +56,17 @@ template(name="importMapMembersAddPopup")
|
|||
p
|
||||
| {{_ 'import-user-select'}}
|
||||
.js-map-member
|
||||
+esInput(index="users")
|
||||
+EasySearch.Input(index=searchIndex)
|
||||
ul.pop-over-list
|
||||
+esEach(index="users")
|
||||
+EasySearch.Each(index=searchIndex)
|
||||
li.item.js-member-item
|
||||
a.name.js-select-import(title="{{profile.fullname}} ({{username}})" data-id="{{_id}}")
|
||||
+userAvatar(userId=_id esSearch=true)
|
||||
a.name.js-select-import(title="{{profile.fullname}} ({{username}})" data-id="{{__originalId}}")
|
||||
+userAvatar(userId=__originalId)
|
||||
span.full-name
|
||||
= profile.fullname
|
||||
| (<span class="username">{{username}}</span>)
|
||||
+ifEsIsSearching(index='users')
|
||||
+EasySearch.IfSearching(index=searchIndex)
|
||||
+spinner
|
||||
+ifEsHasNoResults(index="users")
|
||||
+EasySearch.IfNoResults(index=searchIndex)
|
||||
.manage-member-section
|
||||
p.quiet {{_ 'no-results'}}
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ BlazeComponent.extendComponent({
|
|||
},
|
||||
|
||||
onSelectUser() {
|
||||
Popup.getOpenerComponent().mapSelectedMember(this.currentData()._id);
|
||||
Popup.getOpenerComponent(5).mapSelectedMember(this.currentData().__originalId);
|
||||
Popup.back();
|
||||
},
|
||||
|
||||
|
|
@ -309,3 +309,7 @@ BlazeComponent.extendComponent({
|
|||
];
|
||||
},
|
||||
}).register('importMapMembersAddPopup');
|
||||
|
||||
Template.importMapMembersAddPopup.helpers({
|
||||
searchIndex: () => Users.search_index,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -190,22 +190,19 @@ BlazeComponent.extendComponent({
|
|||
|
||||
Template.orgRow.helpers({
|
||||
orgData() {
|
||||
const orgCollection = this.esSearch ? ESSearchResults : Org;
|
||||
return orgCollection.findOne(this.orgId);
|
||||
return Org.findOne(this.orgId);
|
||||
},
|
||||
});
|
||||
|
||||
Template.teamRow.helpers({
|
||||
teamData() {
|
||||
const teamCollection = this.esSearch ? ESSearchResults : Team;
|
||||
return teamCollection.findOne(this.teamId);
|
||||
return Team.findOne(this.teamId);
|
||||
},
|
||||
});
|
||||
|
||||
Template.peopleRow.helpers({
|
||||
userData() {
|
||||
const userCollection = this.esSearch ? ESSearchResults : Users;
|
||||
return userCollection.findOne(this.userId);
|
||||
return Users.findOne(this.userId);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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'}}
|
||||
|
|
|
|||
|
|
@ -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('');
|
||||
|
|
|
|||
|
|
@ -7,13 +7,7 @@ import { formatFleURL } from 'meteor/ostrio:files/lib';
|
|||
|
||||
Template.userAvatar.helpers({
|
||||
userData() {
|
||||
// We need to handle a special case for the search results provided by the
|
||||
// `matteodem:easy-search` package. Since these results gets published in a
|
||||
// separate collection, and not in the standard Meteor.Users collection as
|
||||
// expected, we use a component parameter ("property") to distinguish the
|
||||
// two cases.
|
||||
const userCollection = this.esSearch ? ESSearchResults : Users;
|
||||
return userCollection.findOne(this.userId, {
|
||||
return Users.findOne(this.userId, {
|
||||
fields: {
|
||||
profile: 1,
|
||||
username: 1,
|
||||
|
|
@ -95,8 +89,7 @@ BlazeComponent.extendComponent({
|
|||
|
||||
Template.boardOrgRow.helpers({
|
||||
orgData() {
|
||||
const orgCollection = this.esSearch ? ESSearchResults : Org;
|
||||
return orgCollection.findOne(this.orgId);
|
||||
return Org.findOne(this.orgId);
|
||||
},
|
||||
currentUser(){
|
||||
return Meteor.user();
|
||||
|
|
@ -158,8 +151,7 @@ BlazeComponent.extendComponent({
|
|||
|
||||
Template.boardTeamRow.helpers({
|
||||
teamData() {
|
||||
const teamCollection = this.esSearch ? ESSearchResults : Team;
|
||||
return teamCollection.findOne(this.teamId);
|
||||
return Team.findOne(this.teamId);
|
||||
},
|
||||
currentUser(){
|
||||
return Meteor.user();
|
||||
|
|
|
|||
|
|
@ -149,8 +149,8 @@ window.Popup = new (class {
|
|||
}
|
||||
}
|
||||
|
||||
getOpenerComponent() {
|
||||
const { openerElement } = Template.parentData(4);
|
||||
getOpenerComponent(n=4) {
|
||||
const { openerElement } = Template.parentData(n);
|
||||
return BlazeComponent.getComponentForElement(openerElement);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue