fix(sidebar): open sidebar if clicked on icons on semi-collapsed sidebar

Closes #27
pull/46/head
Vladimir Lugovsky 9 years ago
parent 0e3bd5b228
commit a2d49ab586

@ -118,13 +118,22 @@
} }
/** @ngInject */ /** @ngInject */
function baUiSrefToggler() { function baUiSrefToggler(baSidebarService) {
return { return {
restrict: 'A', restrict: 'A',
require: '^baSidebarTogglingItem', require: '^baSidebarTogglingItem',
link: function(scope, el, attrs, baSidebarTogglingItem) { link: function(scope, el, attrs, baSidebarTogglingItem) {
el.on('click', function() { el.on('click', function() {
baSidebarTogglingItem.$toggle(); if (baSidebarService.isMenuCollapsed()) {
// If the whole sidebar is collapsed and this item has submenu. We need to open sidebar.
// This should not affect mobiles, because on mobiles sidebar should be hidden at all
scope.$apply(function() {
baSidebarService.setMenuCollapsed(false);
});
baSidebarTogglingItem.$expand();
} else {
baSidebarTogglingItem.$toggle();
}
}); });
} }
}; };

Loading…
Cancel
Save