mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-31 16:02:29 +01:00
34 lines
966 B
JavaScript
34 lines
966 B
JavaScript
'use strict';
|
|
|
|
define(
|
|
[
|
|
'marionette',
|
|
'Cells/NzbDroneCell'
|
|
], function (Marionette, NzbDroneCell) {
|
|
return NzbDroneCell.extend({
|
|
className: 'episode-progress-cell',
|
|
template : 'Cells/EpisodeProgressCellTemplate',
|
|
|
|
render: function () {
|
|
|
|
var episodeCount = this.model.get('episodeCount');
|
|
var episodeFileCount = this.model.get('episodeFileCount');
|
|
|
|
var percent = 100;
|
|
|
|
if (episodeCount > 0) {
|
|
percent = episodeFileCount / episodeCount * 100;
|
|
}
|
|
|
|
this.model.set('percentOfEpisodes', percent);
|
|
|
|
this.templateFunction = Marionette.TemplateCache.get(this.template);
|
|
var data = this.model.toJSON();
|
|
var html = this.templateFunction(data);
|
|
this.$el.html(html);
|
|
|
|
return this;
|
|
}
|
|
});
|
|
});
|