Added sorting icons to series table

pull/2/head
Mark McDowall 12 years ago
parent 4cc4e8133e
commit f8bae13e1c

@ -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';
}
});

@ -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'
}
];

Loading…
Cancel
Save