mirror of
https://github.com/wekan/wekan.git
synced 2025-04-22 04:57:07 -04:00
Minicard, label popup only opened if a label is clicked
This commit is contained in:
parent
d79a35ea82
commit
0025212b3e
2 changed files with 17 additions and 3 deletions
|
@ -49,6 +49,16 @@ BlazeComponent.extendComponent({
|
|||
return false;
|
||||
},
|
||||
|
||||
/** opens the card label popup only if clicked onto a label
|
||||
* <li> this is necessary to have the data context of the minicard.
|
||||
* if .js-card-label is used at click event, then only the data context of the label itself is available at this.currentData()
|
||||
*/
|
||||
cardLabelsPopup(event) {
|
||||
if (this.find('.js-card-label:hover')) {
|
||||
Popup.open("cardLabels")(event, this.currentData());
|
||||
}
|
||||
},
|
||||
|
||||
events() {
|
||||
return [
|
||||
{
|
||||
|
@ -65,7 +75,7 @@ BlazeComponent.extendComponent({
|
|||
}
|
||||
},
|
||||
'click span.badge-icon.fa.fa-sort, click span.badge-text.check-list-sort' : Popup.open("editCardSortOrder"),
|
||||
'click .minicard-labels' : Popup.open("cardLabels"),
|
||||
'click .minicard-labels' : this.cardLabelsPopup,
|
||||
}
|
||||
];
|
||||
},
|
||||
|
|
|
@ -30,7 +30,11 @@ window.Popup = new (class {
|
|||
function clickFromPopup(evt) {
|
||||
return $(evt.target).closest('.js-pop-over').length !== 0;
|
||||
}
|
||||
return function(evt) {
|
||||
/** opens the popup
|
||||
* @param evt the current event
|
||||
* @param dataContextIfCurrentDataIsUndefined use this dataContext if this.currentData() is undefined
|
||||
*/
|
||||
return function(evt, dataContextIfCurrentDataIsUndefined) {
|
||||
// If a popup is already opened, clicking again on the opener element
|
||||
// should close it -- and interrupt the current `open` function.
|
||||
if (self.isOpen()) {
|
||||
|
@ -67,7 +71,7 @@ window.Popup = new (class {
|
|||
title: self._getTitle(popupName),
|
||||
depth: self._stack.length,
|
||||
offset: self._getOffset(openerElement),
|
||||
dataContext: (this && this.currentData && this.currentData()) || this,
|
||||
dataContext: (this && this.currentData && this.currentData()) || dataContextIfCurrentDataIsUndefined || this,
|
||||
});
|
||||
|
||||
// If there are no popup currently opened we use the Blaze API to render
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue