summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGarren Smith <garren.smith@gmail.com>2014-01-09 16:03:25 +0200
committerGarren Smith <garren.smith@gmail.com>2014-01-09 16:03:25 +0200
commitb9a87c875ef0eef2f920781805d26b0dd14e7871 (patch)
tree22308a06f145333579eab4a81c7e81cde3ea060d
parentc8944911766816638682996eb6fd9efe890f3486 (diff)
downloadcouchdb-b9a87c875ef0eef2f920781805d26b0dd14e7871.tar.gz
Fauxton: Update paginate to work with new backbone
-rw-r--r--src/fauxton/app/modules/documents/routes.js11
-rw-r--r--src/fauxton/app/modules/documents/views.js57
-rw-r--r--src/fauxton/app/modules/fauxton/base.js1
3 files changed, 13 insertions, 56 deletions
diff --git a/src/fauxton/app/modules/documents/routes.js b/src/fauxton/app/modules/documents/routes.js
index dbad6d067..435ed5ed9 100644
--- a/src/fauxton/app/modules/documents/routes.js
+++ b/src/fauxton/app/modules/documents/routes.js
@@ -297,10 +297,14 @@ function(app, FauxtonAPI, Documents, Databases) {
docOptions = app.getParams(),
ddoc = event.ddoc;
+ this.documentsView && this.documentsView.remove();
+
if (event.allDocs) {
- this.documentsView.collection = this.data.database.buildAllDocs(docOptions);
- this.documentsView.cleanup();
- return this.documentsView.forceRender();
+ this.data.database.buildAllDocs(docOptions);
+ this.documentsView = this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
+ collection: this.data.database.allDocs
+ }));
+ return;
}
this.data.indexedDocs = new Documents.IndexCollection(null, {
@@ -310,7 +314,6 @@ function(app, FauxtonAPI, Documents, Databases) {
params: app.getParams()
});
- this.documentsView && this.documentsView.remove();
this.documentsView = this.setView("#dashboard-lower-content", new Documents.Views.AllDocsList({
database: this.data.database,
collection: this.data.indexedDocs,
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js
index 1642f1f62..05c86f834 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -31,56 +31,6 @@ define([
function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColumns) {
var Views = {};
- // Views.Tabs = FauxtonAPI.View.extend({
- // template: "templates/documents/tabs",
- // initialize: function(options){
- // this.collection = options.collection;
- // this.database = options.database;
- // this.active_id = options.active_id;
- // },
-
- // events: {
- // "click #delete-database": "delete_database"
- // },
-
- // serialize: function () {
- // return {
- // // TODO make this not hard coded here
- // changes_url: '#' + this.database.url('changes'),
- // db_url: '#' + this.database.url('index') + '?limit=' + Databases.DocLimit,
- // };
- // },
-
- // beforeRender: function(manage) {
- // this.insertView("#search", new Views.SearchBox({
- // collection: this.collection,
- // database: this.database.id
- // }));
- // },
-
- // afterRender: function () {
- // if (this.active_id) {
- // this.$('.active').removeClass('active');
- // this.$('#'+this.active_id).addClass('active');
- // }
- // },
-
- // delete_database: function (event) {
- // event.preventDefault();
-
- // var result = confirm("Are you sure you want to delete this database?");
-
- // if (!result) { return; }
- // FauxtonAPI.addNotification({
- // msg: "Deleting your database...",
- // type: "error"
- // });
- // return this.database.destroy().done(function () {
- // app.router.navigate('#/_all_dbs', {trigger: true});
- // });
- // }
- // });
-
Views.SearchBox = FauxtonAPI.View.extend({
template: "templates/documents/search",
tagName: "form",
@@ -714,7 +664,9 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
},
cleanup: function () {
+ //if (!this.pagination) { return; }
this.pagination.remove();
+ //this.pagination = null;
this.allDocsNumber.remove();
_.each(this.rows, function (row) {row.remove();});
},
@@ -722,7 +674,10 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, resizeColum
beforeRender: function() {
var showNumbers = true;
- this.addPagination();
+ if (!this.pagination) {
+ this.addPagination();
+ }
+
this.insertView('#documents-pagination', this.pagination);
if (this.designDocs || this.collection.idxType === '_view' || this.collection.params.startkey === '"_design"') {
diff --git a/src/fauxton/app/modules/fauxton/base.js b/src/fauxton/app/modules/fauxton/base.js
index 01c29287d..cf6305c30 100644
--- a/src/fauxton/app/modules/fauxton/base.js
+++ b/src/fauxton/app/modules/fauxton/base.js
@@ -20,7 +20,6 @@ define([
function(app, Backbone, resizeColumns) {
-
//resizeAnimation
app.resizeColumns = new resizeColumns({});
app.resizeColumns.onResizeHandler();