diff options
author | suelockwood <deathbear@apache.org> | 2014-01-09 10:49:00 -0500 |
---|---|---|
committer | suelockwood <deathbear@apache.org> | 2014-01-09 10:49:00 -0500 |
commit | f5db0beec2a232bba8a9985f0e4f20d697049066 (patch) | |
tree | 7dd2934ab2a5f924f2437cf519bc9e9f98e6da88 | |
parent | 65c1b9993c0108e09e3b32303dc3b9bf69573ff6 (diff) | |
download | couchdb-f5db0beec2a232bba8a9985f0e4f20d697049066.tar.gz |
Changes View fix
-rw-r--r-- | src/fauxton/app/modules/documents/views.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/fauxton/app/modules/documents/views.js b/src/fauxton/app/modules/documents/views.js index c3f96b702..ec1b5d22a 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", |