New: Manual search shows error when download fails

This commit is contained in:
Mark McDowall 2015-11-02 22:46:06 -08:00
parent 6b9c4af591
commit b34879b4f6
1 changed files with 10 additions and 2 deletions

View File

@ -14,15 +14,23 @@ module.exports = Backgrid.Cell.extend({
var self = this;
this.$el.html('<i class="icon-sonarr-spinner fa-spin" />');
this.$el.html('<i class="icon-sonarr-spinner fa-spin" title="Adding to download queue" />');
//Using success callback instead of promise so it
//gets called before the sync event is triggered
this.model.save(null, {
var promise = this.model.save(null, {
success : function() {
self.model.set('queued', true);
}
});
promise.fail(function (xhr) {
if (xhr.responseJSON && xhr.responseJSON.message) {
self.$el.html('<i class="icon-sonarr-download-failed" title="{0}" />'.format(xhr.responseJSON.message));
} else {
self.$el.html('<i class="icon-sonarr-download-failed" title="Failed to add to download queue" />');
}
});
},
render : function() {