diff --git a/src/UI/Activity/Queue/QueueModel.js b/src/UI/Activity/Queue/QueueModel.js
index cffd2a684..f8ec8c538 100644
--- a/src/UI/Activity/Queue/QueueModel.js
+++ b/src/UI/Activity/Queue/QueueModel.js
@@ -3,7 +3,7 @@ var SeriesModel = require('../../Series/SeriesModel');
var EpisodeModel = require('../../Series/EpisodeModel');
module.exports = Backbone.Model.extend({
- parse : function(model){
+ parse : function(model) {
model.series = new SeriesModel(model.series);
model.episode = new EpisodeModel(model.episode);
model.episode.set('series', model.series);
diff --git a/src/UI/Activity/Queue/QueueStatusCell.js b/src/UI/Activity/Queue/QueueStatusCell.js
index 78dd4c3da..48d255237 100644
--- a/src/UI/Activity/Queue/QueueStatusCell.js
+++ b/src/UI/Activity/Queue/QueueStatusCell.js
@@ -4,56 +4,68 @@ var NzbDroneCell = require('../../Cells/NzbDroneCell');
module.exports = NzbDroneCell.extend({
className : 'queue-status-cell',
template : 'Activity/Queue/QueueStatusCellTemplate',
- render : function(){
+
+ render : function() {
this.$el.empty();
- if(this.cellValue) {
+
+ if (this.cellValue) {
var status = this.cellValue.get('status').toLowerCase();
var trackedDownloadStatus = this.cellValue.has('trackedDownloadStatus') ? this.cellValue.get('trackedDownloadStatus').toLowerCase() : 'ok';
var icon = 'icon-nd-downloading';
var title = 'Downloading';
var itemTitle = this.cellValue.get('title');
var content = itemTitle;
- if(status === 'paused') {
+
+ if (status === 'paused') {
icon = 'icon-pause';
title = 'Paused';
}
- if(status === 'queued') {
+
+ if (status === 'queued') {
icon = 'icon-cloud';
title = 'Queued';
}
- if(status === 'completed') {
+
+ if (status === 'completed') {
icon = 'icon-inbox';
title = 'Downloaded';
}
- if(status === 'pending') {
+
+ if (status === 'pending') {
icon = 'icon-time';
title = 'Pending';
}
- if(status === 'failed') {
+
+ if (status === 'failed') {
icon = 'icon-nd-download-failed';
title = 'Download failed';
}
- if(status === 'warning') {
+
+ if (status === 'warning') {
icon = 'icon-nd-download-warning';
title = 'Download warning: check download client for more details';
}
- if(trackedDownloadStatus === 'warning') {
+
+ if (trackedDownloadStatus === 'warning') {
icon += ' icon-nd-warning';
+
this.templateFunction = Marionette.TemplateCache.get(this.template);
content = this.templateFunction(this.cellValue.toJSON());
}
- if(trackedDownloadStatus === 'error') {
- if(status === 'completed') {
+
+ if (trackedDownloadStatus === 'error') {
+ if (status === 'completed') {
icon = 'icon-nd-import-failed';
title = 'Import failed: ' + itemTitle;
- }
- else {
+ } else {
icon = 'icon-nd-download-failed';
title = 'Download failed';
}
+
this.templateFunction = Marionette.TemplateCache.get(this.template);
content = this.templateFunction(this.cellValue.toJSON());
}
+
this.$el.html('
'.format(icon));
this.$el.popover({
content : content,
diff --git a/src/UI/Activity/Queue/QueueView.js b/src/UI/Activity/Queue/QueueView.js
index 7fb95a4c7..ccddebbc9 100644
--- a/src/UI/Activity/Queue/QueueView.js
+++ b/src/UI/Activity/Queue/QueueView.js
@@ -3,30 +3,37 @@ var Marionette = require('marionette');
var QueueCollection = require('./QueueCollection');
module.exports = Marionette.ItemView.extend({
- tagName : 'span',
- initialize : function(){
+ tagName : 'span',
+
+ initialize : function() {
this.listenTo(QueueCollection, 'sync', this.render);
QueueCollection.fetch();
},
- render : function(){
+
+ render : function() {
this.$el.empty();
- if(QueueCollection.length === 0) {
+
+ if (QueueCollection.length === 0) {
return this;
}
+
var count = QueueCollection.fullCollection.length;
var label = 'label-info';
- var errors = QueueCollection.fullCollection.some(function(model){
+
+ var errors = QueueCollection.fullCollection.some(function(model) {
return model.has('trackedDownloadStatus') && model.get('trackedDownloadStatus').toLowerCase() === 'error';
});
- var warnings = QueueCollection.fullCollection.some(function(model){
+
+ var warnings = QueueCollection.fullCollection.some(function(model) {
return model.has('trackedDownloadStatus') && model.get('trackedDownloadStatus').toLowerCase() === 'warning';
});
- if(errors) {
+
+ if (errors) {
label = 'label-danger';
- }
- else if(warnings) {
+ } else if (warnings) {
label = 'label-warning';
}
+
this.$el.html('
{1}'.format(label, count));
return this;
}
diff --git a/src/UI/Activity/Queue/RemoveFromQueueView.js b/src/UI/Activity/Queue/RemoveFromQueueView.js
index 9b3d6a6cf..571738d7a 100644
--- a/src/UI/Activity/Queue/RemoveFromQueueView.js
+++ b/src/UI/Activity/Queue/RemoveFromQueueView.js
@@ -1,39 +1,34 @@
-'use strict';
-define(
- [
- 'vent',
- 'marionette'
- ], function (vent, Marionette) {
+var vent = require('../../vent');
+var Marionette = require('marionette');
- return Marionette.ItemView.extend({
- template: 'Activity/Queue/RemoveFromQueueViewTemplate',
+module.exports = Marionette.ItemView.extend({
+ template : 'Activity/Queue/RemoveFromQueueViewTemplate',
- events: {
- 'click .x-confirm-remove' : 'removeItem'
- },
+ events : {
+ 'click .x-confirm-remove' : 'removeItem'
+ },
- ui: {
- blacklist : '.x-blacklist',
- indicator : '.x-indicator'
- },
+ ui : {
+ blacklist : '.x-blacklist',
+ indicator : '.x-indicator'
+ },
- initialize: function (options) {
- this.templateHelpers = {
- showBlacklist: options.showBlacklist
- };
- },
+ initialize : function(options) {
+ this.templateHelpers = {
+ showBlacklist : options.showBlacklist
+ };
+ },
- removeItem: function () {
- var blacklist = this.ui.blacklist.prop('checked') || false;
+ removeItem : function() {
+ var blacklist = this.ui.blacklist.prop('checked') || false;
- this.ui.indicator.show();
+ this.ui.indicator.show();
- this.model.destroy({
- data: { 'blacklist': blacklist },
- wait: true
- }).done(function () {
- vent.trigger(vent.Commands.CloseModalCommand);
- });
- }
+ this.model.destroy({
+ data : { 'blacklist' : blacklist },
+ wait : true
+ }).done(function() {
+ vent.trigger(vent.Commands.CloseModalCommand);
});
- });
+ }
+});
diff --git a/src/UI/Activity/Queue/TimeleftCell.js b/src/UI/Activity/Queue/TimeleftCell.js
index 376bcd075..cdb054c96 100644
--- a/src/UI/Activity/Queue/TimeleftCell.js
+++ b/src/UI/Activity/Queue/TimeleftCell.js
@@ -6,26 +6,31 @@ var FormatHelpers = require('../../Shared/FormatHelpers');
module.exports = NzbDroneCell.extend({
className : 'timeleft-cell',
- render : function(){
+
+ render : function() {
this.$el.empty();
- if(this.cellValue) {
- if(this.cellValue.get('status').toLowerCase() === 'pending') {
+
+ if (this.cellValue) {
+ if (this.cellValue.get('status').toLowerCase() === 'pending') {
var ect = this.cellValue.get('estimatedCompletionTime');
var time = '{0} at {1}'.format(FormatHelpers.relativeDate(ect), moment(ect).format(UiSettingsModel.time(true, false)));
this.$el.html('-');
this.$el.attr('title', 'Will be processed during the first RSS Sync after {0}'.format(time));
+
return this;
}
+
var timeleft = this.cellValue.get('timeleft');
var totalSize = fileSize(this.cellValue.get('size'), 1, false);
var remainingSize = fileSize(this.cellValue.get('sizeleft'), 1, false);
- if(timeleft === undefined) {
+
+ if (timeleft === undefined) {
this.$el.html('-');
- }
- else {
+ } else {
this.$el.html('
{0}'.format(timeleft, remainingSize, totalSize));
}
}
+
return this;
}
});
\ No newline at end of file