You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2014/09/30 18:55:24 UTC
[2/2] fauxton commit: updated refs/heads/master to a9ea5a0
Editor: do not remove id field for docs
COUCHDB-2341
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/41bb798d
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/41bb798d
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/41bb798d
Branch: refs/heads/master
Commit: 41bb798d515f3a3f8f85927bfa61324e7e683420
Parents: 2595b4b
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Tue Sep 30 17:28:47 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Sep 30 18:54:36 2014 +0200
----------------------------------------------------------------------
app/addons/documents/resources.js | 4 +---
app/addons/documents/tests/resourcesSpec.js | 16 ++++++++++++++++
app/addons/documents/views-doceditor.js | 8 +++-----
3 files changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/41bb798d/app/addons/documents/resources.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/resources.js b/app/addons/documents/resources.js
index 250e302..7970acb 100644
--- a/app/addons/documents/resources.js
+++ b/app/addons/documents/resources.js
@@ -193,8 +193,6 @@ function(app, FauxtonAPI, PagingCollection) {
if (typeof(this.id) === "undefined") {
resp._id = resp.id;
}
-
- delete resp.id;
}
if (resp.ok) {
@@ -514,7 +512,7 @@ function(app, FauxtonAPI, PagingCollection) {
urlRef: function(context, params) {
var query = "";
-
+
if (params) {
if (!_.isEmpty(params)) {
query = "?" + $.param(params);
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/41bb798d/app/addons/documents/tests/resourcesSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/resourcesSpec.js b/app/addons/documents/tests/resourcesSpec.js
index 1159360..7ac8939 100644
--- a/app/addons/documents/tests/resourcesSpec.js
+++ b/app/addons/documents/tests/resourcesSpec.js
@@ -34,6 +34,22 @@ define([
});
+ describe('Document', function () {
+ var doc;
+ beforeEach(function () {
+ doc = new Models.Doc({}, {});
+ });
+
+ it('does not remove an id attribute', function () {
+ var res = doc.parse({
+ _id: "be31e531fe131bdf416b479ac1000484",
+ _rev: "4-3a1b9f4b988b413e9245cd250769da72",
+ id: "foo"
+ });
+ assert.equal(res.id, 'foo');
+ });
+ });
+
describe('AllDocs', function () {
var collection;
beforeEach(function () {
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/41bb798d/app/addons/documents/views-doceditor.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/views-doceditor.js b/app/addons/documents/views-doceditor.js
index d1cc85c..3633edc 100644
--- a/app/addons/documents/views-doceditor.js
+++ b/app/addons/documents/views-doceditor.js
@@ -377,13 +377,11 @@ function(app, FauxtonAPI, Components, Documents, Databases, resizeColumns, prett
saveDoc: function(event) {
var json,
- that = this,
- editor = this.editor,
- validDoc = this.getDocFromEditor();
+ that = this,
+ editor = this.editor,
+ validDoc = this.getDocFromEditor();
if (validDoc) {
- this.getDocFromEditor();
-
FauxtonAPI.addNotification({msg: "Saving document."});
this.model.save().then(function () {