|
|
@ -29,11 +29,7 @@ |
|
|
|
// TODO move to UI components
|
|
|
|
// TODO move to UI components
|
|
|
|
angular.module('openproject.uiComponents') |
|
|
|
angular.module('openproject.uiComponents') |
|
|
|
|
|
|
|
|
|
|
|
.directive('withDropdown', function () { |
|
|
|
.directive('withDropdown', ['$rootScope', function ($rootScope) { |
|
|
|
|
|
|
|
|
|
|
|
function hideAllDropdowns() { |
|
|
|
|
|
|
|
jQuery('.dropdown').hide(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function position(dropdown, trigger) { |
|
|
|
function position(dropdown, trigger) { |
|
|
|
var hOffset = 0, |
|
|
|
var hOffset = 0, |
|
|
@ -67,6 +63,10 @@ angular.module('openproject.uiComponents') |
|
|
|
dropdownId: '@' |
|
|
|
dropdownId: '@' |
|
|
|
}, |
|
|
|
}, |
|
|
|
link: function (scope, element, attributes) { |
|
|
|
link: function (scope, element, attributes) { |
|
|
|
|
|
|
|
$rootScope.$on('hideAllDropdowns', function(event){ |
|
|
|
|
|
|
|
jQuery('.dropdown').hide(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
element.on('click', function () { |
|
|
|
element.on('click', function () { |
|
|
|
|
|
|
|
|
|
|
|
var trigger = jQuery(this), |
|
|
|
var trigger = jQuery(this), |
|
|
@ -74,11 +74,12 @@ angular.module('openproject.uiComponents') |
|
|
|
|
|
|
|
|
|
|
|
event.preventDefault(); |
|
|
|
event.preventDefault(); |
|
|
|
event.stopPropagation(); |
|
|
|
event.stopPropagation(); |
|
|
|
hideAllDropdowns(); |
|
|
|
|
|
|
|
|
|
|
|
scope.$emit('hideAllDropdowns'); |
|
|
|
|
|
|
|
|
|
|
|
dropdown.show(); |
|
|
|
dropdown.show(); |
|
|
|
position(dropdown, trigger); |
|
|
|
position(dropdown, trigger); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|
}; |
|
|
|
}); |
|
|
|
}]); |
|
|
|