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:13 UTC
[16/23] couchdb commit: updated refs/heads/paginate-api-options to
0fca3e9
fix previous paginate
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/7593aba0
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/7593aba0
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/7593aba0
Branch: refs/heads/paginate-api-options
Commit: 7593aba042670c9fd7770fed9b0fe2af4e47d0a1
Parents: ffccb7f
Author: Garren Smith <ga...@gmail.com>
Authored: Mon Feb 3 15:08:20 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Wed Feb 19 15:24:55 2014 +0200
----------------------------------------------------------------------
src/fauxton/app/addons/documents/resources.js | 7 ++++++-
src/fauxton/app/addons/documents/routes.js | 8 ++++++--
src/fauxton/app/addons/documents/views.js | 1 -
src/fauxton/app/addons/fauxton/components.js | 8 ++++++--
4 files changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/7593aba0/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 4028cb1..c2f9a70 100644
--- a/src/fauxton/app/addons/documents/resources.js
+++ b/src/fauxton/app/addons/documents/resources.js
@@ -281,7 +281,6 @@ function(app, FauxtonAPI) {
this.database = options.database;
this.params = _.clone(options.params);
this.skipFirstItem = false;
- this.totalRowsToPaginate = 100;
this.on("remove",this.decrementTotalRows , this);
this.perPageLimit = options.perPageLimit || 20;
@@ -426,6 +425,12 @@ function(app, FauxtonAPI) {
this.view = options.view;
this.design = options.design.replace('_design/','');
this.skipFirstItem = false;
+ this.perPageLimit = options.perPageLimit || 20;
+
+ if (this.params.limit > this.perPageLimit) {
+ this.params.limit = this.perPageLimit;
+ }
+
},
url: function(context) {
http://git-wip-us.apache.org/repos/asf/couchdb/blob/7593aba0/src/fauxton/app/addons/documents/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/routes.js b/src/fauxton/app/addons/documents/routes.js
index f9500b2..06db528 100644
--- a/src/fauxton/app/addons/documents/routes.js
+++ b/src/fauxton/app/addons/documents/routes.js
@@ -356,8 +356,12 @@ function(app, FauxtonAPI, Documents, Databases) {
this.documentsView.collection.skipFirstItem = true;
this.documentsView.collection.nextPage(options.perPage);
} else {
- this.documentsView.collection.skipFirstItem = false;
- this.documentsView.collection.previousPage(options.perPage);
+ if (options.params && options.params.startkey) {
+ this.documentsView.collection.skipFirstItem = true;
+ } else {
+ this.documentsView.collection.skipFirstItem = false;
+ }
+ this.documentsView.collection.previousPage(options.perPage, options.params);
}
},
http://git-wip-us.apache.org/repos/asf/couchdb/blob/7593aba0/src/fauxton/app/addons/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/views.js b/src/fauxton/app/addons/documents/views.js
index eb99139..d864c64 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -456,7 +456,6 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
pageEnd = this.pagination.pageEnd();
}
- console.log('t', totalRows, this.collection);
return {
database: app.utils.safeURLName(this.collection.database.id),
updateSeq: updateSeq,
http://git-wip-us.apache.org/repos/asf/couchdb/blob/7593aba0/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 fd45aa2..130d3c7 100644
--- a/src/fauxton/app/addons/fauxton/components.js
+++ b/src/fauxton/app/addons/fauxton/components.js
@@ -75,6 +75,7 @@ function(app, FauxtonAPI, ace, spin) {
this._pageStart = 1;
this.perPage = 20;
this.docLimit = options.docLimit || 100;
+ this.paramsHistory = [];
},
canShowPreviousfn: function () {
@@ -106,7 +107,8 @@ function(app, FauxtonAPI, ace, spin) {
FauxtonAPI.triggerRouteEvent('paginate', {
direction: 'previous',
- perPage: this.perPage
+ perPage: this.perPage,
+ params: this.paramsHistory.pop()
});
},
@@ -114,7 +116,8 @@ function(app, FauxtonAPI, ace, spin) {
event.preventDefault();
event.stopPropagation();
if (!this.canShowNextfn()) { return; }
-
+
+ this.paramsHistory.push(_.clone(this.collection.params));
this.pageNumber = this.pageNumber + 1;
this.incPageStart();
@@ -129,6 +132,7 @@ function(app, FauxtonAPI, ace, spin) {
direction: 'next',
perPage: limit
});
+
},
serialize: function () {