added toggle cell for episode ignore status.

This commit is contained in:
kay.one 2013-06-08 23:21:32 -07:00
parent ca71025bca
commit dc2930dc98
6 changed files with 48 additions and 32 deletions

View File

@ -1,22 +1,15 @@
using System.Linq; using System.Linq;
using NLog; using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.DecisionEngine.Specifications namespace NzbDrone.Core.DecisionEngine.Specifications
{ {
public class MonitoredEpisodeSpecification : IDecisionEngineSpecification public class MonitoredEpisodeSpecification : IDecisionEngineSpecification
{ {
private readonly IEpisodeService _episodeService;
private readonly ISeriesRepository _seriesRepository;
private readonly Logger _logger; private readonly Logger _logger;
public MonitoredEpisodeSpecification(IEpisodeService episodeService, ISeriesRepository seriesRepository, Logger logger) public MonitoredEpisodeSpecification(Logger logger)
{ {
_episodeService = episodeService;
_seriesRepository = seriesRepository;
_logger = logger; _logger = logger;
} }
@ -24,7 +17,7 @@ namespace NzbDrone.Core.DecisionEngine.Specifications
{ {
get get
{ {
return "Series is not monitored"; return "Series is not monitored or Episode is ignored";
} }
} }

View File

@ -1,6 +1,4 @@
using NLog; using NLog;
using NzbDrone.Core.Model;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Parser.Model; using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.DecisionEngine.Specifications namespace NzbDrone.Core.DecisionEngine.Specifications

View File

@ -1,5 +1,5 @@
'use strict'; 'use strict';
define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleCell'], function () { define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleCell','Shared/Cells/ToggleCell'], function () {
NzbDrone.Series.Details.SeasonLayout = Backbone.Marionette.Layout.extend({ NzbDrone.Series.Details.SeasonLayout = Backbone.Marionette.Layout.extend({
template: 'Series/Details/SeasonLayoutTemplate', template: 'Series/Details/SeasonLayoutTemplate',
@ -9,6 +9,13 @@ define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleC
columns: [ columns: [
{
name : 'ignored',
label: '',
cell : NzbDrone.Shared.Cells.ToggleCell,
trueClass : 'icon-bookmark-empty',
falseClass :'icon-bookmark'
},
{ {
name : 'episodeNumber', name : 'episodeNumber',
label: '#', label: '#',
@ -50,7 +57,7 @@ define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleC
{ {
columns : this.columns, columns : this.columns,
collection: this.episodeCollection, collection: this.episodeCollection,
className : 'table table-hover' className : 'table table-hover season-grid'
})); }));
} }
}); });

View File

@ -50,7 +50,14 @@ define(['app', 'Quality/QualityProfileCollection'], function (app, qualityProfil
}, },
qualityProfile: function () { qualityProfile: function () {
return qualityProfiles.get(this.get('qualityProfileId')).toJSON();
var profile = qualityProfiles.get(this.get('qualityProfileId'));
if(profile){
return profile.toJSON();
}
return undefined;
} }
}, },

View File

@ -28,3 +28,9 @@
font-size: 12px; font-size: 12px;
} }
} }
.season-grid {
.toggle-cell {
width: 10px;
}
}

View File

@ -1,33 +1,38 @@
"use strict"; "use strict";
define(['app', 'Episode/Layout'], function () { define(['app', 'Episode/Layout'], function () {
NzbDrone.Series.Details.EpisodeIgnoreCell = Backgrid.Cell.extend({ NzbDrone.Shared.Cells.ToggleCell = Backgrid.Cell.extend({
className: 'toggle-cell clickable',
events: {
'click': '_onClick'
},
_onClick: function () {
var name = this.column.get('name');
this.model.set(name, !this.model.get(name));
this.render();
this.model.save();
},
className: 'episode-status-cell',
render: function () { render: function () {
this.$el.empty(); this.$el.empty();
if (this.model) {
var icon; this.$el.html('<i />');
if (this.model.get('episodeFile')) { var name = this.column.get('name');
icon = 'icon-ok';
} if (this.model.get(name)) {
else { this.$('i').addClass(this.column.get('trueClass'));
if (this.model.get('hasAired')) { }
icon = 'icon-warning-sign'; else {
} this.$('i').addClass(this.column.get('falseClass'));
else {
icon = 'icon-time';
}
}
this.$el.html('<i class="{0}"/>'.format(icon));
} }
return this; return this;
} }
}); });