mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 23:40:13 +01:00
Global Search Card Popup has now every data if the search was opened from another board
- the global search only returns the card details data needed to display the search results, but for opening the popup card details a lot more information is needed. It already worked if the data was already in the minimongo, but if not, nearly nothing was displayed
This commit is contained in:
parent
72ddd66495
commit
4733afe4eb
6 changed files with 58 additions and 9 deletions
|
|
@ -547,6 +547,7 @@ Template.cardDetails.helpers({
|
||||||
});
|
});
|
||||||
Template.cardDetailsPopup.onDestroyed(() => {
|
Template.cardDetailsPopup.onDestroyed(() => {
|
||||||
Session.delete('popupCard');
|
Session.delete('popupCard');
|
||||||
|
Session.delete('popupCardBoardId');
|
||||||
});
|
});
|
||||||
Template.cardDetailsPopup.helpers({
|
Template.cardDetailsPopup.helpers({
|
||||||
popupCard() {
|
popupCard() {
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,16 @@ Template.resultCard.helpers({
|
||||||
BlazeComponent.extendComponent({
|
BlazeComponent.extendComponent({
|
||||||
clickOnMiniCard(evt) {
|
clickOnMiniCard(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
Session.set('popupCard', this.currentData()._id);
|
const this_ = this;
|
||||||
this.cardDetailsPopup(evt);
|
const cardId = this.currentData()._id;
|
||||||
|
const boardId = this.currentData().boardId;
|
||||||
|
Meteor.subscribe('popupCardData', cardId, {
|
||||||
|
onReady() {
|
||||||
|
Session.set('popupCard', cardId);
|
||||||
|
Session.set('popupCardBoardId', boardId);
|
||||||
|
this_.cardDetailsPopup(evt);
|
||||||
|
},
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
cardDetailsPopup(event) {
|
cardDetailsPopup(event) {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
Blaze.registerHelper('currentBoard', () => {
|
Blaze.registerHelper('currentBoard', () => {
|
||||||
const boardId = Session.get('currentBoard');
|
const ret = Utils.getCurrentBoard();
|
||||||
if (boardId) {
|
return ret;
|
||||||
return Boards.findOne(boardId);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Blaze.registerHelper('currentCard', () => {
|
Blaze.registerHelper('currentCard', () => {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,16 @@
|
||||||
Utils = {
|
Utils = {
|
||||||
|
/** returns the current board id
|
||||||
|
* <li> returns the current board id or the board id of the popup card if set
|
||||||
|
*/
|
||||||
|
getCurrentBoardId() {
|
||||||
|
let popupCardBoardId = Session.get('popupCardBoardId');
|
||||||
|
let currentBoard = Session.get('currentBoard');
|
||||||
|
let ret = currentBoard;
|
||||||
|
if (popupCardBoardId) {
|
||||||
|
ret = popupCardBoardId;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
},
|
||||||
getCurrentCardId(ignorePopupCard) {
|
getCurrentCardId(ignorePopupCard) {
|
||||||
let ret = Session.get('currentCard');
|
let ret = Session.get('currentCard');
|
||||||
if (!ret && !ignorePopupCard) {
|
if (!ret && !ignorePopupCard) {
|
||||||
|
|
@ -10,6 +22,14 @@ Utils = {
|
||||||
const ret = Session.get('popupCard');
|
const ret = Session.get('popupCard');
|
||||||
return ret;
|
return ret;
|
||||||
},
|
},
|
||||||
|
/** returns the current board
|
||||||
|
* <li> returns the current board or the board of the popup card if set
|
||||||
|
*/
|
||||||
|
getCurrentBoard() {
|
||||||
|
const boardId = Utils.getCurrentBoardId();
|
||||||
|
const ret = Boards.findOne(boardId);
|
||||||
|
return ret;
|
||||||
|
},
|
||||||
getCurrentCard(ignorePopupCard) {
|
getCurrentCard(ignorePopupCard) {
|
||||||
const cardId = Utils.getCurrentCardId(ignorePopupCard);
|
const cardId = Utils.getCurrentCardId(ignorePopupCard);
|
||||||
const ret = Cards.findOne(cardId);
|
const ret = Cards.findOne(cardId);
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ FlowRouter.route('/', {
|
||||||
Session.set('currentList', null);
|
Session.set('currentList', null);
|
||||||
Session.set('currentCard', null);
|
Session.set('currentCard', null);
|
||||||
Session.set('popupCard', null);
|
Session.set('popupCard', null);
|
||||||
|
Session.set('popupCardBoardId', null);
|
||||||
|
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
Session.set('sortBy', '');
|
Session.set('sortBy', '');
|
||||||
|
|
@ -36,6 +37,7 @@ FlowRouter.route('/public', {
|
||||||
Session.set('currentList', null);
|
Session.set('currentList', null);
|
||||||
Session.set('currentCard', null);
|
Session.set('currentCard', null);
|
||||||
Session.set('popupCard', null);
|
Session.set('popupCard', null);
|
||||||
|
Session.set('popupCardBoardId', null);
|
||||||
|
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
Session.set('sortBy', '');
|
Session.set('sortBy', '');
|
||||||
|
|
@ -59,6 +61,7 @@ FlowRouter.route('/b/:id/:slug', {
|
||||||
Session.set('currentBoard', currentBoard);
|
Session.set('currentBoard', currentBoard);
|
||||||
Session.set('currentCard', null);
|
Session.set('currentCard', null);
|
||||||
Session.set('popupCard', null);
|
Session.set('popupCard', null);
|
||||||
|
Session.set('popupCardBoardId', null);
|
||||||
|
|
||||||
// If we close a card, we'll execute again this route action but we don't
|
// If we close a card, we'll execute again this route action but we don't
|
||||||
// want to excape every current actions (filters, etc.)
|
// want to excape every current actions (filters, etc.)
|
||||||
|
|
@ -88,6 +91,7 @@ FlowRouter.route('/b/:boardId/:slug/:cardId', {
|
||||||
Session.set('currentBoard', params.boardId);
|
Session.set('currentBoard', params.boardId);
|
||||||
Session.set('currentCard', params.cardId);
|
Session.set('currentCard', params.cardId);
|
||||||
Session.set('popupCard', null);
|
Session.set('popupCard', null);
|
||||||
|
Session.set('popupCardBoardId', null);
|
||||||
|
|
||||||
Utils.manageCustomUI();
|
Utils.manageCustomUI();
|
||||||
Utils.manageMatomo();
|
Utils.manageMatomo();
|
||||||
|
|
@ -217,6 +221,7 @@ FlowRouter.route('/import/:source', {
|
||||||
Session.set('currentList', null);
|
Session.set('currentList', null);
|
||||||
Session.set('currentCard', null);
|
Session.set('currentCard', null);
|
||||||
Session.set('popupCard', null);
|
Session.set('popupCard', null);
|
||||||
|
Session.set('popupCardBoardId', null);
|
||||||
Session.set('importSource', params.source);
|
Session.set('importSource', params.source);
|
||||||
|
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
|
|
@ -238,6 +243,7 @@ FlowRouter.route('/setting', {
|
||||||
Session.set('currentList', null);
|
Session.set('currentList', null);
|
||||||
Session.set('currentCard', null);
|
Session.set('currentCard', null);
|
||||||
Session.set('popupCard', null);
|
Session.set('popupCard', null);
|
||||||
|
Session.set('popupCardBoardId', null);
|
||||||
|
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
Session.set('sortBy', '');
|
Session.set('sortBy', '');
|
||||||
|
|
@ -262,6 +268,7 @@ FlowRouter.route('/information', {
|
||||||
Session.set('currentList', null);
|
Session.set('currentList', null);
|
||||||
Session.set('currentCard', null);
|
Session.set('currentCard', null);
|
||||||
Session.set('popupCard', null);
|
Session.set('popupCard', null);
|
||||||
|
Session.set('popupCardBoardId', null);
|
||||||
|
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
Session.set('sortBy', '');
|
Session.set('sortBy', '');
|
||||||
|
|
@ -285,6 +292,7 @@ FlowRouter.route('/people', {
|
||||||
Session.set('currentList', null);
|
Session.set('currentList', null);
|
||||||
Session.set('currentCard', null);
|
Session.set('currentCard', null);
|
||||||
Session.set('popupCard', null);
|
Session.set('popupCard', null);
|
||||||
|
Session.set('popupCardBoardId', null);
|
||||||
|
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
Session.set('sortBy', '');
|
Session.set('sortBy', '');
|
||||||
|
|
@ -308,6 +316,7 @@ FlowRouter.route('/admin-reports', {
|
||||||
Session.set('currentList', null);
|
Session.set('currentList', null);
|
||||||
Session.set('currentCard', null);
|
Session.set('currentCard', null);
|
||||||
Session.set('popupCard', null);
|
Session.set('popupCard', null);
|
||||||
|
Session.set('popupCardBoardId', null);
|
||||||
|
|
||||||
Filter.reset();
|
Filter.reset();
|
||||||
Session.set('sortBy', '');
|
Session.set('sortBy', '');
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,22 @@ const escapeForRegex = require('escape-string-regexp');
|
||||||
|
|
||||||
Meteor.publish('card', cardId => {
|
Meteor.publish('card', cardId => {
|
||||||
check(cardId, String);
|
check(cardId, String);
|
||||||
return Cards.find({ _id: cardId });
|
const ret = Cards.find({ _id: cardId });
|
||||||
|
return ret;
|
||||||
|
});
|
||||||
|
|
||||||
|
/** publish all data which is necessary to display card details as popup
|
||||||
|
* @returns array of cursors
|
||||||
|
*/
|
||||||
|
Meteor.publishRelations('popupCardData', function(cardId) {
|
||||||
|
check(cardId, String);
|
||||||
|
this.cursor(
|
||||||
|
Cards.find({_id: cardId}),
|
||||||
|
function(cardId, card) {
|
||||||
|
this.cursor(Boards.find({_id: card.boardId}));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return this.ready()
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.publish('myCards', function(sessionId) {
|
Meteor.publish('myCards', function(sessionId) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue