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/02/03 11:12:45 UTC
[21/22] couchdb commit: updated refs/heads/paginate-api-options to
5d2a6f9
More working
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/5c7b3127
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/5c7b3127
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/5c7b3127
Branch: refs/heads/paginate-api-options
Commit: 5c7b3127980225d1935541687b384a3d6caf8558
Parents: d6f6d22
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Jan 29 17:44:49 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Mon Feb 3 10:27:38 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/5c7b3127/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 1824da0..f3e5043 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/5c7b3127/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 d5ba7a6..7e884ae 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;
}
});