Updated Branches:
  refs/heads/master 65c1b9993 -> f5db0beec

Changes View fix


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

Branch: refs/heads/master
Commit: f5db0beec2a232bba8a9985f0e4f20d697049066
Parents: 65c1b99
Author: suelockwood <[email protected]>
Authored: Thu Jan 9 10:49:00 2014 -0500
Committer: suelockwood <[email protected]>
Committed: Thu Jan 9 10:49:00 2014 -0500

----------------------------------------------------------------------
 src/fauxton/app/modules/documents/views.js | 49 +++++++++++++++++++++++++
 1 file changed, 49 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/f5db0bee/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 c3f96b7..ec1b5d2 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -30,6 +30,55 @@ 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",

Reply via email to