2013-03-06 20:30:53 +00:00
|
|
|
'use strict';
|
2013-06-22 00:48:23 +00:00
|
|
|
define(
|
|
|
|
[
|
|
|
|
'app',
|
2013-06-24 23:41:59 +00:00
|
|
|
'marionette'
|
|
|
|
], function (App, Marionette) {
|
2013-02-14 18:01:30 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
return Marionette.ItemView.extend({
|
2013-06-22 00:48:23 +00:00
|
|
|
template: 'Series/Delete/DeleteSeriesTemplate',
|
2013-02-14 18:01:30 +00:00
|
|
|
|
2013-06-22 00:48:23 +00:00
|
|
|
events: {
|
|
|
|
'click .x-confirm-delete': 'removeSeries'
|
|
|
|
},
|
2013-02-14 18:01:30 +00:00
|
|
|
|
2013-06-22 00:48:23 +00:00
|
|
|
ui: {
|
|
|
|
deleteFiles: '.x-delete-files'
|
|
|
|
},
|
2013-02-14 18:01:30 +00:00
|
|
|
|
2013-06-22 00:48:23 +00:00
|
|
|
removeSeries: function () {
|
2013-07-18 15:21:21 +00:00
|
|
|
var self = this;
|
2013-06-22 00:48:23 +00:00
|
|
|
var deleteFiles = this.ui.deleteFiles.prop('checked');
|
2013-02-15 02:40:29 +00:00
|
|
|
|
2013-06-22 00:48:23 +00:00
|
|
|
this.model.destroy({
|
|
|
|
data: { 'deleteFiles': deleteFiles },
|
|
|
|
wait: true
|
|
|
|
}).done(function () {
|
2013-07-18 15:21:21 +00:00
|
|
|
App.vent.trigger(App.Events.SeriesDeleted, { series: self.model });
|
2013-07-24 01:15:58 +00:00
|
|
|
App.vent.trigger(App.Commands.CloseModalCommand);
|
2013-06-22 00:48:23 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
2013-02-14 18:01:30 +00:00
|
|
|
});
|