Popover menu: Fix JS widget instantiation, now done automatically but the UIBlock system

This commit is contained in:
Molkobain
2021-03-19 23:43:28 +01:00
parent 86c614d56d
commit e8656e8504
3 changed files with 3 additions and 5 deletions

View File

@@ -56,7 +56,6 @@ $(function()
// the constructor
_create: function () {
this.element.addClass('ibo-navigation-menu');
$(this.js_selectors.user_menu).popover_menu({'toggler': this.js_selectors.user_menu_toggler});
this._bindEvents();
},
// events bound via _bind are removed automatically

View File

@@ -37,8 +37,7 @@ class PopoverMenu extends UIBlock
// Overloaded constants
public const BLOCK_CODE = 'ibo-popover-menu';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/popover-menu/layout';
// TODO 3.0.0: Fix crash when enabling the JS template
//public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/popover-menu/layout';
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/popover-menu/layout';
public const DEFAULT_JS_FILES_REL_PATH = [
'js/components/popover-menu.js',
];

View File

@@ -49,11 +49,11 @@ class PopoverMenuFactory
public static function MakeUserMenuForNavigationMenu()
{
$oMenu = new PopoverMenu('ibo-navigation-menu--user-menu');
$oMenu->SetTogglerJSSelector('[data-role="ibo-navigation-menu--user-menu--toggler"]');
// Allowed portals
$aAllowedPortalsItems = static::PrepareAllowedPortalsItemsForUserMenu();
if(!empty($aAllowedPortalsItems))
{
if (!empty($aAllowedPortalsItems)) {
$oMenu->AddSection('allowed_portals')
->SetItems('allowed_portals', $aAllowedPortalsItems);
}