mirror of
https://github.com/Dahlgren/arma-server-web-admin.git
synced 2024-08-30 17:22:10 +00:00
Delete missions
This commit is contained in:
parent
0c57678db6
commit
76c05d9c7d
@ -12,6 +12,23 @@ define(function (require) {
|
|||||||
|
|
||||||
return Marionette.ItemView.extend({
|
return Marionette.ItemView.extend({
|
||||||
tagName: "tr",
|
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
|
||||||
|
});
|
||||||
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Mission</th>
|
<th>Mission</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
|
@ -1,3 +1,8 @@
|
|||||||
<td>
|
<td>
|
||||||
<a href='#missions/<%-name%>'><%-name%></a>
|
<a href='#missions/<%-name%>'><%-name%></a>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="btn btn-danger btn-xs delete">
|
||||||
|
<span class="glyphicon glyphicon-remove"></span> Delete
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
@ -33,5 +33,17 @@ exports.show = function(req, res){
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.destroy = function(req, res){
|
exports.destroy = function(req, res){
|
||||||
res.send('destroy mission ' + req.params.mission);
|
var path = config.path + '/mpmissions/' + req.params.mission;
|
||||||
|
|
||||||
|
if (req.params.format) {
|
||||||
|
path += '.' + req.params.format;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.unlink(path, function (err) {
|
||||||
|
if (err) {
|
||||||
|
res.json(500, {success: false});
|
||||||
|
} else {
|
||||||
|
res.json({success: true});
|
||||||
|
}
|
||||||
|
});
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user