From 56da8302963f95d1fb4514efefcb55c3b860e06a Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 19 Aug 2011 20:02:47 -0700 Subject: [PATCH] Added a second "master" toggle to ignoreSeason on Series/Details at the top of the page. --- NzbDrone.Web/Scripts/seriesDetails.js | 58 +++++----- NzbDrone.Web/Views/Series/Details.cshtml | 130 ++++++++++++++++------- NzbDrone.Web/Views/Settings/Test.cshtml | 10 +- 3 files changed, 136 insertions(+), 62 deletions(-) diff --git a/NzbDrone.Web/Scripts/seriesDetails.js b/NzbDrone.Web/Scripts/seriesDetails.js index 36544f364..28a13be6c 100644 --- a/NzbDrone.Web/Scripts/seriesDetails.js +++ b/NzbDrone.Web/Scripts/seriesDetails.js @@ -19,14 +19,16 @@ $(".ignoreEpisode").live("click", function () { } var seasonNumber = 0; - + //Flip the ignored to the new state (We want the new value moving forward) ignored = !ignored; if (toggle.hasClass('ignoredEpisodesMaster')) { - seasonNumber = toggle.attr('id').replace('master_', ''); + //seasonNumber = toggle.attr('id').replace('master_', ''); + seasonNumber = toggle.attr('class').split(/\s+/)[2].replace('ignoreSeason_', ''); toggleChildren(seasonNumber, ignored); + toggleMasters(seasonNumber, ignored); saveSeasonIgnore(seasonNumber, ignored); } @@ -60,16 +62,36 @@ function toggleChildren(seasonNumber, ignored) { function toggleMaster(seasonNumber) { var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber); var ignoredCount = ignoreEpisodes.filter('.ignored').length; - var master = $('#master_' + seasonNumber); - - if (ignoreEpisodes.length == ignoredCount) { - master.attr('src', ignoredImage); - master.addClass('ignored'); + var masters = $('.ignoreSeason_' + seasonNumber); + + masters.each(function (index) { + if (ignoreEpisodes.length == ignoredCount) { + $(this).attr('src', ignoredImage); + $(this).addClass('ignored'); + } + + else { + $(this).attr('src', notIgnoredImage); + $(this).removeClass('ignored'); + } + }); +} + +function toggleMasters(seasonNumber, ignored) { + var masters = $('.ignoreSeason_' + seasonNumber); + + if (ignored) { + masters.each(function (index) { + $(this).addClass('ignored'); + $(this).attr('src', ignoredImage); + }); } else { - master.attr('src', notIgnoredImage); - master.removeClass('ignored'); + masters.each(function (index) { + $(this).removeClass('ignored'); + $(this).attr('src', notIgnoredImage); + }); } } @@ -89,28 +111,16 @@ function grid_rowBound(e) { ignoredIcon.attr('src', notIgnoredImage); ignoredIcon.removeClass('ignored'); } - + if (seriesId == 0) - seriesId = dataItem.SeriesId + seriesId = dataItem.SeriesId; } 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 = ignoreEpisodes.filter('.ignored').length; - - if (ignoredCount == count) { - master.attr('src', ignoredImage); - master.addClass('ignored'); - } - else { - master.attr('src', notIgnoredImage); - master.removeClass('ignored'); - } + toggleMaster(seasonNumber); } function saveSeasonIgnore(seasonNumber, ignored) { diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index 4405cfd21..81dfa4e0c 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -22,6 +22,45 @@ padding-left: 18px; padding-right: -18px; } + + .seasonToggleTopGroup + { + overflow: hidden; + width: 50%; + } + + .seasonToggleTop + { + @*float: left; + border-width: 1px; + border-style: solid; + border-color: grey; + margin: 5px; + padding: 3px; + padding-top: 0px; + padding-bottom: 0px;*@ + + background-color: #F1EDED; + background-position: 5px center; + background-repeat: no-repeat; + display: inline-block; + font-size: 15px; + margin: 2px; + padding: 2px 5px; + width: 95px; + } + + .seasonToggleLabel + { + margin-left: 5px; + } + + .seasonToggleTop .ignoredEpisodesMaster + { + padding-left: 0px; + padding-right: 0px; + margin-bottom: -4px; + } @section ActionMenu{ @@ -33,6 +72,18 @@ } @section MainContent{ + +
+ @foreach (var season in Model.Seasons) + { + var ignoreSeason = "ignoreSeason_" + season; +
+ + @(season == 0 ? "Specials" : "Season " + season) +
+ } +
+ @foreach (var season in Model.Seasons.Where(s => s > 0).Reverse()) {

@@ -42,24 +93,24 @@ Html.Telerik().Grid().Name("seasons_" + season) .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => - { - columns.Bound(o => o.Ignored) - .Title("") - .ClientTemplate( - "") - .Width(20) - .HtmlAttributes(new { style = "text-align:center" }); + { + columns.Bound(o => o.Ignored) + .Title("") + .ClientTemplate( + "") + .Width(20) + .HtmlAttributes(new { style = "text-align:center" }); - columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); - columns.Bound(c => c.Title).Title("Title"); - columns.Bound(c => c.AirDate).Width(0); - columns.Bound(c => c.Quality).Width(0); - columns.Bound(c => c.Status).Width(0); - columns.Bound(o => o.EpisodeId).Title("") - .ClientTemplate("'); return false;\">Search" - + " | " + - "'); return false;\">Rename"); - }) + columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); + columns.Bound(c => c.Title).Title("Title"); + columns.Bound(c => c.AirDate).Width(0); + columns.Bound(c => c.Quality).Width(0); + columns.Bound(c => c.Status).Width(0); + columns.Bound(o => o.EpisodeId).Title("") + .ClientTemplate("'); return false;\">Search" + + " | " + + "'); return false;\">Rename"); + }) .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
<#= Path #>
")) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false)) .Footer(true) @@ -72,10 +123,10 @@ c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season }) .ButtonType(GridButtonType.Text)) .ClientEvents(clientEvents => - { - clientEvents.OnRowDataBound("grid_rowBound"); - clientEvents.OnDataBound("grid_dataBound"); - }) + { + clientEvents.OnRowDataBound("grid_rowBound"); + clientEvents.OnDataBound("grid_dataBound"); + }) .Render();} } @@ -85,31 +136,36 @@

