diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 8c015b7c6..21f722bc0 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -185,10 +185,17 @@ namespace NzbDrone.Web.Controllers foreach (var season in episodes.Select(s => s.SeasonNumber).Distinct()) { + var episodesInSeason = episodes.Where(e => e.SeasonNumber == season).ToList(); + var commonStatusList = episodes.Select(s => s.Status).Distinct().ToList(); + var commonStatus = commonStatusList.Count > 1 ? "Missing" : commonStatusList.First().ToString(); + seasons.Add(new SeasonModel { - SeasonNumber = season, - Episodes = GetEpisodeModels(episodes.Where(e => e.SeasonNumber == season).ToList()).OrderByDescending(e=> e.EpisodeNumber).ToList() + SeriesId = seriesId, + SeasonNumber = season, + Episodes = GetEpisodeModels(episodesInSeason).OrderByDescending(e=> e.EpisodeNumber).ToList(), + AnyWanted = episodesInSeason.Any(e => !e.Ignored), + CommonStatus = commonStatus }); } diff --git a/NzbDrone.Web/Models/SeasonModel.cs b/NzbDrone.Web/Models/SeasonModel.cs index d49845fb5..bd1a80f14 100644 --- a/NzbDrone.Web/Models/SeasonModel.cs +++ b/NzbDrone.Web/Models/SeasonModel.cs @@ -9,7 +9,10 @@ namespace NzbDrone.Web.Models { public class SeasonModel { + public int SeriesId { get; set; } public int SeasonNumber { get; set; } public List Episodes { get; set; } + public bool AnyWanted { get; set; } + public string CommonStatus { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/Scripts/NzbDrone/seriesDetails.js b/NzbDrone.Web/Scripts/NzbDrone/seriesDetails.js index e6e610efa..8048ed5fa 100644 --- a/NzbDrone.Web/Scripts/NzbDrone/seriesDetails.js +++ b/NzbDrone.Web/Scripts/NzbDrone/seriesDetails.js @@ -16,11 +16,13 @@ $(".ignoreEpisode").live("click", function () { if (ignored) { toggle.removeClass('ignored'); toggle.attr('src', notIgnoredImage); + toggleCellColour(toggle, false); } else { toggle.addClass('ignored'); toggle.attr('src', ignoredImage); + toggleCellColour(toggle, true); } var seasonNumber = 0; @@ -29,7 +31,6 @@ $(".ignoreEpisode").live("click", function () { ignored = !ignored; if (toggle.hasClass('ignoredEpisodesMaster')) { - //seasonNumber = toggle.attr('id').replace('master_', ''); seasonNumber = toggle.attr('class').split(/\s+/)[2].replace('ignoreSeason_', ''); toggleChildren(seasonNumber, ignored); @@ -53,6 +54,7 @@ function toggleChildren(seasonNumber, ignored) { ignoreEpisodes.each(function (index) { $(this).addClass('ignored'); $(this).attr('src', ignoredImage); + toggleCellColour($(this), true); }); } @@ -60,12 +62,14 @@ function toggleChildren(seasonNumber, ignored) { ignoreEpisodes.each(function (index) { $(this).removeClass('ignored'); $(this).attr('src', notIgnoredImage); + + toggleCellColour($(this), false); }); } } function toggleMaster(seasonNumber) { - //Toggles all master toggles when the childen changes or the grid is loaded + //Toggles all master toggles when the childen changes var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber); var ignoredCount = ignoreEpisodes.filter('.ignored').length; @@ -103,36 +107,19 @@ function toggleMasters(seasonNumber, ignored) { } } -//Functions called by the Telerik Season Grid -function grid_rowBound(e) { - var dataItem = e.dataItem; - var row = e.row; - var ignored = dataItem.Ignored; - var episodeId = dataItem.EpisodeId; - - var ignoredIcon = $('#' + episodeId); - +function toggleCellColour(toggle, ignored) { if (ignored) { - ignoredIcon.attr('src', ignoredImage); + toggle.parent('td').addClass('episodeIgnored'); + toggle.parent('td').removeClass('episodeMissing'); } - + else { - ignoredIcon.attr('src', notIgnoredImage); - ignoredIcon.removeClass('ignored'); - } + toggle.parent('td').removeClass('episodeIgnored'); - if (seriesId == 0) - seriesId = dataItem.SeriesId; - - highlightRow(e); -} - -function grid_dataBound(e) { - var id = $(this).attr('id'); - var seasonNumber = id.replace('seasons_', ''); - - toggleMaster(seasonNumber); - setMasterStatus(this); + //check to see if episode is missing + if (toggle.parent('td').children('.statusImage').hasClass('status-Missing')) + toggle.parent('td').addClass('episodeMissing'); + } } //Episode Ignore Saving @@ -156,33 +143,4 @@ function saveEpisodeIgnore(episodeId, ignored) { alert("Sorry! We could save the ignore settings for Episode: " + episodeId + " at this time. " + error); } }); -} - -//Set master status to match children -function setMasterStatus(grid) { - //Get children of this grid - var masterStatus = $(grid).find('.statusImageMaster'); - var statuses = $(grid).find('.statusImage').filter(':not(.statusImageMaster)'); - var episodeCount = statuses.length; - - //Get missing count - if (statuses.filter('.status-Missing').length == episodeCount) { - //Leave as is (default is missing) - return; - } - - if (statuses.filter('.status-NotAired').length == episodeCount) { - masterStatus.attr('src', notAiredImage); - return; - } - - if (statuses.filter('.status-Ready').length == episodeCount) { - masterStatus.attr('src', readyImage); - return; - } - - if (statuses.filter('.status-Downloading').length == episodeCount) { - masterStatus.attr('src', downloadingImage); - return; - } } \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index a41486448..ef33383d8 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -68,7 +68,6 @@ border-style: none; border-color: white; border-collapse: collapse; - background-color: white; } .seriesTable th { @@ -86,7 +85,6 @@ padding: 0 0.6em; border-style: inset; border-color: #EEEEEE; - background-color: white; padding-left: 7px; } @@ -110,12 +108,14 @@ Banner
- @foreach (var season in Model.Seasons.Select(s => s.SeasonNumber)) + @foreach (var season in Model.Seasons.OrderBy(s => s.SeasonNumber)) { - var ignoreSeason = "ignoreSeason_" + season; + var ignoreSeason = "ignoreSeason_" + season.SeasonNumber;
- - @(season == 0 ? "Specials" : "Season " + season) + + @(season.SeasonNumber == 0 ? "Specials" : "Season " + season.SeasonNumber)
}
diff --git a/NzbDrone.Web/Views/Series/Episode.cshtml b/NzbDrone.Web/Views/Series/Episode.cshtml index 583e6e10a..6413bc538 100644 --- a/NzbDrone.Web/Views/Series/Episode.cshtml +++ b/NzbDrone.Web/Views/Series/Episode.cshtml @@ -7,9 +7,23 @@ @Model.AirDate @Model.Quality + @{ + string cellColourClass = String.Empty; + + if (Model.Status == "Missing") + { + cellColourClass = "episodeMissing"; + } + + if (Model.Ignored) + { + cellColourClass = "episodeIgnored"; + } + } + @*Commands Column*@ - - + + @Model.Status @Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for episode", @class = "searchImage" }, "Search", "Episode", new { EpisodeId = Model.EpisodeId }, null, null) @Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename episode", @class = "renameImage" }, "Rename", "Episode", new { EpisodeFileId = Model.EpisodeFileId }, null, null) diff --git a/NzbDrone.Web/Views/Series/Season.cshtml b/NzbDrone.Web/Views/Series/Season.cshtml index 9aae75cac..ae6f4d071 100644 --- a/NzbDrone.Web/Views/Series/Season.cshtml +++ b/NzbDrone.Web/Views/Series/Season.cshtml @@ -6,19 +6,25 @@ + + + + + + + - + - - + + @*Commands Column*@ -
Episode #Episode # TitleAir DateQualityAir DateQuality - Commands - @* - Status - Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for all episodes in this season", @class = "searchImage searchImageMaster" }, "SearchSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null) - Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename all episodes in this season", @class = "renameImage renameImageMaster" }, "RenameSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null))*@ + + + Status + @Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for all episodes in this season", @class = "searchImage searchImageMaster" }, "SearchSeason", "Episode", new { SeriesId = Model.SeriesId, SeasonNumber = Model.SeasonNumber }, null, null) + @Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename all episodes in this season", @class = "renameImage renameImageMaster" }, "RenameSeason", "Episode", new { SeriesId = Model.SeriesId, SeasonNumber = Model.SeasonNumber }, null, null)