You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2013/03/15 22:50:09 UTC
[4/50] git commit: delete database
delete database
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/41824106
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/41824106
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/41824106
Branch: refs/heads/fauxton-rebase
Commit: 41824106801fbc39a80541389a2ca1d6f89ec51a
Parents: c8cdfae
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Feb 5 10:01:24 2013 +0200
Committer: Russell Branca <ch...@gmail.com>
Committed: Fri Mar 15 14:35:12 2013 -0700
----------------------------------------------------------------------
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/41824106/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/41824106/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/41824106/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/41824106/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 @@
</a>
<ul class="dropdown-menu">
<li><a class=""><i class="icon-repeat"></i> Replicate database</a></li>
- <li><a class=""><i class="icon-trash"></i> Delete database</a></li>
+ <li><a id="delete-database" class=""><i class="icon-trash"></i> Delete database</a></li>
</ul>
</div>
</li>
</ul>
-</ul>
\ No newline at end of file
+</ul>