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