From eddaf1e97bc3d9b70a6c049cb5301a6f11c4d3c6 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Wed, 18 Feb 2015 11:49:35 -0500 Subject: [PATCH] fixing popover bug --- awx/ui/static/lib/ansible/directives.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/awx/ui/static/lib/ansible/directives.js b/awx/ui/static/lib/ansible/directives.js index cf97f9d8e8..8e539685a1 100644 --- a/awx/ui/static/lib/ansible/directives.js +++ b/awx/ui/static/lib/ansible/directives.js @@ -534,15 +534,23 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job $(element).one('click', showPopover); - $(element).on('shown.bs.popover', function() { + function bindPopoverDismiss() { $('body').one('click.popover' + id_to_close, function(e) { 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'); + } 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); - }); $(element).on('hidden.bs.popover', function() {