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 3CC5810CAB for ; Wed, 19 Feb 2014 14:48:50 +0000 (UTC) Received: (qmail 58312 invoked by uid 500); 19 Feb 2014 14:48:32 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 57955 invoked by uid 500); 19 Feb 2014 14:48:18 -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 57175 invoked by uid 99); 19 Feb 2014 14:47:59 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Feb 2014 14:47:59 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 123648C3665; Wed, 19 Feb 2014 14:47:59 +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: Wed, 19 Feb 2014 14:48:12 -0000 Message-Id: <65b0a82489a84532853c61499566f51d@git.apache.org> In-Reply-To: <6354124b41c84659ba76c4e42d7059cc@git.apache.org> References: <6354124b41c84659ba76c4e42d7059cc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [15/23] couchdb commit: updated refs/heads/paginate-api-options to 0fca3e9 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/ffccb7fa Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ffccb7fa Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ffccb7fa Branch: refs/heads/paginate-api-options Commit: ffccb7fa0510b4f9ab8af0cdc0e01b6bf041da03 Parents: 152e137 Author: Garren Smith Authored: Mon Feb 3 12:10:08 2014 +0200 Committer: Garren Smith Committed: Wed Feb 19 15:24:55 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/ffccb7fa/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/ffccb7fa/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/ffccb7fa/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/ffccb7fa/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/ffccb7fa/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 1b2a337..0916a45 100644 --- a/src/fauxton/app/addons/documents/templates/view_editor.html +++ b/src/fauxton/app/addons/documents/templates/view_editor.html @@ -17,8 +17,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/ffccb7fa/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 265ffe2..eb99139 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, @@ -1698,27 +1699,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); }