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 5C6831093D for ; Tue, 11 Feb 2014 15:26:09 +0000 (UTC) Received: (qmail 69340 invoked by uid 500); 11 Feb 2014 15:25:52 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 69239 invoked by uid 500); 11 Feb 2014 15:25:49 -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 68444 invoked by uid 99); 11 Feb 2014 15:25:29 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Feb 2014 15:25:29 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id ADCD9923D10; Tue, 11 Feb 2014 15:25:28 +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: Tue, 11 Feb 2014 15:25:46 -0000 Message-Id: <0e3e9e49ae66401fb106f016bb7c6cec@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [19/22] couchdb commit: updated refs/heads/paginate-api-options to 33118af More working Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/144144b7 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/144144b7 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/144144b7 Branch: refs/heads/paginate-api-options Commit: 144144b74fd63876809d968f124e3b2f2da68a25 Parents: 058fc3b Author: Garren Smith Authored: Wed Jan 29 17:44:49 2014 +0200 Committer: Garren Smith Committed: Tue Feb 11 10:14:25 2014 +0200 ---------------------------------------------------------------------- src/fauxton/app/addons/documents/resources.js | 2 ++ src/fauxton/app/addons/fauxton/components.js | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/144144b7/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 15d4d30..72cdb66 100644 --- a/src/fauxton/app/addons/documents/resources.js +++ b/src/fauxton/app/addons/documents/resources.js @@ -284,6 +284,8 @@ function(app, FauxtonAPI) { this.totalRowsToPaginate = 100; this.on("remove",this.decrementTotalRows , this); this.perPageLimit = options.perPageLimit || 20; + + this.params.limit = this.perPageLimit; }, url: function(context) { http://git-wip-us.apache.org/repos/asf/couchdb/blob/144144b7/src/fauxton/app/addons/fauxton/components.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/addons/fauxton/components.js b/src/fauxton/app/addons/fauxton/components.js index ec10132..fd45aa2 100644 --- a/src/fauxton/app/addons/fauxton/components.js +++ b/src/fauxton/app/addons/fauxton/components.js @@ -89,7 +89,6 @@ function(app, FauxtonAPI, ace, spin) { return false; } - console.log(this.pageStart() + this.perPage, this.docLimit); if ((this.pageStart() + this.perPage) >= this.docLimit) { return false; } @@ -119,9 +118,16 @@ function(app, FauxtonAPI, ace, spin) { this.pageNumber = this.pageNumber + 1; this.incPageStart(); + var documentsLeftToFetch = this.docLimit - (this.pageNumber * this.perPage), + limit = this.perPage; + + if (documentsLeftToFetch < this.perPage) { + limit = documentsLeftToFetch; + } + FauxtonAPI.triggerRouteEvent('paginate', { direction: 'next', - perPage: this.perPage + perPage: limit }); }, @@ -163,6 +169,7 @@ function(app, FauxtonAPI, ace, spin) { return this.page() + this.collection.length; } + return this.page() + this.perPage; } });