Specials

- @{Html.Telerik().Grid().Name("seasons_specials") + @{Html.Telerik().Grid().Name("seasons_0") .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => - { - columns.Bound(o => o.Ignored) - .Title("") - .ClientTemplate( - "") - .Width(20) - .HtmlAttributes(new { style = "text-align:center" }); + { + columns.Bound(o => o.Ignored) + .Title("") + .ClientTemplate( + "") + .Width(20) + .HtmlAttributes(new { style = "text-align:center" }); - columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); - columns.Bound(c => c.Title).Title("Title").Width(10000); - columns.Bound(c => c.AirDate).Width(10); - columns.Bound(c => c.Quality).Width(10); - columns.Bound(c => c.Status).Width(10); - }) + columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); + columns.Bound(c => c.Title).Title("Title").Width(10000); + columns.Bound(c => c.AirDate).Width(10); + columns.Bound(c => c.Quality).Width(10); + 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(false)) .Footer(true) .DataBinding( d => d.Ajax().Select("_AjaxSeasonGrid", "Series", - new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", 0 } } - )).Render(); } + new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", 0 } })) + .ClientEvents(clientEvents => + { + clientEvents.OnRowDataBound("grid_rowBound"); + clientEvents.OnDataBound("grid_dataBound"); + }) + .Render(); }
} } diff --git a/NzbDrone.Web/Views/Settings/Test.cshtml b/NzbDrone.Web/Views/Settings/Test.cshtml index 5f282702b..6a68c3579 100644 --- a/NzbDrone.Web/Views/Settings/Test.cshtml +++ b/NzbDrone.Web/Views/Settings/Test.cshtml @@ -1 +1,9 @@ - \ No newline at end of file + + + \ No newline at end of file