ux(): sidemenu, fix to hide subnav menu when you click on hover subnav items

This commit is contained in:
Torkel Ödegaard
2016-02-26 10:22:06 +01:00
parent c521182ceb
commit b98e5690eb
2 changed files with 17 additions and 7 deletions

View File

@@ -38,7 +38,6 @@ export class SideMenuCtrl {
openUserDropdown() {
this.orgMenu = [
{section: 'You', cssClass: 'dropdown-menu-title'},
{text: 'Preferences', url: this.getUrl('/profile')},
{text: 'Profile', url: this.getUrl('/profile')},
];
@@ -100,6 +99,22 @@ export function sideMenuDirective() {
bindToController: true,
controllerAs: 'ctrl',
scope: {},
link: function(scope, elem) {
// hack to hide dropdown menu
elem.on('click.dropdown', '.dropdown-menu a', function(evt) {
var menu = $(evt.target).parents('.dropdown-menu');
var parent = menu.parent();
menu.detach();
setTimeout(function() {
parent.append(menu);
}, 100);
});
scope.$on("$destory", function() {
elem.off('click.dropdown');
});
}
};
}