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 63E6AFB04 for ; Fri, 5 Apr 2013 00:15:32 +0000 (UTC) Received: (qmail 72103 invoked by uid 500); 5 Apr 2013 00:15:32 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 71968 invoked by uid 500); 5 Apr 2013 00:15:32 -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 71825 invoked by uid 99); 5 Apr 2013 00:15:32 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Apr 2013 00:15:32 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id A92FC1E1BE; Fri, 5 Apr 2013 00:15:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: chewbranca@apache.org To: commits@couchdb.apache.org Date: Fri, 05 Apr 2013 00:15:31 -0000 Message-Id: <58923e38a0114345bc592a7ddbd4bb2e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/4] git commit: updated refs/heads/master to 200eccd Updated Branches: refs/heads/master f726bc4de -> 200eccd2a Generalized pagination Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/200eccd2 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/200eccd2 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/200eccd2 Branch: refs/heads/master Commit: 200eccd2a612c51088957152b93a494a548f0eeb Parents: a609593 Author: Russell Branca Authored: Thu Apr 4 17:15:12 2013 -0700 Committer: Russell Branca Committed: Thu Apr 4 17:15:26 2013 -0700 ---------------------------------------------------------------------- src/fauxton/app/modules/databases/views.js | 18 ++++++++---- src/fauxton/app/modules/fauxton/base.js | 22 ++++++++++++++++ src/fauxton/app/templates/databases/list.html | 18 +------------ src/fauxton/app/templates/fauxton/pagination.html | 17 ++++++++++++ 4 files changed, 52 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/200eccd2/src/fauxton/app/modules/databases/views.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/modules/databases/views.js b/src/fauxton/app/modules/databases/views.js index afaee07..26e902e 100644 --- a/src/fauxton/app/modules/databases/views.js +++ b/src/fauxton/app/modules/databases/views.js @@ -13,10 +13,11 @@ define([ "app", + "modules/fauxton/base", "api" ], -function(app, FauxtonAPI) { +function(app, Fauxton, FauxtonAPI) { var Views = {}; Views.Item = FauxtonAPI.View.extend({ @@ -47,11 +48,7 @@ function(app, FauxtonAPI) { serialize: function() { return { - databases: this.collection, - page: this.page, - perPage: this.perPage, - totalDbs: this.collection.length, - totalPages: Math.ceil(this.collection.length / this.perPage) + databases: this.collection }; }, @@ -80,6 +77,15 @@ function(app, FauxtonAPI) { model: database })); }, this); + + this.insertView("#database-pagination", new Fauxton.Pagination({ + page: this.page, + perPage: this.perPage, + total: this.collection.length, + urlFun: function(page) { + return "#/_all_dbs?page=" + page; + } + })); }, afterRender: function() { http://git-wip-us.apache.org/repos/asf/couchdb/blob/200eccd2/src/fauxton/app/modules/fauxton/base.js ---------------------------------------------------------------------- diff --git a/src/fauxton/app/modules/fauxton/base.js b/src/fauxton/app/modules/fauxton/base.js index 0297dac..2526f80 100644 --- a/src/fauxton/app/modules/fauxton/base.js +++ b/src/fauxton/app/modules/fauxton/base.js @@ -129,5 +129,27 @@ function(app, Backbone) { } }); + Fauxton.Pagination = Backbone.View.extend({ + template: "templates/fauxton/pagination", + + initialize: function(options) { + this.page = options.page; + this.perPage = options.perPage; + this.total = options.total; + this.totalPages = Math.ceil(this.total / this.perPage); + this.urlFun = options.urlFun; + }, + + serialize: function() { + return { + page: this.page, + perPage: this.perPage, + total: this.total, + totalPages: this.totalPages, + urlFun: this.urlFun + }; + } + }); + return Fauxton; }); http://git-wip-us.apache.org/repos/asf/couchdb/blob/200eccd2/src/fauxton/app/templates/databases/list.html ---------------------------------------------------------------------- diff --git a/src/fauxton/app/templates/databases/list.html b/src/fauxton/app/templates/databases/list.html index a2e70f1..808c950 100644 --- a/src/fauxton/app/templates/databases/list.html +++ b/src/fauxton/app/templates/databases/list.html @@ -27,20 +27,4 @@ the License. - +
http://git-wip-us.apache.org/repos/asf/couchdb/blob/200eccd2/src/fauxton/app/templates/fauxton/pagination.html ---------------------------------------------------------------------- diff --git a/src/fauxton/app/templates/fauxton/pagination.html b/src/fauxton/app/templates/fauxton/pagination.html new file mode 100644 index 0000000..161593b --- /dev/null +++ b/src/fauxton/app/templates/fauxton/pagination.html @@ -0,0 +1,17 @@ +