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/19 15:48:14 UTC
[17/23] couchdb commit: updated refs/heads/paginate-api-options to
0fca3e9
More working
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/152e1371
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/152e1371
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/152e1371
Branch: refs/heads/paginate-api-options
Commit: 152e137166ef4eeadde4929d6d89d583fda6bcd0
Parents: c973e40
Author: Garren Smith <ga...@gmail.com>
Authored: Wed Jan 29 17:44:49 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Feb 19 15:24:55 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/152e1371/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/152e1371/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;
}
});