couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gar...@apache.org
Subject [27/34] couchdb commit: updated refs/heads/paginate-api-options to b63c791
Date Mon, 03 Mar 2014 16:58:39 GMT
More improvements


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

Branch: refs/heads/paginate-api-options
Commit: 9848c76d30b17bdfec68edc28b18ee0fc1b786ab
Parents: 0beb91c
Author: Garren Smith <garren.smith@gmail.com>
Authored: Thu Feb 20 11:15:16 2014 +0200
Committer: Garren Smith <garren.smith@gmail.com>
Committed: Mon Mar 3 11:18:42 2014 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/documents/resources.js | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/9848c76d/src/fauxton/app/addons/documents/resources.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/resources.js b/src/fauxton/app/addons/documents/resources.js
index 6f6ed1c..d942cf6 100644
--- a/src/fauxton/app/addons/documents/resources.js
+++ b/src/fauxton/app/addons/documents/resources.js
@@ -26,10 +26,6 @@ function(app, FauxtonAPI) {
           lastId = '',
           isView = !!!_isAllDocs,
           key;
-      
-      _.each(doc, function (value, key) {
-        doc[key] = JSON.stringify(doc[key]);
-      });
 
       if (currentParams.keys) {
         throw "Cannot paginate _all_docs with keys";
@@ -39,9 +35,9 @@ function(app, FauxtonAPI) {
         throw "Require docs to paginate";
       }
 
-      params = _.reduce(['reduce', 'keys', 'endkey', 'descending', 'inclusive_end'], function
(params, p) {
-        if (_.has(currentParams, p)) {
-          params[p] = currentParams[p]; 
+      params = _.reduce(['reduce', 'keys', 'endkey', 'descending', 'inclusive_end'], function
(params, key) {
+        if (_.has(currentParams, key)) {
+          params[key] = currentParams[key]; 
         }
         return params;
       }, params);
@@ -49,7 +45,6 @@ function(app, FauxtonAPI) {
       lastId = doc.id || doc._id;
 
       if (isView) {
-        console.log(doc.key, doc, lastId);
         key = doc.key;
         docId = lastId;
       } else {
@@ -64,6 +59,13 @@ function(app, FauxtonAPI) {
       } else {
         params.startkey_docid = docId; 
       }
+
+      _.each(['startkey', 'endkey', 'key'], function (key) {
+        if (_.has(params, key)) {
+          params[key] = JSON.stringify(params[key]);
+        }
+      });
+
       return params;
     }
  };


Mime
View raw message