Popover menu: Refactor to remove the necessity of coupling JS and PHP code to instantiate it correctly

This commit is contained in:
Molkobain
2021-03-22 13:21:31 +01:00
parent e8656e8504
commit 65ed5b3fce
14 changed files with 409 additions and 137 deletions

View File

@@ -134,9 +134,6 @@ $(function()
this._ReformatDateTimes();
this._PrepareEntriesSubmitConfirmationDialog();
// TODO 3.0.0: Modify PopoverMenu so we can pass it the ID of the block triggering the open/close
//$(this.element).find(this.js_selectors.send_choices_picker).popover_menu({toggler: this.js_selectors.send_button});
this.element.trigger('ready.activity_panel.itop');
},
// events bound via _bind are removed automatically

View File

@@ -100,11 +100,6 @@ $(function()
this.element.find(this.js_selectors.menu_filter_hint_close).on('click', function (oEvent) {
me._onFilterHintCloseClick(oEvent);
});
// User info
this.element.find(this.js_selectors.user_menu_toggler).on('click', function (oEvent) {
me._onUserMenuTogglerClick(oEvent);
});
},
// Events callbacks
@@ -195,20 +190,6 @@ $(function()
SetUserPreference('navigation_menu.show_filter_hint', false, true);
},
_onUserMenuTogglerClick: function(oEvent)
{
// Avoid anchor glitch
oEvent.preventDefault();
var oEventTarget = $(oEvent.target);
var aEventTargetPos = oEventTarget.position();
$(this.js_selectors.user_menu_container).css({
'top': (aEventTargetPos.top + parseInt(oEventTarget.css('marginTop'), 10) - $(this.js_selectors.user_menu).height()) + 'px',
'left': (aEventTargetPos.left + parseInt(oEventTarget.css('marginLeft'), 10) + oEventTarget.width()) + 'px'
});
$(this.js_selectors.user_menu).popover_menu('togglePopup');
},
// Methods
_checkIfClickShouldCloseDrawer: function(oEvent)
{