2013-02-14 18:01:30 +00:00
|
|
|
|
'use strict';
|
|
|
|
|
|
2013-02-15 02:40:29 +00:00
|
|
|
|
define(['app', 'Quality/QualityProfileCollection', 'Series/SeriesItemView'], function (app, qualityProfileCollection) {
|
2013-02-14 18:01:30 +00:00
|
|
|
|
NzbDrone.Series.SeriesCollectionView = Backbone.Marionette.CompositeView.extend({
|
|
|
|
|
itemView: NzbDrone.Series.SeriesItemView,
|
2013-02-15 23:38:53 +00:00
|
|
|
|
itemViewContainer: 'tbody',
|
2013-02-14 18:01:30 +00:00
|
|
|
|
template: 'Series/SeriesCollectionTemplate',
|
2013-02-15 02:40:29 +00:00
|
|
|
|
qualityProfileCollection: qualityProfileCollection,
|
2013-02-14 18:01:30 +00:00
|
|
|
|
|
|
|
|
|
initialize: function () {
|
2013-02-15 02:40:29 +00:00
|
|
|
|
this.collection = new NzbDrone.Series.SeriesCollection();
|
|
|
|
|
this.collection.fetch();
|
2013-02-14 18:01:30 +00:00
|
|
|
|
this.qualityProfileCollection.fetch();
|
2013-02-15 02:40:29 +00:00
|
|
|
|
|
2013-02-14 18:01:30 +00:00
|
|
|
|
this.itemViewOptions = { qualityProfiles: this.qualityProfileCollection };
|
|
|
|
|
},
|
|
|
|
|
|
2013-02-15 23:38:53 +00:00
|
|
|
|
ui:{
|
|
|
|
|
table : '.x-series-table'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onItemRemoved: function()
|
|
|
|
|
{
|
|
|
|
|
this.ui.table.trigger('update');
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onCompositeCollectionRendered: function()
|
|
|
|
|
{
|
|
|
|
|
this.ui.table.trigger('update');
|
|
|
|
|
|
|
|
|
|
if(!this.tableSorter && this.collection.length > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
this.tableSorter = this.ui.table.tablesorter();
|
|
|
|
|
|
|
|
|
|
this.ui.table.bind("sortEnd",function() {
|
|
|
|
|
$(this).find('th.header i').each(function(){
|
|
|
|
|
$(this).remove();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(this).find('th.headerSortDown').each(function(){
|
|
|
|
|
$(this).append('<i class="icon-sort-down pull-right">');
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$(this).find('th.headerSortUp').each(function(){
|
|
|
|
|
$(this).append('<i class="icon-sort-up pull-right">');
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
this.ui.table.trigger('update');
|
|
|
|
|
}
|
2013-02-14 18:01:30 +00:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2013-02-15 23:38:53 +00:00
|
|
|
|
});
|