Added sorting icons to series table

This commit is contained in:
Mark McDowall 2013-04-23 00:11:52 -07:00
parent 4cc4e8133e
commit f8bae13e1c
2 changed files with 52 additions and 8 deletions

View File

@ -80,4 +80,40 @@ Backgrid.SeriesIndexTableRow = Backgrid.Row.extend({
view: view
});
}
});
Backgrid.NzbDroneHeaderCell = Backgrid.HeaderCell.extend({
events: {
'click': 'onClick'
},
render: function () {
this.$el.empty();
var test = this.column.get('label');
this.$el.append(this.column.get("label"));
if (this.column.get('sortable')) {
this.$el.append(" <i class='icon-sort pull-right'></i>");
}
this.delegateEvents();
return this;
},
direction: function (dir) {
if (arguments.length) {
if (this._direction) this.$el.children('i').removeClass(this._convertDirectionToIcon(this._direction));
if (dir) this.$el.children('i').addClass(this._convertDirectionToIcon(dir));
this._direction = dir;
}
return this._direction;
},
_convertDirectionToIcon: function (dir) {
if (dir === 'ascending') {
return 'icon-sort-up';
}
return 'icon-sort-down';
}
});

View File

@ -28,51 +28,59 @@ define([
name: 'status',
label: '',
editable: false,
cell: 'seriesStatus'
cell: 'seriesStatus',
headerCell: 'nzbDrone'
},
{
name: 'title',
label: 'Title',
editable: false,
cell: 'string'
cell: 'string',
headerCell: 'nzbDrone'
},
{
name: 'seasonCount',
label: 'Seasons',
editable: false,
cell: 'integer'
cell: 'integer',
headerCell: 'nzbDrone'
},
{
name: 'quality',
label: 'Quality',
editable: false,
cell: 'integer'
cell: 'integer',
headerCell: 'nzbDrone'
},
{
name: 'network',
label: 'Network',
editable: false,
cell: 'string'
cell: 'string',
headerCell: 'nzbDrone'
},
{
name: 'nextAiring',
label: 'Next Airing',
editable: false,
cell: 'airDate'
cell: 'airDate',
headerCell: 'nzbDrone'
},
{
name: 'episodes',
label: 'Episodes',
editable: false,
sortable: false,
cell: 'episodeProgress'
cell: 'episodeProgress',
headerCell: 'nzbDrone'
},
{
name: 'edit',
label: '',
editable: false,
sortable: false,
cell: 'controlsColumn'
cell: 'controlsColumn',
headerCell: 'nzbDrone'
}
];