mirror of
https://github.com/lidarr/Lidarr
synced 2024-12-27 01:57:21 +00:00
44 lines
949 B
JavaScript
44 lines
949 B
JavaScript
"use strict";
|
|
|
|
define(['app'], function () {
|
|
NzbDrone.Cells.NzbDroneCell = Backgrid.Cell.extend({
|
|
|
|
_originalInit: Backgrid.Cell.prototype.initialize,
|
|
|
|
|
|
initialize: function () {
|
|
this._originalInit.apply(this, arguments);
|
|
this.cellValue = this._getValue();
|
|
|
|
this.model.on('change', this._refresh, this);
|
|
},
|
|
|
|
_refresh: function () {
|
|
this.cellValue = this._getValue();
|
|
this.render();
|
|
},
|
|
|
|
_getValue: function () {
|
|
|
|
var name = this.column.get('name');
|
|
|
|
if(name === 'this'){
|
|
return this.model;
|
|
}
|
|
|
|
var value = this.model.get(name);
|
|
|
|
if(!value){
|
|
return undefined;
|
|
}
|
|
|
|
//if not a model
|
|
if (!value.get) {
|
|
value = new Backbone.Model(value);
|
|
}
|
|
|
|
return value;
|
|
}
|
|
|
|
});
|
|
});
|