Hook up delete dropdown on views
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/f128847e Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/f128847e Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/f128847e Branch: refs/heads/secondary-indexes Commit: f128847e90e785b7bf8e9381c051adf9ac7bb029 Parents: a80d189 Author: deathbearbrown <[email protected]> Authored: Sun Aug 24 16:33:43 2014 +0200 Committer: deathbearbrown <[email protected]> Committed: Mon Aug 25 09:37:35 2014 -0400 ---------------------------------------------------------------------- app/addons/indexes/routes-viewindexes.js | 6 ++++-- app/addons/indexes/views.js | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f128847e/app/addons/indexes/routes-viewindexes.js ---------------------------------------------------------------------- diff --git a/app/addons/indexes/routes-viewindexes.js b/app/addons/indexes/routes-viewindexes.js index 7330d04..f3bb65b 100644 --- a/app/addons/indexes/routes-viewindexes.js +++ b/app/addons/indexes/routes-viewindexes.js @@ -88,9 +88,11 @@ function (app, FauxtonAPI, Databases, Views, Documents, Resources, RouteCore, Co links: [{ title: 'Duplicate Index', icon: 'fonticon-documents' - },{ + }, + { title: 'Delete', - icon: 'fonticon-trash' + icon: 'fonticon-trash', + trigger: 'index:delete' }] }]; http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f128847e/app/addons/indexes/views.js ---------------------------------------------------------------------- diff --git a/app/addons/indexes/views.js b/app/addons/indexes/views.js index 6340251..fa84708 100644 --- a/app/addons/indexes/views.js +++ b/app/addons/indexes/views.js @@ -309,6 +309,8 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, this.showIndex = false; _.bindAll(this); + + FauxtonAPI.Events.on('index:delete', this.deleteView); }, establish: function () { @@ -342,7 +344,7 @@ function(app, FauxtonAPI, Components, Documents, Databases, pouchdb, }, deleteView: function (event) { - event.preventDefault(); + event && event.preventDefault(); if (this.newView) { return alert('Cannot delete a new view.'); } if (!confirm('Are you sure you want to delete this view?')) {return;}
