2013-06-22 06:24:24 +00:00
|
|
|
'use strict';
|
2013-06-09 20:51:32 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
define(
|
|
|
|
[
|
|
|
|
'backgrid'
|
|
|
|
], function (Backgrid) {
|
|
|
|
return Backgrid.Cell.extend({
|
2013-06-09 20:51:32 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
className: 'download-report-cell',
|
2013-06-09 20:51:32 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
events: {
|
|
|
|
'click': '_onClick'
|
|
|
|
},
|
2013-06-09 20:51:32 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
_onClick: function () {
|
2013-06-09 20:51:32 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
var self = this;
|
2013-06-09 20:51:32 +00:00
|
|
|
|
2013-07-17 06:41:40 +00:00
|
|
|
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" />');
|
2013-07-03 00:44:22 +00:00
|
|
|
});
|
2013-06-24 23:41:59 +00:00
|
|
|
},
|
2013-06-09 20:51:32 +00:00
|
|
|
|
2013-06-24 23:41:59 +00:00
|
|
|
render: function () {
|
2013-09-18 19:15:34 +00:00
|
|
|
this.$el.html('');
|
2013-06-09 20:51:32 +00:00
|
|
|
|
2013-09-18 19:15:34 +00:00
|
|
|
if (this.model.get('downloadAllowed'))
|
|
|
|
{
|
|
|
|
this.$el.html('<i class="icon-download-alt" title="Add to download queue" />');
|
|
|
|
}
|
2013-06-14 23:18:37 +00:00
|
|
|
|
2013-09-18 19:15:34 +00:00
|
|
|
return this;
|
2013-06-24 23:41:59 +00:00
|
|
|
}
|
|
|
|
});
|
2013-06-14 23:18:37 +00:00
|
|
|
});
|