Episode files are refreshed after season is renamed
This commit is contained in:
parent
e4d7ea9fd8
commit
95b21358c4
|
@ -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());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
|
@ -1,6 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
define(
|
define(
|
||||||
[
|
[
|
||||||
|
'app',
|
||||||
'marionette',
|
'marionette',
|
||||||
'backgrid',
|
'backgrid',
|
||||||
'Cells/ToggleCell',
|
'Cells/ToggleCell',
|
||||||
|
@ -9,7 +10,7 @@ define(
|
||||||
'Cells/EpisodeStatusCell',
|
'Cells/EpisodeStatusCell',
|
||||||
'Commands/CommandController',
|
'Commands/CommandController',
|
||||||
'Shared/Actioneer'
|
'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({
|
return Marionette.Layout.extend({
|
||||||
template: 'Series/Details/SeasonLayoutTemplate',
|
template: 'Series/Details/SeasonLayoutTemplate',
|
||||||
|
|
||||||
|
@ -74,6 +75,7 @@ define(
|
||||||
}
|
}
|
||||||
|
|
||||||
this.episodeCollection = options.episodeCollection.bySeason(this.model.get('seasonNumber'));
|
this.episodeCollection = options.episodeCollection.bySeason(this.model.get('seasonNumber'));
|
||||||
|
this.series = options.series;
|
||||||
|
|
||||||
this.listenTo(this.model, 'sync', function () {
|
this.listenTo(this.model, 'sync', function () {
|
||||||
this._afterSeasonMonitored();
|
this._afterSeasonMonitored();
|
||||||
|
@ -149,8 +151,14 @@ define(
|
||||||
seasonNumber: this.model.get('seasonNumber')
|
seasonNumber: this.model.get('seasonNumber')
|
||||||
},
|
},
|
||||||
element : this.ui.seasonRename,
|
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') });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,6 +60,7 @@ define(
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.listenTo(App.vent, App.Events.SeriesDeleted, this._onSeriesDeleted);
|
this.listenTo(App.vent, App.Events.SeriesDeleted, this._onSeriesDeleted);
|
||||||
|
this.listenTo(App.vent, App.Events.SeasonRenamed, this._onSeasonRenamed);
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
|
@ -213,6 +214,12 @@ define(
|
||||||
|
|
||||||
_refetchEpisodeFiles: function () {
|
_refetchEpisodeFiles: function () {
|
||||||
this.episodeFileCollection.fetch();
|
this.episodeFileCollection.fetch();
|
||||||
|
},
|
||||||
|
|
||||||
|
_onSeasonRenamed: function(event) {
|
||||||
|
if (this.model.get('id') === event.series.get('id')) {
|
||||||
|
this._refetchEpisodeFiles();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue