Add modals.info_overlay_open().

This also removes ui_state.js, since its last function
is now replaced by modals.info_overlay_open().
This commit is contained in:
Steve Howell 2017-05-09 07:45:02 -07:00 committed by Tim Abbott
parent 00e057bf44
commit 70d4ac93ce
6 changed files with 11 additions and 23 deletions

View File

@ -27,7 +27,6 @@
"popovers": false,
"server_events": false,
"ui": false,
"ui_state": false,
"ui_report": false,
"ui_util": false,
"lightbox": false,

View File

@ -178,10 +178,11 @@ function stubbing(func_name_to_stub, test_function) {
_.each([return_true, return_false], function (is_settings_page) {
_.each([return_true, return_false], function (is_active) {
_.each([return_true, return_false], function (is_info_overlay) {
_.each([return_true, return_false], function (info_overlay_open) {
hotkey.is_settings_page = is_settings_page;
set_global('modals', {is_active: is_active});
set_global('ui_state', {is_info_overlay: is_info_overlay});
set_global('modals', {
is_active: is_active,
info_overlay_open: info_overlay_open});
test_normal_typing();
});
@ -317,10 +318,10 @@ function stubbing(func_name_to_stub, test_function) {
assert_mapping('spacebar', 'navigate.page_down');
assert_mapping('up_arrow', 'navigate.up');
ui_state.is_info_overlay = return_true;
modals.info_overlay_open = return_true;
assert_unmapped('down_arrow');
assert_unmapped('up_arrow');
ui_state.is_info_overlay = return_false;
modals.info_overlay_open = return_false;
hotkey.is_subs = return_true;
assert_mapping('up_arrow', 'subs.switch_rows');

View File

@ -452,7 +452,7 @@ exports.process_hotkey = function (e, hotkey) {
return reactions.reaction_navigate(e, event_name);
}
if (ui_state.is_info_overlay()) {
if (modals.info_overlay_open()) {
return false;
}

View File

@ -16,6 +16,10 @@ exports.is_active = function () {
return !!open_modal_name;
};
exports.info_overlay_open = function () {
return open_modal_name === 'informationalOverlays';
};
exports.open_overlay = function (opts) {
if (!opts.name || !opts.overlay || !opts.on_close) {
blueslip.error('Programming error in open_modal');

View File

@ -1,15 +0,0 @@
var ui_state = (function () {
var exports = {};
exports.is_info_overlay = function () {
return ($(".informational-overlays").hasClass("show"));
};
return exports;
}());
if (typeof module !== 'undefined') {
module.exports = ui_state;
}

View File

@ -877,7 +877,6 @@ JS_SPECS = {
'js/list_rendering.js',
'js/floating_recipient_bar.js',
'js/lightbox.js',
'js/ui_state.js',
'js/ui_report.js',
'js/ui.js',
'js/ui_util.js',