From f82a22ab368ddb0e1617166e248e308933789a55 Mon Sep 17 00:00:00 2001 From: Chetan Karande Date: Mon, 24 Sep 2012 13:34:59 -0400 Subject: [PATCH 1/5] fix for issue 1561 --- src/LiveDevelopment/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/LiveDevelopment/main.js b/src/LiveDevelopment/main.js index 9ef9c4eb0ea..73a7fe9c8d8 100644 --- a/src/LiveDevelopment/main.js +++ b/src/LiveDevelopment/main.js @@ -118,7 +118,6 @@ define(function main(require, exports, module) { function _handleGoLiveCommand() { if (LiveDevelopment.status >= LiveDevelopment.STATUS_CONNECTING) { LiveDevelopment.close(); - // TODO Ty: when checkmark support lands, remove checkmark } else { if (!params.get("skipLiveDevelopmentInfo") && !prefs.getValue("afterFirstLaunch")) { prefs.setValue("afterFirstLaunch", "true"); @@ -132,8 +131,11 @@ define(function main(require, exports, module) { } else { LiveDevelopment.open(); } - // TODO Ty: when checkmark support lands, add checkmark } + + //update the checkmark next to 'Live Preview' menu item + //add checkmark when LiveDevelopment.status is STATUS_CONNECTING or later; otherwise remove it + CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(LiveDevelopment.status >= LiveDevelopment.STATUS_CONNECTING); } /** Create the menu item "Go Live" */ From 6759e87f4bee2093ee3dfb02e55ef2ec557e73dc Mon Sep 17 00:00:00 2001 From: Chetan Karande Date: Tue, 25 Sep 2012 21:49:46 -0400 Subject: [PATCH 2/5] Fix for Issue 1561 - added eventHandler function for statusChange --- src/LiveDevelopment/main.js | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/LiveDevelopment/main.js b/src/LiveDevelopment/main.js index 73a7fe9c8d8..d69ff630434 100644 --- a/src/LiveDevelopment/main.js +++ b/src/LiveDevelopment/main.js @@ -132,10 +132,6 @@ define(function main(require, exports, module) { LiveDevelopment.open(); } } - - //update the checkmark next to 'Live Preview' menu item - //add checkmark when LiveDevelopment.status is STATUS_CONNECTING or later; otherwise remove it - CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(LiveDevelopment.status >= LiveDevelopment.STATUS_CONNECTING); } /** Create the menu item "Go Live" */ @@ -157,6 +153,20 @@ define(function main(require, exports, module) { // Initialize tooltip for 'not connected' state _setLabel(_$btnGoLive, null, _statusStyle[1], _statusTooltip[1]); } + + /** maintains state of the menu item */ + function _setupGoLiveMenu() { + $(LiveDevelopment).on("statusChange", function statusChange(event, status) { + //update the checkmark next to 'Live Preview' menu item + //add checkmark when status is STATUS_CONNECTING + if (status === LiveDevelopment.STATUS_CONNECTING) { + CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(true); + } else if (status < LiveDevelopment.STATUS_CONNECTING) { + //remove checkmark if status is STATUS_INACTIVE or STATUS_ERROR + CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(false); + } + }); + } /** Create the menu item "Highlight" */ function _setupHighlightButton() { @@ -193,6 +203,8 @@ define(function main(require, exports, module) { LiveDevelopment.init(config); _loadStyles(); _setupGoLiveButton(); + _setupGoLiveMenu(); + /* _setupHighlightButton(); FUTURE - Highlight button */ if (config.debug) { _setupDebugHelpers(); @@ -211,9 +223,9 @@ define(function main(require, exports, module) { } }); } + } window.setTimeout(init); - CommandManager.register(Strings.CMD_LIVE_FILE_PREVIEW, Commands.FILE_LIVE_FILE_PREVIEW, _handleGoLiveCommand); // Export public functions From 03bb814013e577509d66cff14c3f0b3f2316c544 Mon Sep 17 00:00:00 2001 From: Chetan Karande Date: Fri, 28 Sep 2012 22:04:38 -0400 Subject: [PATCH 3/5] Changes to add checkmark only for STATUS_ACTIVE --- src/LiveDevelopment/main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/LiveDevelopment/main.js b/src/LiveDevelopment/main.js index d69ff630434..ac9082b642e 100644 --- a/src/LiveDevelopment/main.js +++ b/src/LiveDevelopment/main.js @@ -154,15 +154,15 @@ define(function main(require, exports, module) { _setLabel(_$btnGoLive, null, _statusStyle[1], _statusTooltip[1]); } - /** maintains state of the menu item */ + /** Maintains state of the menu item */ function _setupGoLiveMenu() { $(LiveDevelopment).on("statusChange", function statusChange(event, status) { - //update the checkmark next to 'Live Preview' menu item - //add checkmark when status is STATUS_CONNECTING - if (status === LiveDevelopment.STATUS_CONNECTING) { + // Update the checkmark next to 'Live Preview' menu item + // Add checkmark when status is STATUS_ACTIVE + if (status === LiveDevelopment.STATUS_ACTIVE) { CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(true); - } else if (status < LiveDevelopment.STATUS_CONNECTING) { - //remove checkmark if status is STATUS_INACTIVE or STATUS_ERROR + } else { + // Remove checkmark in all other cases CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(false); } }); From 563117ba25f9fc47d47ea027c82f7759671aa7c7 Mon Sep 17 00:00:00 2001 From: Chetan Karande Date: Fri, 28 Sep 2012 22:17:45 -0400 Subject: [PATCH 4/5] Unnecessary whitespace cleanup --- src/LiveDevelopment/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LiveDevelopment/main.js b/src/LiveDevelopment/main.js index ac9082b642e..69b922fbfbf 100644 --- a/src/LiveDevelopment/main.js +++ b/src/LiveDevelopment/main.js @@ -223,9 +223,9 @@ define(function main(require, exports, module) { } }); } - } window.setTimeout(init); + CommandManager.register(Strings.CMD_LIVE_FILE_PREVIEW, Commands.FILE_LIVE_FILE_PREVIEW, _handleGoLiveCommand); // Export public functions From 7306f52d8e013e86c83588698d1e9eeb06b0eb5a Mon Sep 17 00:00:00 2001 From: Chetan Karande Date: Tue, 2 Oct 2012 22:35:03 -0400 Subject: [PATCH 5/5] Refined condition for adding checkmark --- src/LiveDevelopment/main.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/LiveDevelopment/main.js b/src/LiveDevelopment/main.js index 69b922fbfbf..0e9d09771fd 100644 --- a/src/LiveDevelopment/main.js +++ b/src/LiveDevelopment/main.js @@ -154,17 +154,12 @@ define(function main(require, exports, module) { _setLabel(_$btnGoLive, null, _statusStyle[1], _statusTooltip[1]); } - /** Maintains state of the menu item */ + /** Maintains state of the Live Preview menu item */ function _setupGoLiveMenu() { $(LiveDevelopment).on("statusChange", function statusChange(event, status) { // Update the checkmark next to 'Live Preview' menu item - // Add checkmark when status is STATUS_ACTIVE - if (status === LiveDevelopment.STATUS_ACTIVE) { - CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(true); - } else { - // Remove checkmark in all other cases - CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(false); - } + // Add checkmark when status is STATUS_ACTIVE; otherwise remove it + CommandManager.get(Commands.FILE_LIVE_FILE_PREVIEW).setChecked(status === LiveDevelopment.STATUS_ACTIVE); }); }