mirror of
https://github.com/ansible/awx.git
synced 2026-02-21 05:00:07 -03:30
Remove tooltips if state changes while hovering over a tool tipped element
This commit is contained in:
@@ -477,7 +477,8 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'JobsHelper'])
|
|||||||
return {
|
return {
|
||||||
link: function(scope, element, attrs) {
|
link: function(scope, element, attrs) {
|
||||||
var delay = (attrs.delay !== undefined && attrs.delay !== null) ? attrs.delay : ($AnsibleConfig) ? $AnsibleConfig.tooltip_delay : {show: 500, hide: 100},
|
var delay = (attrs.delay !== undefined && attrs.delay !== null) ? attrs.delay : ($AnsibleConfig) ? $AnsibleConfig.tooltip_delay : {show: 500, hide: 100},
|
||||||
placement;
|
placement,
|
||||||
|
stateChangeWatcher;
|
||||||
if (attrs.awTipPlacement) {
|
if (attrs.awTipPlacement) {
|
||||||
placement = attrs.awTipPlacement;
|
placement = attrs.awTipPlacement;
|
||||||
}
|
}
|
||||||
@@ -493,6 +494,22 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'JobsHelper'])
|
|||||||
template = '<div class="tooltip Tooltip" role="tooltip"><div class="tooltip-arrow Tooltip-arrow"></div><div class="tooltip-inner Tooltip-inner"></div></div>';
|
template = '<div class="tooltip Tooltip" role="tooltip"><div class="tooltip-arrow Tooltip-arrow"></div><div class="tooltip-inner Tooltip-inner"></div></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This block helps clean up tooltips that may get orphaned by a click event
|
||||||
|
$(element).on('mouseenter', function() {
|
||||||
|
if(stateChangeWatcher) {
|
||||||
|
// Un-bind - we don't want a bunch of listeners firing
|
||||||
|
stateChangeWatcher();
|
||||||
|
}
|
||||||
|
stateChangeWatcher = scope.$on('$stateChangeStart', function() {
|
||||||
|
// Go ahead and force the tooltip setTimeout to expire (if it hasn't already fired)
|
||||||
|
$(element).tooltip('hide');
|
||||||
|
// Clean up any existing tooltips including this one
|
||||||
|
$('.tooltip').each(function() {
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$(element).on('hidden.bs.tooltip', function( ) {
|
$(element).on('hidden.bs.tooltip', function( ) {
|
||||||
// TB3RC1 is leaving behind tooltip <div> elements. This will remove them
|
// TB3RC1 is leaving behind tooltip <div> elements. This will remove them
|
||||||
// after a tooltip fades away. If not, they lay overtop of other elements and
|
// after a tooltip fades away. If not, they lay overtop of other elements and
|
||||||
|
|||||||
Reference in New Issue
Block a user