From 1833b8c330dfefbfe9e8f2b1510b918c13ee4766 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Thu, 10 Sep 2015 16:30:44 +0000 Subject: [PATCH 1/5] Allow changing of body text in filechange dialog --- plugins/c9.ide.dialog.common/filechange.js | 3 ++- plugins/c9.ide.watcher/gui.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/c9.ide.dialog.common/filechange.js b/plugins/c9.ide.dialog.common/filechange.js index f98e91ce..ac5676db 100644 --- a/plugins/c9.ide.dialog.common/filechange.js +++ b/plugins/c9.ide.dialog.common/filechange.js @@ -28,10 +28,11 @@ define(function(require, module, exports) { /***** Methods *****/ - function show(title, header, onlocal, onremote, onmerge, options) { + function show(title, header, body, onlocal, onremote, onmerge, options) { return plugin.queue(function(){ plugin.title = title; plugin.heading = util.escapeXml(header); + if (body) plugin.body = util.escapeXml(body); var cb = plugin.getElement("applyall"); cb.uncheck(); diff --git a/plugins/c9.ide.watcher/gui.js b/plugins/c9.ide.watcher/gui.js index f3bf9964..8ea36281 100644 --- a/plugins/c9.ide.watcher/gui.js +++ b/plugins/c9.ide.watcher/gui.js @@ -394,6 +394,7 @@ define(function(require, exports, module) { changeDialog = filechange.show( "File Changed", path + " has been changed on disk.", + null, no, yes, function(all) { // Merge From cca43ff21b869a74d1bffe1bab1f54a76c5a82e5 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Fri, 11 Sep 2015 08:51:01 +0000 Subject: [PATCH 2/5] Options is undefined sometimes causing this to crash --- plugins/c9.ide.dialog.common/filechange.js | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/c9.ide.dialog.common/filechange.js b/plugins/c9.ide.dialog.common/filechange.js index ac5676db..ef74456d 100644 --- a/plugins/c9.ide.dialog.common/filechange.js +++ b/plugins/c9.ide.dialog.common/filechange.js @@ -6,6 +6,7 @@ define(function(require, module, exports) { function main(options, imports, register) { var Dialog = imports.Dialog; var util = imports.util; + options = options || {}; /***** Initialization *****/ From 8c78c04c61d8b2dc82bfa0b4a1c64d6302d3f854 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Fri, 11 Sep 2015 09:05:30 +0000 Subject: [PATCH 3/5] Never have undefined options --- plugins/c9.ide.dialog.common/filechange.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/c9.ide.dialog.common/filechange.js b/plugins/c9.ide.dialog.common/filechange.js index ef74456d..1427af11 100644 --- a/plugins/c9.ide.dialog.common/filechange.js +++ b/plugins/c9.ide.dialog.common/filechange.js @@ -6,7 +6,6 @@ define(function(require, module, exports) { function main(options, imports, register) { var Dialog = imports.Dialog; var util = imports.util; - options = options || {}; /***** Initialization *****/ @@ -30,6 +29,7 @@ define(function(require, module, exports) { /***** Methods *****/ function show(title, header, body, onlocal, onremote, onmerge, options) { + options = options || {}; return plugin.queue(function(){ plugin.title = title; plugin.heading = util.escapeXml(header); From 1ac22b4693c0eee67d5d21e0d44e69eb1fdd3c84 Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Fri, 11 Sep 2015 12:33:37 +0000 Subject: [PATCH 4/5] Allowing changing merge both caption --- plugins/c9.ide.dialog.common/filechange.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/c9.ide.dialog.common/filechange.js b/plugins/c9.ide.dialog.common/filechange.js index 1427af11..37883cf1 100644 --- a/plugins/c9.ide.dialog.common/filechange.js +++ b/plugins/c9.ide.dialog.common/filechange.js @@ -39,6 +39,12 @@ define(function(require, module, exports) { cb.uncheck(); cb.setAttribute("visible", options.all !== false); + if (options.merge) { + var mergeBoth = plugin.getElement("mergeboth"); + if (options.merge.caption) mergeBoth.setAttribute("caption", options.mergeBoth.caption); + } + + plugin.update([ { id: "keepmine", onclick: function(){ plugin.hide(); onlocal(cb.value); } }, { id: "useremote", onclick: function(){ plugin.hide(); onremote(cb.value); } }, From 572f7b0f82632287581b71b15c6ba31cf302efee Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Fri, 11 Sep 2015 13:10:14 +0000 Subject: [PATCH 5/5] Minor fixes --- plugins/c9.ide.dialog.common/filechange.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/c9.ide.dialog.common/filechange.js b/plugins/c9.ide.dialog.common/filechange.js index 37883cf1..189777b1 100644 --- a/plugins/c9.ide.dialog.common/filechange.js +++ b/plugins/c9.ide.dialog.common/filechange.js @@ -41,14 +41,14 @@ define(function(require, module, exports) { if (options.merge) { var mergeBoth = plugin.getElement("mergeboth"); - if (options.merge.caption) mergeBoth.setAttribute("caption", options.mergeBoth.caption); + if (options.merge.caption) mergeBoth.setAttribute("caption", options.merge.caption); } plugin.update([ { id: "keepmine", onclick: function(){ plugin.hide(); onlocal(cb.value); } }, { id: "useremote", onclick: function(){ plugin.hide(); onremote(cb.value); } }, - { id: "mergeboth", visible: options.merge, onclick: function(){ plugin.hide(); onmerge(cb.value); } } + { id: "mergeboth", visible: !!options.merge, onclick: function(){ plugin.hide(); onmerge(cb.value); } } ]); }); }