1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 01:37:07 +00:00

Redirect to index when on series is deleted from details

This commit is contained in:
Mark McDowall 2013-07-18 08:21:21 -07:00
parent 57c876a420
commit 1bf855ca3a
3 changed files with 13 additions and 2 deletions

View file

@ -17,13 +17,14 @@ define(
},
removeSeries: function () {
var self = this;
var deleteFiles = this.ui.deleteFiles.prop('checked');
this.model.destroy({
data: { 'deleteFiles': deleteFiles },
wait: true
}).done(function () {
App.vent.trigger(App.Events.SeriesDeleted, { series: self.model });
App.modalRegion.closeModal();
});
}

View file

@ -39,6 +39,8 @@ define(
this.model.on('sync', function () {
this._setMonitoredState()
}, this);
this.listenTo(App.vent, App.Events.SeriesDeleted, this._onSeriesDeleted);
},
onShow: function () {
@ -127,6 +129,13 @@ define(
promise.always(function () {
self.ui.refresh.removeClass('icon-spin');
});
},
_onSeriesDeleted: function (event) {
if (this.model.get('id') === event.series.get('id')) {
App.Router.navigate('/', { trigger: true });
}
}
});
});

View file

@ -171,7 +171,8 @@ define(
var app = new Marionette.Application();
app.Events = {
SeriesAdded: 'seriesAdded'
SeriesAdded: 'series:added',
SeriesDeleted: 'series:deleted'
};
app.Commands = {