From 135cf3ce17e08b4f146b5cd4fc4f2aca5c13c6b0 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 17 Jul 2013 17:39:41 -0700 Subject: [PATCH] QualityProfile added to series table --- UI/Cells/QualityProfileCell.js | 24 ++++++++++++++++++++++++ UI/Series/Index/SeriesIndexLayout.js | 20 ++++++++++++++++---- 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 UI/Cells/QualityProfileCell.js diff --git a/UI/Cells/QualityProfileCell.js b/UI/Cells/QualityProfileCell.js new file mode 100644 index 000000000..292a1dd41 --- /dev/null +++ b/UI/Cells/QualityProfileCell.js @@ -0,0 +1,24 @@ +'use strict'; +define( + [ + 'backgrid', + 'Quality/QualityProfileCollection' + ], function (Backgrid, QualityProfileCollection) { + return Backgrid.Cell.extend({ + className: 'quality-profile-cell', + + render: function () { + + this.$el.empty(); + var qualityProfileId = this.model.get(this.column.get('name')); + + var profile = _.findWhere(QualityProfileCollection.models, { id: qualityProfileId }); + + if (profile) { + this.$el.html(profile.get('name')); + } + + return this; + } + }); + }); diff --git a/UI/Series/Index/SeriesIndexLayout.js b/UI/Series/Index/SeriesIndexLayout.js index d947e3a2c..7cfb954ad 100644 --- a/UI/Series/Index/SeriesIndexLayout.js +++ b/UI/Series/Index/SeriesIndexLayout.js @@ -9,12 +9,24 @@ define( 'Cells/AirDateCell', 'Cells/SeriesTitleCell', 'Cells/TemplatedCell', + 'Cells/QualityProfileCell', 'Series/Index/Table/SeriesStatusCell', 'Series/Index/Table/Row', 'Shared/Toolbar/ToolbarLayout', 'Shared/LoadingView' - ], function (Marionette, PosterCollectionView, ListCollectionView, EmptyView, SeriesCollection, AirDateCell, SeriesTitleCell, TemplatedCell, SeriesStatusCell, SeriesIndexRow, - ToolbarLayout, LoadingView) { + ], function (Marionette, + PosterCollectionView, + ListCollectionView, + EmptyView, + SeriesCollection, + AirDateCell, + SeriesTitleCell, + TemplatedCell, + QualityProfileCell, + SeriesStatusCell, + SeriesIndexRow, + ToolbarLayout, + LoadingView) { return Marionette.Layout.extend({ template: 'Series/Index/SeriesIndexLayoutTemplate', @@ -41,9 +53,9 @@ define( cell : 'integer' }, { - name : 'quality', + name : 'qualityProfileId', label: 'Quality', - cell : 'integer' + cell : QualityProfileCell }, { name : 'network',