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/03/03 17:58:32 UTC
[20/34] couchdb commit: updated refs/heads/paginate-api-options to
b63c791
Set view limit on pagination
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/55b6ea67
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/55b6ea67
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/55b6ea67
Branch: refs/heads/paginate-api-options
Commit: 55b6ea67ac7e3b0180b216007c2018cd140e5703
Parents: fa33d4d
Author: Garren Smith <ga...@gmail.com>
Authored: Mon Feb 3 12:10:08 2014 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Mon Mar 3 11:18:41 2014 +0200
----------------------------------------------------------------------
src/fauxton/app/addons/documents/resources.js | 4 ++-
src/fauxton/app/addons/documents/routes.js | 5 ++-
.../documents/templates/all_docs_layout.html | 4 ---
.../documents/templates/all_docs_number.html | 2 +-
.../addons/documents/templates/view_editor.html | 2 --
src/fauxton/app/addons/documents/views.js | 36 +++++++++++---------
6 files changed, 26 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/55b6ea67/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 72cdb66..4028cb1 100644
--- a/src/fauxton/app/addons/documents/resources.js
+++ b/src/fauxton/app/addons/documents/resources.js
@@ -285,7 +285,9 @@ function(app, FauxtonAPI) {
this.on("remove",this.decrementTotalRows , this);
this.perPageLimit = options.perPageLimit || 20;
- this.params.limit = this.perPageLimit;
+ if (this.params.limit > this.perPageLimit) {
+ this.params.limit = this.perPageLimit;
+ }
},
url: function(context) {
http://git-wip-us.apache.org/repos/asf/couchdb/blob/55b6ea67/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 9ef8837..3ec640f 100644
--- a/src/fauxton/app/addons/documents/routes.js
+++ b/src/fauxton/app/addons/documents/routes.js
@@ -275,9 +275,8 @@ function(app, FauxtonAPI, Documents, Databases) {
newViewEditor: function () {
var params = app.getParams();
- if (this.toolsView) {
- this.toolsView.remove();
- }
+ this.toolsView && this.toolsView.remove();
+ this.documentsView && this.documentsView.remove();
this.viewEditor = this.setView("#dashboard-upper-content", new Documents.Views.ViewEditor({
ddocs: this.data.designDocs,
http://git-wip-us.apache.org/repos/asf/couchdb/blob/55b6ea67/src/fauxton/app/addons/documents/templates/all_docs_layout.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/templates/all_docs_layout.html b/src/fauxton/app/addons/documents/templates/all_docs_layout.html
index b6428c9..1bbe59d 100644
--- a/src/fauxton/app/addons/documents/templates/all_docs_layout.html
+++ b/src/fauxton/app/addons/documents/templates/all_docs_layout.html
@@ -12,10 +12,6 @@ License for the specific language governing permissions and limitations under
the License.
-->
-<ul class="nav nav-tabs window-resizeable" id="db-views-tabs-nav">
- <li><a id="toggle-query" href="#query" data-bypass="true" data-toggle="tab">
- <i class="fonticon fonticon-plus"></i> Query Options</a></li>
-</ul>
<div class="tab-content">
<div id="query-options-wrapper"></div>
<div class="tab-pane" id="query">
http://git-wip-us.apache.org/repos/asf/couchdb/blob/55b6ea67/src/fauxton/app/addons/documents/templates/all_docs_number.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/templates/all_docs_number.html b/src/fauxton/app/addons/documents/templates/all_docs_number.html
index 4c9130b..fb9ea11 100644
--- a/src/fauxton/app/addons/documents/templates/all_docs_number.html
+++ b/src/fauxton/app/addons/documents/templates/all_docs_number.html
@@ -11,7 +11,7 @@ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
-->
-<% if (totalRows === "unknown"){ %>
+<% if (totalRows === "unknown" || totalRows === 0){ %>
Showing 0 documents. <a href="#/database/<%=database%>/new"> Create your first document.</a>
<% } else { %>
Showing <%=pageStart%> - <%= pageEnd %>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/55b6ea67/src/fauxton/app/addons/documents/templates/view_editor.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/documents/templates/view_editor.html b/src/fauxton/app/addons/documents/templates/view_editor.html
index b1364df..36451e8 100644
--- a/src/fauxton/app/addons/documents/templates/view_editor.html
+++ b/src/fauxton/app/addons/documents/templates/view_editor.html
@@ -16,8 +16,6 @@ the License.
<i class="fonticon-wrench fonticon"></i>
<% if (newView) { %>Create Index <% } else { %>Edit Index <% } %></a></li>
<% if (!newView) { %>
- <li><a data-bypass="true" id="query-nav" href="#query" data-toggle="tab">
- <i class="fonticon-plus fonticon"></i> Query Options</a></li>
<li><a data-bypass="true" id="meta-nav" href="#metadata" data-toggle="tab">Design Doc Metadata</a></li>
<% } %>
</ul>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/55b6ea67/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 a33bd47..674b21b 100644
--- a/src/fauxton/app/addons/documents/views.js
+++ b/src/fauxton/app/addons/documents/views.js
@@ -446,7 +446,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
pageEnd = 20;
if (!this.newView) {
- totalRows = this.collection.totalRows();
+ totalRows = this.collection.length;
updateSeq = this.collection.updateSeq();
}
@@ -456,6 +456,7 @@ 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,
@@ -1697,27 +1698,30 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
database: this.database
}));
- this.eventer = _.extend({}, Backbone.Events);
- this.advancedOptions = this.insertView('#query', new Views.AdvancedOptions({
- updateViewFn: this.updateView,
- previewFn: this.previewView,
- database: this.database,
- viewName: this.viewName,
- ddocName: this.model.id,
- hasReduce: this.hasReduce(),
- eventer: this.eventer
- }));
+ if (!this.newView) {
+ this.eventer = _.extend({}, Backbone.Events);
+
+ this.advancedOptions = this.insertView('#query', new Views.AdvancedOptions({
+ updateViewFn: this.updateView,
+ previewFn: this.previewView,
+ database: this.database,
+ viewName: this.viewName,
+ ddocName: this.model.id,
+ hasReduce: this.hasReduce(),
+ eventer: this.eventer
+ }));
- this.advancedOptionsMenu = this.insertView('#query-options-wrapper', new Views.AdvancedOptionsMenu({
- hasReduce: this.hasReduce(),
- eventer: this.eventer
- }));
+ this.advancedOptionsMenu = this.insertView('#query-options-wrapper', new Views.AdvancedOptionsMenu({
+ hasReduce: this.hasReduce(),
+ eventer: this.eventer
+ }));
+ }
},
afterRender: function() {
- if (this.params) {
+ if (this.params && !this.newView) {
this.advancedOptions.updateFromParams(this.params);
this.advancedOptionsMenu.updateFromParams(this.params);
}