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

@@ -388,7 +388,7 @@ exports.set_up = function () {
$("#active_bots_list").on("click", "button.open_edit_bot_form", function (e) {
e.preventDefault();
e.stopPropagation();
overlays.open_modal('edit_bot_modal');
overlays.open_modal('#edit_bot_modal');
const li = $(e.currentTarget).closest('li');
const bot_id = parseInt(li.find('.bot_info').attr('data-user-id'), 10);
const bot = bot_data.get(bot_id);
@@ -475,13 +475,13 @@ exports.set_up = function () {
image_version += 1;
image.find('img').attr('src', data.avatar_url + '&v=' + image_version.toString());
}
overlays.close_modal('edit_bot_modal');
overlays.close_modal('#edit_bot_modal');
},
error: function (xhr) {
loading.destroy_indicator(spinner);
edit_button.show();
errors.text(JSON.parse(xhr.responseText).msg).show();
overlays.close_modal('edit_bot_modal');
overlays.close_modal('#edit_bot_modal');
},
});
},