diff options
author | Maxime Quandalle <maxime@quandalle.com> | 2015-06-19 14:39:38 +0200 |
---|---|---|
committer | Maxime Quandalle <maxime@quandalle.com> | 2015-06-19 14:39:38 +0200 |
commit | 8cf9ec266055f065c428216d53018c83b63675c6 (patch) | |
tree | 7277b335901d3b5a40ab2851f227691ceb97b356 /client/lib/popup.js | |
parent | fad4cba5e20b3273c2adc80b7a7c5c9fa57ed720 (diff) | |
download | wekan-8cf9ec266055f065c428216d53018c83b63675c6.tar.gz wekan-8cf9ec266055f065c428216d53018c83b63675c6.tar.bz2 wekan-8cf9ec266055f065c428216d53018c83b63675c6.zip |
Allow a user to edit its profile or avatar from a member popover
Fixes the data context on the member popover in the details pane. Also
change the way Popover detect if the click is initiated from a parent
popover -- from reading Blaze context, to looking at the event target
parents.
Diffstat (limited to 'client/lib/popup.js')
-rw-r--r-- | client/lib/popup.js | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/client/lib/popup.js b/client/lib/popup.js index 3813319d..84d4b63a 100644 --- a/client/lib/popup.js +++ b/client/lib/popup.js @@ -16,6 +16,10 @@ Popup = { var self = this; var popupName = name + 'Popup'; + var clickFromPopup = function(evt) { + return $(evt.target).closest('.js-pop-over').length !== 0; + }; + return function(evt) { // If a popup is already openened, clicking again on the opener element // should close it -- and interupt the current `open` function. @@ -34,7 +38,7 @@ Popup = { // has one. This allows us to position a sub-popup exactly at the same // position than its parent. var openerElement; - if (self._hasPopupParent()) { + if (clickFromPopup(evt)) { openerElement = self._getTopStack().openerElement; } else { self._stack = []; @@ -47,9 +51,8 @@ Popup = { // We push our popup data to the stack. The top of the stack is always // used as the data source for our current popup. self._stack.push({ - __isPopup: true, popupName: popupName, - hasPopupParent: self._hasPopupParent(), + hasPopupParent: clickFromPopup(evt), title: self._getTitle(popupName), openerElement: openerElement, depth: self._stack.length, @@ -155,15 +158,6 @@ Popup = { return this._stack[this._stack.length - 1]; }, - // We use the blaze API to determine if the current popup has been opened from - // a parent popup. The number we give to the `Template.parentData` has been - // determined experimentally and is susceptible to change if you modify the - // `Popup.template` - _hasPopupParent: function() { - var tryParentData = Template.parentData(3); - return !! (tryParentData && tryParentData.__isPopup); - }, - // We automatically calculate the popup offset from the reference element // position and dimensions. We also reactively use the window dimensions to // ensure that the popup is always visible on the screen. |