|
|
@ -2,29 +2,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
define(['app', 'Missing/MissingItemView'], function (app) {
|
|
|
|
define(['app', 'Missing/MissingItemView'], function (app) {
|
|
|
|
NzbDrone.Missing.MissingCollectionView = Backbone.Marionette.CompositeView.extend({
|
|
|
|
NzbDrone.Missing.MissingCollectionView = Backbone.Marionette.CompositeView.extend({
|
|
|
|
itemView: NzbDrone.Missing.MissingItemView,
|
|
|
|
itemView : NzbDrone.Missing.MissingItemView,
|
|
|
|
itemViewContainer: 'tbody',
|
|
|
|
itemViewContainer: 'tbody',
|
|
|
|
template: 'Missing/MissingCollectionTemplate',
|
|
|
|
template : 'Missing/MissingCollectionTemplate',
|
|
|
|
|
|
|
|
|
|
|
|
ui:{
|
|
|
|
ui: {
|
|
|
|
table : '.x-missing-table',
|
|
|
|
table: '.x-missing-table',
|
|
|
|
pager : '.x-missing-table-pager'
|
|
|
|
pager: '.x-missing-table-pager'
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
initialize: function (context, action, query, collection) {
|
|
|
|
initialize : function (context, action, query, collection) {
|
|
|
|
this.collection = collection;
|
|
|
|
this.collection = collection;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
onCompositeCollectionRendered: function() {
|
|
|
|
onCompositeCollectionRendered: function () {
|
|
|
|
this.ui.table.trigger('update');
|
|
|
|
this.ui.table.trigger('update');
|
|
|
|
|
|
|
|
|
|
|
|
if(!this.tableSorter && this.collection.length > 0)
|
|
|
|
if (!this.tableSorter && this.collection.length > 0) {
|
|
|
|
{
|
|
|
|
|
|
|
|
this.tableSorter = this.ui.table.tablesorter({
|
|
|
|
this.tableSorter = this.ui.table.tablesorter({
|
|
|
|
textExtraction: function (node) {
|
|
|
|
textExtraction: function (node) {
|
|
|
|
return node.innerHTML;
|
|
|
|
return node.innerHTML;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
sortList: [[3,1]],
|
|
|
|
sortList : [
|
|
|
|
headers: {
|
|
|
|
[3, 1]
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
headers : {
|
|
|
|
0: {
|
|
|
|
0: {
|
|
|
|
sorter: 'innerHtml'
|
|
|
|
sorter: 'innerHtml'
|
|
|
|
},
|
|
|
|
},
|
|
|
@ -43,45 +44,47 @@ define(['app', 'Missing/MissingItemView'], function (app) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.table.bind('pagerComplete pagerInitialized', function(event, c){
|
|
|
|
this.ui.table.bind('pagerComplete pagerInitialized', function (event, c) {
|
|
|
|
c.container.find('.page-number').text(c.page + 1);
|
|
|
|
c.container.find('.page-number').text(c.page + 1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.table.tablesorterPager({
|
|
|
|
this.ui.table.tablesorterPager({
|
|
|
|
container: this.ui.pager,
|
|
|
|
container: this.ui.pager,
|
|
|
|
output: 'Displaying {startRow} to {endRow} of {totalRows} episodes'
|
|
|
|
output : 'Displaying {startRow} to {endRow} of {totalRows} episodes'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
this.applySortIcons();
|
|
|
|
this.applySortIcons();
|
|
|
|
|
|
|
|
|
|
|
|
this.ui.table.bind("sortEnd", function() {
|
|
|
|
this.ui.table.bind("sortEnd", function () {
|
|
|
|
this.applySortIcons();
|
|
|
|
this.applySortIcons();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else {
|
|
|
|
{
|
|
|
|
|
|
|
|
this.ui.table.trigger('update');
|
|
|
|
this.ui.table.trigger('update');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
//Todo: Remove this from each view that requires it
|
|
|
|
//Todo: Remove this from each view that requires it
|
|
|
|
applySortIcons: function() {
|
|
|
|
applySortIcons : function () {
|
|
|
|
$(this.ui.table).find('th.tablesorter-header .tablesorter-header-inner i').each(function(){
|
|
|
|
$(this.ui.table).find('th.tablesorter-header .tablesorter-header-inner i').each(function () {
|
|
|
|
$(this).remove();
|
|
|
|
$(this).remove();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$(this.ui.table).find('th.tablesorter-header').each(function () {
|
|
|
|
$(this.ui.table).find('th.tablesorter-header').each(function () {
|
|
|
|
if ($(this).hasClass('tablesorter-headerDesc'))
|
|
|
|
if ($(this).hasClass('tablesorter-headerDesc')) {
|
|
|
|
$(this).children('.tablesorter-header-inner').append('<i class="icon-sort-up pull-right">');
|
|
|
|
$(this).children('.tablesorter-header-inner').append('<i class="icon-sort-up pull-right">');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if ($(this).hasClass('tablesorter-headerAsc'))
|
|
|
|
else if ($(this).hasClass('tablesorter-headerAsc')) {
|
|
|
|
$(this).children('.tablesorter-header-inner').append('<i class="icon-sort-down pull-right">');
|
|
|
|
$(this).children('.tablesorter-header-inner').append('<i class="icon-sort-down pull-right">');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
else if (!$(this).hasClass('sorter-false'))
|
|
|
|
else if (!$(this).hasClass('sorter-false')) {
|
|
|
|
$(this).children('.tablesorter-header-inner').append('<i class="icon-sort pull-right">');
|
|
|
|
$(this).children('.tablesorter-header-inner').append('<i class="icon-sort pull-right">');
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
},
|
|
|
|
updatePageNumber: function(event, stuff) {
|
|
|
|
updatePageNumber : function (event, stuff) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|