Lidarr/src/UI/Episode/History/EpisodeHistoryActionsCell.js

35 lines
835 B
JavaScript
Raw Normal View History

2015-02-03 01:18:45 +00:00
var $ = require('jquery');
2015-02-07 18:30:02 +00:00
var vent = require('vent');
2015-02-03 01:18:45 +00:00
var Marionette = require('marionette');
var NzbDroneCell = require('../../Cells/NzbDroneCell');
module.exports = NzbDroneCell.extend({
2015-02-13 21:05:08 +00:00
className : 'episode-actions-cell',
events : {
'click .x-failed' : '_markAsFailed'
},
render : function() {
2015-02-03 01:18:45 +00:00
this.$el.empty();
2015-02-13 21:05:08 +00:00
if (this.model.get('eventType') === 'grabbed') {
2017-05-03 15:03:43 +00:00
this.$el.html('<i class="icon-lidarr-delete x-failed" title="Mark download as failed"></i>');
2015-02-03 01:18:45 +00:00
}
2015-02-13 21:05:08 +00:00
2015-02-03 01:18:45 +00:00
return this;
},
2015-02-13 21:05:08 +00:00
_markAsFailed : function() {
2015-02-03 01:18:45 +00:00
var url = window.NzbDrone.ApiRoot + '/history/failed';
2015-02-13 21:05:08 +00:00
var data = {
id : this.model.get('id')
};
2015-02-03 01:18:45 +00:00
$.ajax({
url : url,
type : 'POST',
data : data
});
2015-02-03 01:18:45 +00:00
}
});