From 85f6d90f4022dbb9c03e3422f90cd5f508587fe8 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 2 Feb 2015 23:46:37 -0800 Subject: [PATCH] Fixed table header cell --- src/UI/Shared/Grid/HeaderCell.js | 19 +++++++++---------- src/UI/Shared/Tooltip.js | 1 - src/UI/Shims/backgrid.js | 6 ++++++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/UI/Shared/Grid/HeaderCell.js b/src/UI/Shared/Grid/HeaderCell.js index 7f8d1fa60..12fa6be20 100644 --- a/src/UI/Shared/Grid/HeaderCell.js +++ b/src/UI/Shared/Grid/HeaderCell.js @@ -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(' '); @@ -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); \ No newline at end of file +}; diff --git a/src/UI/Shared/Tooltip.js b/src/UI/Shared/Tooltip.js index cdb847ea1..15e0e68e3 100644 --- a/src/UI/Shared/Tooltip.js +++ b/src/UI/Shared/Tooltip.js @@ -2,7 +2,6 @@ var $ = require('jquery'); module.exports = { appInitializer : function(){ - console.log('starting signalR'); $('body').tooltip({selector : '[title]'}); return this; } diff --git a/src/UI/Shims/backgrid.js b/src/UI/Shims/backgrid.js index f3d40e86d..44c666a13 100644 --- a/src/UI/Shims/backgrid.js +++ b/src/UI/Shims/backgrid.js @@ -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; \ No newline at end of file