added toggle cell for episode ignore status.

pull/6/head
kay.one 11 years ago
parent ca71025bca
commit dc2930dc98

@ -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";
} }
} }

@ -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

@ -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'
})); }));
} }
}); });

@ -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;
} }
}, },

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

@ -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;
if (this.model.get('episodeFile')) { this.$el.html('<i />');
icon = 'icon-ok';
} var name = this.column.get('name');
else {
if (this.model.get('hasAired')) {
icon = 'icon-warning-sign';
}
else {
icon = 'icon-time';
}
}
this.$el.html('<i class="{0}"/>'.format(icon)); if (this.model.get(name)) {
this.$('i').addClass(this.column.get('trueClass'));
}
else {
this.$('i').addClass(this.column.get('falseClass'));
} }
return this; return this;
} }
}); });

Loading…
Cancel
Save