fixing popover bug

This commit is contained in:
John Mitchell
2015-02-18 11:49:35 -05:00
parent 50e174ea43
commit eddaf1e97b

View File

@@ -534,15 +534,23 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
$(element).one('click', showPopover); $(element).one('click', showPopover);
$(element).on('shown.bs.popover', function() { function bindPopoverDismiss() {
$('body').one('click.popover' + id_to_close, function(e) { $('body').one('click.popover' + id_to_close, function(e) {
if ($(e.target).parents(id_to_close).length === 0) { if ($(e.target).parents(id_to_close).length === 0) {
// case: you clicked to open the popover and then you
// clicked outside of it...hide it.
$(element).popover('hide'); $(element).popover('hide');
} else {
// case: you clicked to open the popover and then you
// clicked inside the popover
bindPopoverDismiss();
} }
}); });
}
$(element).on('shown.bs.popover', function() {
bindPopoverDismiss();
$(document).on('keydown.popover', dismissOnEsc); $(document).on('keydown.popover', dismissOnEsc);
}); });
$(element).on('hidden.bs.popover', function() { $(element).on('hidden.bs.popover', function() {