1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-26 01:38:24 +00:00

Fixed table header cell

This commit is contained in:
Mark McDowall 2015-02-02 23:46:37 -08:00
parent ed4bf349db
commit 85f6d90f40
3 changed files with 15 additions and 11 deletions

View file

@ -1,9 +1,9 @@
var Backgrid = require('backgrid');
module.exports = (function(){
Backgrid.NzbDroneHeaderCell = Backgrid.HeaderCell.extend({
events : {"click" : 'onClick'},
_originalInit : Backgrid.HeaderCell.prototype.initialize,
module.exports.register = function(backgrid) {
backgrid.SonarrHeaderCell = backgrid.HeaderCell.extend({
events : {
'click' : 'onClick'
},
_originalInit : backgrid.HeaderCell.prototype.initialize,
initialize : function(options){
this._originalInit.call(this, options);
this.listenTo(this.collection, 'drone:sort', this.render);
@ -12,7 +12,7 @@ module.exports = (function(){
this.$el.empty();
this.$el.append(this.column.get('label'));
var column = this.column;
var sortable = Backgrid.callByNeed(column.sortable(), column, this.collection);
var sortable = backgrid.callByNeed(column.sortable(), column, this.collection);
if(sortable) {
this.$el.addClass('sortable');
this.$el.append(' <i class="pull-right"></i>');
@ -68,7 +68,7 @@ module.exports = (function(){
var collection = this.collection;
var event = 'backgrid:sort';
var column = this.column;
var sortable = Backgrid.callByNeed(column.sortable(), column, collection);
var sortable = backgrid.callByNeed(column.sortable(), column, collection);
if(sortable) {
var direction = collection.state.order;
if(direction === 'ascending' || direction === -1) {
@ -109,5 +109,4 @@ module.exports = (function(){
this.$el.children('i').removeClass('icon-sort-up icon-sort-down');
}
});
return Backgrid.NzbDroneHeaderCell;
}).call(this);
};

View file

@ -2,7 +2,6 @@ var $ = require('jquery');
module.exports = {
appInitializer : function(){
console.log('starting signalR');
$('body').tooltip({selector : '[title]'});
return this;
}

View file

@ -2,7 +2,12 @@ require('../JsLibraries/backbone.backgrid');
require('backbone');
require('backbone');
var backgrid = require('../JsLibraries/backbone.backgrid');
var header = require('../Shared/Grid/HeaderCell');
header.register(backgrid);
backgrid.Column.prototype.defaults = {
name : undefined,
label : undefined,
@ -11,6 +16,7 @@ backgrid.Column.prototype.defaults = {
renderable : true,
formatter : undefined,
cell : undefined,
headerCell : 'Sonarr',
sortType : 'toggle'
};
module.exports = backgrid;