Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9AE31106B0 for ; Mon, 3 Mar 2014 16:59:07 +0000 (UTC) Received: (qmail 40654 invoked by uid 500); 3 Mar 2014 16:58:21 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 40356 invoked by uid 500); 3 Mar 2014 16:58:17 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 40261 invoked by uid 99); 3 Mar 2014 16:58:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 03 Mar 2014 16:58:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 676A9933CEF; Mon, 3 Mar 2014 16:58:14 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: garren@apache.org To: commits@couchdb.apache.org Date: Mon, 03 Mar 2014 16:58:39 -0000 Message-Id: <5be09101a763402db659440b7fccda2a@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [27/34] couchdb commit: updated refs/heads/paginate-api-options to b63c791 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 Authored: Thu Feb 20 11:15:16 2014 +0200 Committer: Garren Smith 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; } };