diff --git a/public/js/app/views/missions/list_item.js b/public/js/app/views/missions/list_item.js
index 324ed0a..b3f1792 100644
--- a/public/js/app/views/missions/list_item.js
+++ b/public/js/app/views/missions/list_item.js
@@ -1,17 +1,34 @@
define(function (require) {
-
+
"use strict";
-
+
var $ = require('jquery'),
_ = require('underscore'),
Backbone = require('backbone'),
Marionette = require('marionette'),
tpl = require('text!tpl/missions/list_item.html'),
-
+
template = _.template(tpl);
-
+
return Marionette.ItemView.extend({
tagName: "tr",
- template: template
+ template: template,
+
+ events: {
+ "click .delete": "delete"
+ },
+
+ delete: function (event) {
+ var self = this;
+ event.preventDefault();
+ $.ajax({
+ url: "/api/missions/" + this.model.get('name'),
+ type: 'DELETE',
+ success: function (resp) {
+ self.model.destroy();
+ },
+ error: $.noop
+ });
+ },
});
});
diff --git a/public/js/tpl/missions/list.html b/public/js/tpl/missions/list.html
index b1c5ad4..25a7b8b 100644
--- a/public/js/tpl/missions/list.html
+++ b/public/js/tpl/missions/list.html
@@ -2,9 +2,10 @@
-
+
Mission
+