Fauxton: Update paginate to work with new backbone

Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/b9a87c87
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/b9a87c87
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/b9a87c87

Branch: refs/heads/api-options
Commit: b9a87c875ef0eef2f920781805d26b0dd14e7871
Parents: c894491
Author: Garren Smith <[email protected]>
Authored: Thu Jan 9 16:03:25 2014 +0200
Committer: Garren Smith <[email protected]>
Committed: Thu Jan 9 16:03:25 2014 +0200

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/routes.js | 11 +++--
 src/fauxton/app/modules/documents/views.js  | 57 +++---------------------
 src/fauxton/app/modules/fauxton/base.js     |  1 -
 3 files changed, 13 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/b9a87c87/src/fauxton/app/modules/documents/routes.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/routes.js 
b/src/fauxton/app/modules/documents/routes.js
index dbad6d0..435ed5e 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,

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b9a87c87/src/fauxton/app/modules/documents/views.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/modules/documents/views.js 
b/src/fauxton/app/modules/documents/views.js
index 1642f1f..05c86f8 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"') {

http://git-wip-us.apache.org/repos/asf/couchdb/blob/b9a87c87/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 01c2928..cf6305c 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();

Reply via email to