When refreshing movie, refresh Files tab

This commit is contained in:
Tim Turner 2017-02-13 20:08:07 -05:00
parent 1e28a2e5d4
commit 81688399c0
2 changed files with 24 additions and 16 deletions

View File

@ -74,6 +74,10 @@ module.exports = Marionette.Layout.extend({
this.listenTo(this.model, 'change:images', this._updateImages); this.listenTo(this.model, 'change:images', this._updateImages);
}, },
_refreshFiles : function() {
this._showFiles();
},
onShow : function() { onShow : function() {
this.searchLayout = new SearchLayout({ model : this.model }); this.searchLayout = new SearchLayout({ model : this.model });
this.searchLayout.startManualSearch = true; this.searchLayout.startManualSearch = true;
@ -159,7 +163,7 @@ module.exports = Marionette.Layout.extend({
_showFiles : function(e) { _showFiles : function(e) {
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
this.ui.files.tab('show'); this.ui.files.tab('show');

View File

@ -82,19 +82,23 @@ module.exports = Marionette.Layout.extend({
this.filesCollection.add(file); this.filesCollection.add(file);
//this.listenTo(this.releaseCollection, 'sync', this._showSearchResults); //this.listenTo(this.releaseCollection, 'sync', this._showSearchResults);
this.listenTo(this.model, 'change', function(model, options) { this.listenTo(this.model, 'change', function(model, options) {
if (options && options.changeSource === 'signalr') { if (options && options.changeSource === 'signalr') {
this._refresh(movie); this._refresh(model);
} }
}); });
vent.on(vent.Commands.CloseModalCommand, this._refreshClose, this); vent.on(vent.Commands.CloseModalCommand, this._refreshClose, this);
}, },
_refresh : function(movie) { _refresh : function(model) {
this.filesCollection = new FilesCollection(); this.filesCollection = new FilesCollection();
var file = movie.model.get("movieFile");
this.filesCollection.add(file); if(model.get('hasFile')) {
this.onShow(); var file = model.get("movieFile");
this.filesCollection.add(file);
}
this.onShow();
}, },
_refreshClose : function(options) { _refreshClose : function(options) {
@ -105,12 +109,12 @@ module.exports = Marionette.Layout.extend({
}, },
onShow : function() { onShow : function() {
this.grid.show(new Backgrid.Grid({ this.grid.show(new Backgrid.Grid({
row : Backgrid.Row, row : Backgrid.Row,
columns : this.columns, columns : this.columns,
collection : this.filesCollection, collection : this.filesCollection,
className : 'table table-hover' className : 'table table-hover'
})); }));
}, },
_showMainView : function() { _showMainView : function() {