You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ga...@apache.org on 2013/08/13 16:20:22 UTC
git commit: updated refs/heads/master to ffe8150
Updated Branches:
refs/heads/master 4d1dd2d55 -> ffe8150c7
Fauxton: add delete database functionality
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/ffe8150c
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/ffe8150c
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/ffe8150c
Branch: refs/heads/master
Commit: ffe8150c7b90cfd2a0c31956e5621f2ffed81273
Parents: 4d1dd2d
Author: Garren Smith <ga...@gmail.com>
Authored: Tue Aug 13 16:20:04 2013 +0200
Committer: Garren Smith <ga...@gmail.com>
Committed: Tue Aug 13 16:20:04 2013 +0200
----------------------------------------------------------------------
src/fauxton/app/modules/documents/views.js | 24 +++++++++++++++++++-
.../app/templates/documents/sidebar.html | 5 +++-
.../app/templates/documents/view_editor.html | 2 +-
3 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/ffe8150c/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 6aa4e11..5f61f95 100644
--- a/src/fauxton/app/modules/documents/views.js
+++ b/src/fauxton/app/modules/documents/views.js
@@ -1297,7 +1297,8 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) {
Views.Sidebar = FauxtonAPI.View.extend({
template: "templates/documents/sidebar",
events: {
- "click a.new#index": "newIndex"
+ "click a.new#index": "newIndex",
+ "click button#delete-database": "deleteDatabase"
},
initialize: function(options) {
@@ -1308,6 +1309,27 @@ function(app, FauxtonAPI, Documents, pouchdb, Codemirror, JSHint) {
}
},
+ deleteDatabase: function (event) {
+ event.preventDefault();
+
+ var result = confirm('Are you sure you want to delete this database?');
+
+ if (!result) { return; }
+ var databaseName = this.database.id;
+
+ this.database.destroy().then(function () {
+ FauxtonAPI.navigate('/');
+ FauxtonAPI.addNotification({
+ msg: 'The database ' + databaseName + ' has been deleted.'
+ });
+ }).fail(function (rsp, error, msg) {
+ FauxtonAPI.addNotification({
+ msg: 'Could not delete the database, reason ' + msg + '.',
+ type: 'error'
+ });
+ });
+ },
+
serialize: function() {
return {
changes_url: '#' + this.database.url('changes'),
http://git-wip-us.apache.org/repos/asf/couchdb/blob/ffe8150c/src/fauxton/app/templates/documents/sidebar.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/sidebar.html b/src/fauxton/app/templates/documents/sidebar.html
index d691b9a..7d283d5 100644
--- a/src/fauxton/app/templates/documents/sidebar.html
+++ b/src/fauxton/app/templates/documents/sidebar.html
@@ -32,7 +32,7 @@ the License.
</div>
</div>
- <div class="span5 offset1">
+ <div class="span4 offset1">
<div class="btn-group">
<button class="btn">Add</button>
<button class="btn dropdown-toggle" data-toggle="dropdown">
@@ -49,6 +49,9 @@ the License.
</ul>
</div>
</div>
+ <div class="span1">
+ <button id="delete-database" class="btn"><i class="icon-trash"></i></button>
+ </div>
</header>
<nav>
http://git-wip-us.apache.org/repos/asf/couchdb/blob/ffe8150c/src/fauxton/app/templates/documents/view_editor.html
----------------------------------------------------------------------
diff --git a/src/fauxton/app/templates/documents/view_editor.html b/src/fauxton/app/templates/documents/view_editor.html
index 08b8ad4..70d30df 100644
--- a/src/fauxton/app/templates/documents/view_editor.html
+++ b/src/fauxton/app/templates/documents/view_editor.html
@@ -183,7 +183,7 @@ the License.
</div>
<div class="controls controls-row">
<button type="submit" class="btn btn-primary">Query</button>
- <button class="btn btn-small btn-info preview">Preview</button>
+ <button class="btn btn-info preview">Preview</button>
</div>
</form>