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 D72CB11965 for ; Thu, 20 Feb 2014 16:04:39 +0000 (UTC) Received: (qmail 12580 invoked by uid 500); 20 Feb 2014 16:04:21 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 12390 invoked by uid 500); 20 Feb 2014 16:04:19 -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 12268 invoked by uid 99); 20 Feb 2014 16:04:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Feb 2014 16:04:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 8B4869297F1; Thu, 20 Feb 2014 16:04:15 +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: Thu, 20 Feb 2014 16:04:17 -0000 Message-Id: In-Reply-To: <3128edb18540439d9480959c7f6ce4c8@git.apache.org> References: <3128edb18540439d9480959c7f6ce4c8@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [03/14] couchdb commit: updated refs/heads/paginate-api-options to 75c7077 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/50ec7e19 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/50ec7e19 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/50ec7e19 Branch: refs/heads/paginate-api-options Commit: 50ec7e19766e3d4460c142ad8fab90782a6faa3f Parents: f802130 Author: Garren Smith Authored: Mon Feb 3 12:10:08 2014 +0200 Committer: Garren Smith Committed: Thu Feb 20 08:54:32 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/50ec7e19/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/50ec7e19/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 f4700d4..f9500b2 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/50ec7e19/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. --> -
http://git-wip-us.apache.org/repos/asf/couchdb/blob/50ec7e19/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. Create your first document. <% } else { %> Showing <%=pageStart%> - <%= pageEnd %> http://git-wip-us.apache.org/repos/asf/couchdb/blob/50ec7e19/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. <% if (newView) { %>Create Index <% } else { %>Edit Index <% } %> <% if (!newView) { %> -
  • - Query Options
  • Design Doc Metadata
  • <% } %> http://git-wip-us.apache.org/repos/asf/couchdb/blob/50ec7e19/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); }