modals: Use selectors for open_modal/close_modal.

When reading the calling code, it's helpful to know
that we're really just passing in a selector.  The
calls to open_modal/close_modal are nicer now to
reconcile with surrounding code, and you don't have
to guess whether the parameter is some kind of
"key" value--it really just refers directly to a DOM
element.

There is nothing user-visible about this change, but
the blueslip info messages now include the hash:

    open modal: open #change_email_modal
This commit is contained in:
Steve Howell
2020-05-09 13:45:54 +00:00
committed by Tim Abbott
parent d3aded2ae7
commit 2272c5e6eb
8 changed files with 47 additions and 40 deletions

View File

@@ -51,7 +51,7 @@ exports.launch = function (conf) {
// Close any existing modals--on settings screens you can
// have multiple buttons that need confirmation.
if (overlays.is_modal_open()) {
overlays.close_modal('confirm_dialog_modal');
overlays.close_modal('#confirm_dialog_modal');
}
confirm_dialog.find('.confirm_dialog_heading').html(conf.html_heading);
@@ -63,7 +63,7 @@ exports.launch = function (conf) {
// Set up handlers.
yes_button.on('click', function () {
overlays.close_modal('confirm_dialog_modal');
overlays.close_modal('#confirm_dialog_modal');
conf.on_click();
});
@@ -72,7 +72,7 @@ exports.launch = function (conf) {
});
// Open the modal
overlays.open_modal('confirm_dialog_modal');
overlays.open_modal('#confirm_dialog_modal');
};
window.confirm_dialog = exports;