delete database Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/827a1b58 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/827a1b58 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/827a1b58 Branch: refs/heads/fauxton Commit: 827a1b58989528fd9c6c30c828df0911d0723cc5 Parents: 6ab9c65 Author: Garren Smith Authored: Tue Feb 5 10:01:24 2013 +0200 Committer: Garren Smith Committed: Tue Feb 5 10:01:24 2013 +0200 ---------------------------------------------------------------------- src/fauxton/TODO.md | 2 +- src/fauxton/app/modules/documents/routes.js | 2 +- src/fauxton/app/modules/documents/views.js | 21 +++++++++++++++++++- src/fauxton/app/templates/documents/tabs.html | 4 +- 4 files changed, 24 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/827a1b58/src/fauxton/TODO.md ---------------------------------------------------------------------- diff --git a/src/fauxton/TODO.md b/src/fauxton/TODO.md index 3c1b85b..bb37113 100644 --- a/src/fauxton/TODO.md +++ b/src/fauxton/TODO.md @@ -19,7 +19,7 @@ In no particular order - [ ] "show me" button in API bar doesn't - [ ] edit index button doesn't - [ ] replicate UI -- [ ] delete database +- [x] delete database - [ ] format dates better (e.g. in logs plugin) - [ ] format log entry better - [ ] filter logs by method http://git-wip-us.apache.org/repos/asf/couchdb/blob/827a1b58/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 efaa374..d851caf 100644 --- a/src/fauxton/app/modules/documents/routes.js +++ b/src/fauxton/app/modules/documents/routes.js @@ -251,7 +251,7 @@ function(app, FauxtonAPI, Documents, Databases) { "#tabs": new Documents.Views.Tabs({ collection: data.designDocs, - database: data.database.id + database: data.database }) }, http://git-wip-us.apache.org/repos/asf/couchdb/blob/827a1b58/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 30a799a..556a5cf 100644 --- a/src/fauxton/app/modules/documents/views.js +++ b/src/fauxton/app/modules/documents/views.js @@ -21,12 +21,31 @@ function(app, FauxtonAPI, Codemirror, JSHint) { this.collection = options.collection; this.database = options.database; }, + + events: { + "click #delete-database": "delete_database" + }, + beforeRender: function(manage) { this.insertView("#search", new Views.SearchBox({ collection: this.collection, - database: this.database + database: this.database.id })); + }, + + delete_database: function (event) { + event.preventDefault(); + + var result = confirm("Are you sure you want to delete this database?"); + + if (!result) { return; } + + var promise = this.database.destroy(); + promise.done(function () { + app.router.navigate('/', {trigger: true}); + }); } + }); Views.SearchBox = FauxtonAPI.View.extend({ http://git-wip-us.apache.org/repos/asf/couchdb/blob/827a1b58/src/fauxton/app/templates/documents/tabs.html ---------------------------------------------------------------------- diff --git a/src/fauxton/app/templates/documents/tabs.html b/src/fauxton/app/templates/documents/tabs.html index 8cca6c3..d0231e0 100644 --- a/src/fauxton/app/templates/documents/tabs.html +++ b/src/fauxton/app/templates/documents/tabs.html @@ -12,9 +12,9 @@ - \ No newline at end of file +