You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2015/02/17 13:46:50 UTC

[1/2] fauxton commit: updated refs/heads/master to b030b21

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 5bd29916a -> b030b218a


Fix coding style


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/c6e6a438
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/c6e6a438
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/c6e6a438

Branch: refs/heads/master
Commit: c6e6a438f9bd29434215c93f0552db8192fecf75
Parents: 5bd2991
Author: Robert Kowalski <ro...@apache.org>
Authored: Thu Feb 12 19:13:40 2015 +0100
Committer: Robert Kowalski <ro...@apache.org>
Committed: Tue Feb 17 13:46:30 2015 +0100

----------------------------------------------------------------------
 app/addons/fauxton/components.js | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/c6e6a438/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 9ec992a..73b28f6 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -807,31 +807,29 @@ function(app, FauxtonAPI, ace, spin, ZeroClipboard) {
         this.removeIncorrectAnnotations();
       }
 
-      var that = this;
       this.editor.getSession().on('change', function () {
-        that.setHeightToLineCount();
-        that.edited = true;
-      });
+        this.setHeightToLineCount();
+        this.edited = true;
+      }.bind(this));
 
-      $(window).on('beforeunload.editor_'+this.editorId, function() {
-        if (that.edited) {
+      $(window).on('beforeunload.editor_' + this.editorId, function () {
+        if (this.edited) {
           return 'Your changes have not been saved. Click cancel to return to the document.';
         }
-      });
+      }.bind(this));
 
-      FauxtonAPI.beforeUnload("editor_"+this.editorId, function (deferred) {
-        if (that.edited) {
+      FauxtonAPI.beforeUnload('editor_' + this.editorId, function (deferred) {
+        if (this.edited) {
           return 'Your changes have not been saved. Click cancel to return to the document.';
         }
-      });
+      }.bind(this));
     },
 
     cleanup: function () {
-      $(window).off('beforeunload.editor_'+this.editorId);
+      $(window).off('beforeunload.editor_' + this.editorId);
       $(window).off('resize.editor', this.onPageResize);
-      FauxtonAPI.removeBeforeUnload("editor_"+this.editorId);
+      FauxtonAPI.removeBeforeUnload('editor_' + this.editorId);
       this.editor.destroy();
-      this.stopListening(FauxtonAPI.Events, FauxtonAPI.constants.EVENTS.NAVBAR_SIZE_CHANGED);
     },
 
     // we need to track the possible available height of the editor to tell it how large it can grow vertically


[2/2] fauxton commit: updated refs/heads/master to b030b21

Posted by ro...@apache.org.
Fix missing confirmation when leaving editor

Fix for passing false as a string with is evaluated truthy

This fixes a bug where you edited a document and then got no
confirmation dialog if you are really sure you want to leave the
page without saving if you clicked on the navigation bar on the
left.

To not render a property in React we need to pass `null` to it. If
we are passing `false` or `"false"` it gets rendered into the DOM.

Having `data-bypass="false"` will mean to the selector
`:not(["data-bypass"])` that there is a `data-bypass` - containing
a String! (which then matches the selector)

What we want is _no_ `data-bypass` if we don't want to bypass.

Closes COUCHDB-2574


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/b030b218
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/b030b218
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/b030b218

Branch: refs/heads/master
Commit: b030b218a5e9e1fd891bc9750c593f356dd5cb7f
Parents: c6e6a43
Author: Robert Kowalski <ro...@apache.org>
Authored: Thu Feb 12 19:14:58 2015 +0100
Committer: Robert Kowalski <ro...@apache.org>
Committed: Tue Feb 17 13:46:31 2015 +0100

----------------------------------------------------------------------
 ...AfterEditingDocShouldShowAConfirmationBox.js | 37 ++++++++++++++++++++
 app/addons/fauxton/components.react.jsx         |  2 +-
 2 files changed, 38 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/b030b218/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js b/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
new file mode 100644
index 0000000..2a627c5
--- /dev/null
+++ b/app/addons/documents/tests/nightwatch/navigateAfterEditingDocShouldShowAConfirmationBox.js
@@ -0,0 +1,37 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+module.exports = {
+
+  'Navigate to New Doc Page, editing and then clicking on the sidebar should show a confirmation dialog': function (client) {
+    var waitTime = 10000,
+        newDatabaseName = client.globals.testDatabaseName,
+        baseUrl = client.globals.test_settings.launch_url;
+
+    var newLink = '#/database/' + newDatabaseName + '/new';
+
+    client
+      .loginToGUI()
+      .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
+      .waitForElementPresent('#new-all-docs-button', waitTime, false)
+      .click('#new-all-docs-button a')
+      .waitForElementPresent('#new-all-docs-button a[href="'+ newLink + '"]', waitTime, false)
+      .click('#new-all-docs-button a[href="' + newLink + '"]')
+      .waitForElementPresent('.code-region', waitTime, false)
+      .verify.urlEquals(baseUrl+ '/' + newLink)
+
+      .keys(['.ace_variable', 'v'])
+      .click('a[href="#_config"]')
+      .accept_alert()
+      .verify.urlEquals(baseUrl + '/#_config');
+  }
+};

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/b030b218/app/addons/fauxton/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.react.jsx b/app/addons/fauxton/components.react.jsx
index f6a84c7..eb54a1c 100644
--- a/app/addons/fauxton/components.react.jsx
+++ b/app/addons/fauxton/components.react.jsx
@@ -55,7 +55,7 @@ function(FauxtonAPI, React, Stores, Actions) {
 
       return (
         <li data-nav-name={link.title} className={liClassName} >
-          <a href={link.href} target={link.target ? '_blank' : ''} data-bypass={link.target ? 'true' : 'false'}>
+          <a href={link.href} target={link.target ? '_blank' : null} data-bypass={link.target ? 'true' : null}>
             <i className={link.icon + " fonticon "}></i>
             <span dangerouslySetInnerHTML={{__html: link.title }} />
           </a>