From 5327068557bd48da6cf662bcc0e2db804c7e5afb Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 21 Aug 2013 08:24:09 -0700 Subject: [PATCH] QualityCell editing cleanup --- UI/Cells/Edit/QualityCellEditor.js | 6 +----- UI/Cells/NzbDroneCell.js | 13 +++++++------ UI/Cells/QualityCell.js | 6 +----- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/UI/Cells/Edit/QualityCellEditor.js b/UI/Cells/Edit/QualityCellEditor.js index d92c9be03..9dfe2201b 100644 --- a/UI/Cells/Edit/QualityCellEditor.js +++ b/UI/Cells/Edit/QualityCellEditor.js @@ -26,7 +26,7 @@ define( var templateName = self.template; self.schema = qualityProfileSchemaCollection.first(); - var selected = _.find(self.schema.get('available'), { 'id': self.cell.cellValue.get('quality').id }); + var selected = _.find(self.schema.get('available'), { 'id': self.model.get(self.column.get("name")).quality.id }); selected.selected = true; self.templateFunction = Marionette.TemplateCache.get(templateName); @@ -61,10 +61,6 @@ define( var command = new Backgrid.Command(e); model.trigger("backgrid:edited", model, column, command); - }, - - _setOptions: function (options) { - this.cell = options.cell } }); }); diff --git a/UI/Cells/NzbDroneCell.js b/UI/Cells/NzbDroneCell.js index 706eb058e..e5e6c595e 100644 --- a/UI/Cells/NzbDroneCell.js +++ b/UI/Cells/NzbDroneCell.js @@ -8,18 +8,19 @@ define( _originalInit: Backgrid.Cell.prototype.initialize, - initialize: function () { this._originalInit.apply(this, arguments); this.cellValue = this._getValue(); this.listenTo(this.model, 'change', this._refresh); - this.listenTo(this.model, "backgrid:edit", function (model, column, cell, editor) { - if (column.get("name") == this.column.get("name")) { - this._startEditing(model, column, cell, editor); - } - }); + if (this._onEdit) { + this.listenTo(this.model, "backgrid:edit", function (model, column, cell, editor) { + if (column.get("name") == this.column.get("name")) { + this._onEdit(model, column, cell, editor); + } + }); + } }, _refresh: function () { diff --git a/UI/Cells/QualityCell.js b/UI/Cells/QualityCell.js index 0dba839aa..1a4ea948d 100644 --- a/UI/Cells/QualityCell.js +++ b/UI/Cells/QualityCell.js @@ -8,10 +8,6 @@ define( className: 'quality-cell', template : 'Cells/QualityCellTemplate', - editor : QualityCellEditor, - - _startEditing: function (model, column, cell, editor) { - editor._setOptions({ cell: cell }); - } + editor : QualityCellEditor }); });