2013-10-02 05:20:30 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
define(
|
|
|
|
[
|
2014-05-24 10:50:34 +00:00
|
|
|
'Cells/NzbDroneCell',
|
|
|
|
'filesize'
|
|
|
|
], function (NzbDroneCell, fileSize) {
|
2013-10-02 05:20:30 +00:00
|
|
|
return NzbDroneCell.extend({
|
|
|
|
|
2013-10-02 15:33:23 +00:00
|
|
|
className: 'timeleft-cell',
|
2013-10-02 05:20:30 +00:00
|
|
|
|
|
|
|
render: function () {
|
|
|
|
this.$el.empty();
|
|
|
|
|
|
|
|
if (this.cellValue) {
|
|
|
|
|
|
|
|
var timeleft = this.cellValue.get('timeleft');
|
2014-05-24 10:50:34 +00:00
|
|
|
var totalSize = fileSize(this.cellValue.get('size'), 1, false);
|
|
|
|
var remainingSize = fileSize(this.cellValue.get('sizeleft'), 1, false);
|
2013-10-02 05:20:30 +00:00
|
|
|
|
2014-05-24 10:50:34 +00:00
|
|
|
if (timeleft === undefined) {
|
|
|
|
this.$el.html("-");
|
|
|
|
} else {
|
|
|
|
this.$el.html(timeleft);
|
|
|
|
}
|
|
|
|
this.$el.attr('title', '{0} / {1}'.format(remainingSize, totalSize));
|
2013-10-02 05:20:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|