1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2026-04-21 22:05:38 -04:00

Activity instead of History

New: Renamed history to activity
New: Queue is default tab of activity
This commit is contained in:
Mark McDowall
2014-10-12 00:29:09 -07:00
parent f8fb37bae8
commit 1225bbe8dc
39 changed files with 67 additions and 66 deletions
+46
View File
@@ -0,0 +1,46 @@
'use strict';
define(
[
'underscore',
'marionette',
'Activity/Queue/QueueCollection'
], function (_, Marionette, QueueCollection) {
return Marionette.ItemView.extend({
tagName: 'span',
initialize: function () {
this.listenTo(QueueCollection, 'sync', this.render);
QueueCollection.fetch();
},
render: function () {
this.$el.empty();
if (QueueCollection.length === 0) {
return this;
}
var count = QueueCollection.fullCollection.length;
var label = 'label-info';
var errors = QueueCollection.fullCollection.some(function (model) {
return model.get('trackedDownloadStatus').toLowerCase() === 'error';
});
var warnings = QueueCollection.fullCollection.some(function (model) {
return model.get('trackedDownloadStatus').toLowerCase() === 'warning';
});
if (errors) {
label = 'label-danger';
}
else if (warnings) {
label = 'label-warning';
}
this.$el.html('<span class="label {0}">{1}</span>'.format(label, count));
return this;
}
});
});