From 3c3877f1b5a35279de60ad8155e1ecf4e0bb8077 Mon Sep 17 00:00:00 2001 From: Waseem Daher Date: Mon, 29 Oct 2012 15:48:22 -0400 Subject: [PATCH] Have Esc dismiss userinfo popover. It's possible that the three places we can kill a popover (body click, Esc, clicking on a new one) should be refactored to use the same code. (imported from commit ba7eab480fd2258abfb469c8f1155f29bc63f7f6) --- tools/jslint/check-all.js | 1 + zephyr/static/js/hotkey.js | 7 +++++-- zephyr/static/js/ui.js | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/jslint/check-all.js b/tools/jslint/check-all.js index a5da83f2a6..ba3171339b 100644 --- a/tools/jslint/check-all.js +++ b/tools/jslint/check-all.js @@ -36,6 +36,7 @@ var globals = + ' register_onclick hide_email show_email' + ' report_error report_success report_message clicking mouse_moved' + ' update_autocomplete autocomplete_needs_update' + + ' userinfo_currently_popped' // zephyr.js + ' message_array message_dict get_updates_params' diff --git a/zephyr/static/js/hotkey.js b/zephyr/static/js/hotkey.js index 573d5997f6..945515fa0c 100644 --- a/zephyr/static/js/hotkey.js +++ b/zephyr/static/js/hotkey.js @@ -91,8 +91,11 @@ function process_hotkey(code) { select_message(rows.last_visible(), {then_scroll: false}); } return false; - case 27: // Esc: cancel compose or un-narrow - if (compose.composing()) { + case 27: // Esc: close userinfo popup, cancel compose, or un-narrow + if (userinfo_currently_popped !== undefined) { + userinfo_currently_popped.popover("destroy"); + userinfo_currently_popped = undefined; + } else if (compose.composing()) { compose.cancel(); } else { narrow.show_all_messages(); diff --git a/zephyr/static/js/ui.js b/zephyr/static/js/ui.js index c66c0f23f9..552b2e8a23 100644 --- a/zephyr/static/js/ui.js +++ b/zephyr/static/js/ui.js @@ -256,6 +256,7 @@ function userinfo_popover(event, element, id) { // One popover at a time. if (userinfo_currently_popped) { userinfo_currently_popped.popover("destroy"); + userinfo_currently_popped = undefined; } var message = message_dict[id]; elt.popover({placement: "bottom",