diff --git a/NzbDrone.Web/Content/Images/ignored.png b/NzbDrone.Web/Content/Images/ignored.png new file mode 100644 index 000000000..06b5934d6 Binary files /dev/null and b/NzbDrone.Web/Content/Images/ignored.png differ diff --git a/NzbDrone.Web/Content/Images/notIgnored.png b/NzbDrone.Web/Content/Images/notIgnored.png new file mode 100644 index 000000000..4ead4b480 Binary files /dev/null and b/NzbDrone.Web/Content/Images/notIgnored.png differ diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index c1d0835be..195fce36b 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -227,8 +227,6 @@ namespace NzbDrone.Web.Controllers var episodePath = String.Empty; var episodeQuality = String.Empty; - - if (e.EpisodeFile != null) { episodePath = e.EpisodeFile.Path; @@ -252,7 +250,8 @@ namespace NzbDrone.Web.Controllers Path = episodePath, EpisodeFileId = episodeFileId, Status = e.Status.ToString(), - Quality = episodeQuality + Quality = episodeQuality, + Ignored = e.Ignored }); } diff --git a/NzbDrone.Web/Models/EpisodeModel.cs b/NzbDrone.Web/Models/EpisodeModel.cs index 2384031d9..867066f99 100644 --- a/NzbDrone.Web/Models/EpisodeModel.cs +++ b/NzbDrone.Web/Models/EpisodeModel.cs @@ -15,5 +15,6 @@ namespace NzbDrone.Web.Models public String Status { get; set; } public string AirDate { get; set; } public String Quality { get; set; } + public bool Ignored { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index e158a9177..e204fe659 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -183,6 +183,8 @@ + + @@ -250,6 +252,7 @@ + diff --git a/NzbDrone.Web/Scripts/seriesDetails.js b/NzbDrone.Web/Scripts/seriesDetails.js new file mode 100644 index 000000000..cc18320cb --- /dev/null +++ b/NzbDrone.Web/Scripts/seriesDetails.js @@ -0,0 +1,83 @@ +var notIgnoredImage = '../../Content/Images/notIgnored.png'; +var ignoredImage = '../../Content/Images/ignored.png'; + +$(".ignoreEpisode").live("click", function () { + var toggle = $(this); + var ignored = toggle.hasClass('ignored'); + + if (ignored) { + toggle.removeClass('ignored'); + toggle.attr('src', notIgnoredImage); + } + + else { + toggle.addClass('ignored'); + toggle.attr('src', ignoredImage); + } + + if (toggle.hasClass('ignoredEpisodesMaster')) { + var seasonNumber = toggle.attr('id').replace('master_', ''); + + toggleChildren(seasonNumber, ignored); + } +}); + +function toggleChildren(seasonNumber, ignored) { + var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber); + + if (!ignored) { + ignoreEpisodes.each(function (index) { + $(this).addClass('ignored'); + $(this).attr('src', ignoredImage); + }); + } + + else { + ignoreEpisodes.each(function (index) { + $(this).removeClass('ignored'); + $(this).attr('src', notIgnoredImage); + }); + } +} + +function grid_rowBound(e) { + var dataItem = e.dataItem; + var ignored = dataItem.Ignored; + var episodeId = dataItem.EpisodeId; + + var ignoredIcon = $('#' + episodeId); + + if (ignored) { + ignoredIcon.attr('src', ignoredImage); + } + + else { + ignoredIcon.attr('src', notIgnoredImage); + ignoredIcon.removeClass('ignored'); + } +} + +function grid_dataBound(e) { + var id = $(this).attr('id'); + var seasonNumber = id.replace('seasons_', ''); + var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber); + var master = $('#master_' + seasonNumber); + var count = ignoreEpisodes.length; + var ignoredCount = 0; + + ignoreEpisodes.each(function (index) { + if ($(this).hasClass('ignored')) { + ignoredCount++; + } + }); + + if (ignoredCount == count) { + master.attr('src', ignoredImage); + master.addClass('ignored'); + } + + else { + master.attr('src', notIgnoredImage); + master.removeClass('ignored'); + } +} \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index 76b412db7..21d1ae8aa 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -4,6 +4,26 @@ @section TitleContent{ @Model.Title } + + + + + @section ActionMenu{ @{Html.Telerik().Menu().Name("SeriesMenu").Items(items => { @@ -50,11 +70,11 @@ .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => { - columns.Bound(o => o.EpisodeId) + columns.Bound(o => o.Ignored) + .Title("") .ClientTemplate( - "") - .Title("") - .Width(1) + "") + .Width(20) .HtmlAttributes(new { style = "text-align:center" }); columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); @@ -68,7 +88,7 @@ "'); return false;\">Rename"); }) .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
<#= Path #>
")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false)) .Footer(true) .DataBinding( d => @@ -78,12 +98,16 @@ c => c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season }) .ButtonType(GridButtonType.Text)) + .ClientEvents(clientEvents => + { + clientEvents.OnRowDataBound("grid_rowBound"); + clientEvents.OnDataBound("grid_dataBound"); + }) .Render();} } @if (Model.Seasons.Any(s => s == 0)) { -

Specials

@@ -92,11 +116,11 @@ .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => { - columns.Bound(o => o.EpisodeId) + columns.Bound(o => o.Ignored) + .Title("") .ClientTemplate( - "") - .Title("") - .Width(1) + "") + .Width(20) .HtmlAttributes(new { style = "text-align:center" }); columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); @@ -106,7 +130,7 @@ columns.Bound(c => c.Status).Width(10); }) .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
<#= Path #>
")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false)) .Footer(true) .DataBinding( d => @@ -134,6 +158,8 @@ } }); } + + } diff --git a/NzbDrone.Web/Views/Settings/Test.cshtml b/NzbDrone.Web/Views/Settings/Test.cshtml index 27792a291..03660916e 100644 --- a/NzbDrone.Web/Views/Settings/Test.cshtml +++ b/NzbDrone.Web/Views/Settings/Test.cshtml @@ -1,94 +1,20 @@ - + - - - - - - - -
- - - \ No newline at end of file