couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [12/50] [abbrv] git commit: Fix inappropriate display of "Document saved successfully"
Date Mon, 11 Feb 2013 11:12:15 GMT
Fix inappropriate display of "Document saved successfully"

Background: If a doc is already loaded, the "Document
saved successfully" message appears when it is redisplayed
in the doc editor.

This patch modifies updateValues to check for changedAttributes
in the model and the notification is only displayed if there
are changed attributes.

Note that this correctly handles the case where a document is
saved that has no actual changes, as the _rev will be
different and so changedAttributes will still be truthy.


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

Branch: refs/heads/fauxton
Commit: 825e01d55c2c26454df318c79efeb26f49100e18
Parents: c216334
Author: Mike Wallace <mikewallace1979@googlemail.com>
Authored: Sun Jan 20 16:41:39 2013 +0000
Committer: Mike Wallace <mikewallace1979@googlemail.com>
Committed: Mon Jan 21 13:25:09 2013 +0000

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/825e01d5/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index 31db461..b530c82 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -363,12 +363,15 @@ function(app, FauxtonAPI, Codemirror, JSHint) {
     },
 
     updateValues: function() {
-      notification = FauxtonAPI.addNotification({
-        msg: "Document saved successfully.",
-        type: "success",
-        clear: true
-      });
-      this.editor.setValue(this.model.prettyJSON());
+      var notification;
+      if (this.model.changedAttributes()) {
+        notification = FauxtonAPI.addNotification({
+          msg: "Document saved successfully.",
+          type: "success",
+          clear: true
+        });
+        this.editor.setValue(this.model.prettyJSON());
+      }
     },
 
     establish: function() {


Mime
View raw message