1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-03-07 15:20:58 +02:00
Sonarr/src/UI/Release/DownloadReportCell.js

53 lines
1.4 KiB
JavaScript
Raw Normal View History

2013-06-21 23:24:24 -07:00
'use strict';
define(
[
'backgrid'
], function (Backgrid) {
return Backgrid.Cell.extend({
className: 'download-report-cell',
events: {
'click': '_onClick'
},
_onClick: function () {
2013-09-21 00:45:45 -07:00
if (!this.model.get('downloadAllowed'))
{
return;
}
var self = this;
this.$el.html('<i class="icon-spinner icon-spin" />');
//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('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" />');
}
2013-09-21 00:45:45 -07:00
else {
this.className = 'no-download-report-cell';
}
return this;
}
});
});