Fixed manually download will show queued when downloading

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

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

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

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

@ -3,7 +3,7 @@ define(
[
'marionette',
'backgrid',
'Release/Collection',
'Release/ReleaseCollection',
'Cells/IndexerCell',
'Cells/EpisodeNumberCell',
'Cells/FileSizeCell',
@ -12,7 +12,7 @@ define(
'Shared/LoadingView'
], function (Marionette, Backgrid, ReleaseCollection, IndexerCell, EpisodeNumberCell, FileSizeCell, QualityCell, ApprovalStatusCell, LoadingView) {
return Marionette.Layout.extend({
template: 'Release/LayoutTemplate',
template: 'Release/ReleaseLayoutTemplate',
regions: {
grid : '#x-grid',
@ -27,7 +27,6 @@ define(
sortable: true,
cell : IndexerCell
},
{
name : 'title',
label : 'Title',
@ -52,7 +51,6 @@ define(
sortable: true,
cell : QualityCell
},
{
name : 'rejections',
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) {
this.grid.show(new Backgrid.Grid({
row : Backgrid.Row,
@ -69,23 +77,6 @@ define(
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