1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 10:32:35 +01:00

Episode files are refreshed after season is renamed

This commit is contained in:
Mark McDowall 2013-09-02 22:02:47 -07:00
parent e4d7ea9fd8
commit 95b21358c4
4 changed files with 19 additions and 70 deletions

View File

@ -1,67 +0,0 @@
'use strict';
define(
[
'app',
'marionette',
'backgrid',
'Cells/FileSizeCell',
'Cells/QualityCell',
'Episode/Summary/NoFileView'
], function (App, Marionette, Backgrid, FileSizeCell, QualityCell, NoFileView) {
return Marionette.Layout.extend({
template: 'Episode/Summary/LayoutTemplate',
regions: {
overview: '.episode-overview',
activity: '.episode-file-info'
},
columns:
[
{
name : 'path',
label : 'Path',
cell : 'string',
sortable: false
},
{
name : 'size',
label : 'Size',
cell : FileSizeCell,
sortable: false
},
{
name : 'quality',
label : 'Quality',
cell : QualityCell,
sortable: false,
editable: true
}
],
templateHelpers: {},
initialize: function (options) {
if (!this.model.series) {
this.templateHelpers.series = options.series.toJSON();
}
},
onShow: function () {
if (this.model.get('hasFile')) {
var episodeFile = App.request(App.Reqres.GetEpisodeFileById, this.model.get('episodeFileId'));
this.activity.show(new Backgrid.Grid({
collection: new Backbone.Collection(episodeFile),
columns : this.columns,
className : 'table table-bordered'spinn
}));
}
else {
this.activity.show(new NoFileView());
}
}
});
});

View File

@ -1,6 +1,7 @@
'use strict';
define(
[
'app',
'marionette',
'backgrid',
'Cells/ToggleCell',
@ -9,7 +10,7 @@ define(
'Cells/EpisodeStatusCell',
'Commands/CommandController',
'Shared/Actioneer'
], function ( Marionette, Backgrid, ToggleCell, EpisodeTitleCell, RelativeDateCell, EpisodeStatusCell, CommandController, Actioneer) {
], function (App, Marionette, Backgrid, ToggleCell, EpisodeTitleCell, RelativeDateCell, EpisodeStatusCell, CommandController, Actioneer) {
return Marionette.Layout.extend({
template: 'Series/Details/SeasonLayoutTemplate',
@ -74,6 +75,7 @@ define(
}
this.episodeCollection = options.episodeCollection.bySeason(this.model.get('seasonNumber'));
this.series = options.series;
this.listenTo(this.model, 'sync', function () {
this._afterSeasonMonitored();
@ -149,8 +151,14 @@ define(
seasonNumber: this.model.get('seasonNumber')
},
element : this.ui.seasonRename,
failMessage: 'Season rename failed'
failMessage: 'Season rename failed',
context : this,
onSuccess : this._afterRename
});
},
_afterRename: function () {
App.vent.trigger(App.Events.SeasonRenamed, { series: this.series, seasonNumber: this.model.get('seasonNumber') });
}
});
});

View File

@ -60,6 +60,7 @@ define(
}, this);
this.listenTo(App.vent, App.Events.SeriesDeleted, this._onSeriesDeleted);
this.listenTo(App.vent, App.Events.SeasonRenamed, this._onSeasonRenamed);
},
onShow: function () {
@ -213,6 +214,12 @@ define(
_refetchEpisodeFiles: function () {
this.episodeFileCollection.fetch();
},
_onSeasonRenamed: function(event) {
if (this.model.get('id') === event.series.get('id')) {
this._refetchEpisodeFiles();
}
}
});
});

View File

@ -188,7 +188,8 @@ define(
app.Events = {
SeriesAdded : 'series:added',
SeriesDeleted: 'series:deleted'
SeriesDeleted: 'series:deleted',
SeasonRenamed: 'season:renamed'
};
app.Commands = {