Fixed manually download will show queued when downloading

Fixed: Manually download will change icons when sent to download client
pull/38/merge
Mark McDowall 11 years ago
parent 410bf0d846
commit 8388092bf5

@ -9,7 +9,7 @@ define(
'AddSeries/AddSeriesLayout', 'AddSeries/AddSeriesLayout',
'Missing/MissingLayout', 'Missing/MissingLayout',
'Calendar/CalendarLayout', 'Calendar/CalendarLayout',
'Release/Layout', 'Release/ReleaseLayout',
'System/SystemLayout', 'System/SystemLayout',
'SeasonPass/SeasonPassLayout', 'SeasonPass/SeasonPassLayout',
'System/Update/UpdateLayout' 'System/Update/UpdateLayout'

@ -22,21 +22,22 @@ define(
var self = this; var self = this;
this.$el.html('<i class="icon-spinner icon-spin" />'); this.$el.html('<i class="icon-spinner icon-spin" />');
var promise = this.model.save();
promise.done(function () { //Using success callback instead of promise so it
self.$el.html('<i class="icon-ok" title="Added to downloaded queue" />'); //gets called before the sync event is triggered
}); this.model.save(null, { success: function () {
self.model.set('queued', true);
promise.fail(function () { }});
self.$el.html('<i class="icon-download-alt" title="Add to download queue" />');
});
}, },
render: function () { render: function () {
this.$el.empty(); this.$el.empty();
if (this.model.get('downloadAllowed')) if (this.model.get('queued')) {
this.$el.html('<i class="icon-nd-downloading" title="Added to downloaded queue" />');
}
else if (this.model.get('downloadAllowed'))
{ {
this.$el.html('<i class="icon-download-alt" title="Add to download queue" />'); this.$el.html('<i class="icon-download-alt" title="Add to download queue" />');
} }

@ -2,7 +2,7 @@
define( define(
[ [
'backbone', 'backbone',
'Release/Model' 'Release/ReleaseModel'
], function (Backbone, ReleaseModel) { ], function (Backbone, ReleaseModel) {
return Backbone.Collection.extend({ return Backbone.Collection.extend({
url : window.NzbDrone.ApiRoot + '/release', url : window.NzbDrone.ApiRoot + '/release',
@ -13,7 +13,7 @@ define(
}, },
fetchEpisodeReleases: function (episodeId) { fetchEpisodeReleases: function (episodeId) {
return this.fetch({ data: { episodeId: episodeId }}); return this.fetch({ data: { episodeId: episodeId }});
} }
}); });
}); });

@ -3,7 +3,7 @@ define(
[ [
'marionette', 'marionette',
'backgrid', 'backgrid',
'Release/Collection', 'Release/ReleaseCollection',
'Cells/IndexerCell', 'Cells/IndexerCell',
'Cells/EpisodeNumberCell', 'Cells/EpisodeNumberCell',
'Cells/FileSizeCell', 'Cells/FileSizeCell',
@ -12,7 +12,7 @@ define(
'Shared/LoadingView' 'Shared/LoadingView'
], function (Marionette, Backgrid, ReleaseCollection, IndexerCell, EpisodeNumberCell, FileSizeCell, QualityCell, ApprovalStatusCell, LoadingView) { ], function (Marionette, Backgrid, ReleaseCollection, IndexerCell, EpisodeNumberCell, FileSizeCell, QualityCell, ApprovalStatusCell, LoadingView) {
return Marionette.Layout.extend({ return Marionette.Layout.extend({
template: 'Release/LayoutTemplate', template: 'Release/ReleaseLayoutTemplate',
regions: { regions: {
grid : '#x-grid', grid : '#x-grid',
@ -27,7 +27,6 @@ define(
sortable: true, sortable: true,
cell : IndexerCell cell : IndexerCell
}, },
{ {
name : 'title', name : 'title',
label : 'Title', label : 'Title',
@ -52,7 +51,6 @@ define(
sortable: true, sortable: true,
cell : QualityCell cell : QualityCell
}, },
{ {
name : 'rejections', name : 'rejections',
label: '', label: '',
@ -60,7 +58,17 @@ define(
} }
], ],
showTable: function () { initialize: function () {
this.collection = new ReleaseCollection();
this.listenTo(this.collection, 'sync', this._showTable);
},
onRender: function () {
this.grid.show(new LoadingView());
this.collection.fetch();
},
_showTable: function () {
if (!this.isClosed) { if (!this.isClosed) {
this.grid.show(new Backgrid.Grid({ this.grid.show(new Backgrid.Grid({
row : Backgrid.Row, row : Backgrid.Row,
@ -69,23 +77,6 @@ define(
className : 'table table-hover' className : 'table table-hover'
})); }));
} }
},
initialize: function () {
this.collection = new ReleaseCollection();
this.fetchPromise = this.collection.fetch();
},
onShow: function () {
var self = this;
this.grid.show(new LoadingView());
this.fetchPromise.done(function () {
self.showTable();
});
} }
}); });
}); });
Loading…
Cancel
Save