added toggle cell for episode ignore status.

pull/24/head
kay.one 12 years ago
parent ca71025bca
commit dc2930dc98

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

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

@ -1,5 +1,5 @@
'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({
template: 'Series/Details/SeasonLayoutTemplate',
@ -9,6 +9,13 @@ define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleC
columns: [
{
name : 'ignored',
label: '',
cell : NzbDrone.Shared.Cells.ToggleCell,
trueClass : 'icon-bookmark-empty',
falseClass :'icon-bookmark'
},
{
name : 'episodeNumber',
label: '#',
@ -50,7 +57,7 @@ define(['app', 'Series/Details/EpisodeStatusCell', 'Series/Details/EpisodeTitleC
{
columns : this.columns,
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 () {
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;
}
}
.season-grid {
.toggle-cell {
width: 10px;
}
}

@ -1,33 +1,38 @@
"use strict";
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 () {
this.$el.empty();
if (this.model) {
var icon;
if (this.model.get('episodeFile')) {
icon = 'icon-ok';
this.$el.html('<i />');
}
else {
if (this.model.get('hasAired')) {
icon = 'icon-warning-sign';
}
else {
icon = 'icon-time';
}
}
var name = this.column.get('name');
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;
}
});

Loading…
Cancel
Save