From 854d66c1f53bc0bd3e0b32df247180d2f91104e2 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 6 Feb 2012 19:48:26 -0800 Subject: [PATCH] More grid work. Row partial views are now sent a bool set to true if it is an alternate row. --- NzbDrone.Web/Content/Grid.css | 11 ----------- NzbDrone.Web/Controllers/SeriesController.cs | 2 +- NzbDrone.Web/NzbDrone.Web.csproj | 3 --- NzbDrone.Web/Views/Series/Episode.cshtml | 4 ++-- NzbDrone.Web/Views/Series/Index.cshtml | 17 ++++++++++++++--- NzbDrone.Web/Views/Series/Season.cshtml | 14 ++++++++++++-- NzbDrone.Web/Views/Series/Series.cshtml | 4 ++-- 7 files changed, 31 insertions(+), 24 deletions(-) diff --git a/NzbDrone.Web/Content/Grid.css b/NzbDrone.Web/Content/Grid.css index c7ab3f8a2..7c8142c4a 100644 --- a/NzbDrone.Web/Content/Grid.css +++ b/NzbDrone.Web/Content/Grid.css @@ -65,17 +65,6 @@ background: #f0f5ff; } -/* -.seriesTable tr:nth-child(4n) -{ - background: #f0f5ff; -} - -.seriesTable tr:nth-child(4n+1) -{ - background: #f0f5ff; -}*/ - /* Episode Grid Row Colouring */ .episodeIgnored { diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 0fce77826..79e0c0f68 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -38,7 +38,7 @@ namespace NzbDrone.Web.Controllers public ActionResult Index() { - var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount()).OrderBy(o => SortHelper.SkipArticles(o.Title)); + var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount()).OrderBy(o => SortHelper.SkipArticles(o.Title)).ToList(); return View(series); } diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index a78396926..66b910a0d 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -555,9 +555,6 @@ - - - diff --git a/NzbDrone.Web/Views/Series/Episode.cshtml b/NzbDrone.Web/Views/Series/Episode.cshtml index 278ffb47b..d068b05cd 100644 --- a/NzbDrone.Web/Views/Series/Episode.cshtml +++ b/NzbDrone.Web/Views/Series/Episode.cshtml @@ -1,7 +1,7 @@ @using NzbDrone.Web.Helpers @model NzbDrone.Web.Models.EpisodeModel - + @Model.EpisodeNumber @Model.Title @Model.AirDate @@ -29,7 +29,7 @@ @Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename episode", @class = "renameImage" }, "Rename", "Episode", new { EpisodeFileId = Model.EpisodeFileId }, null, null) - + @Model.Overview
@Model.Path diff --git a/NzbDrone.Web/Views/Series/Index.cshtml b/NzbDrone.Web/Views/Series/Index.cshtml index f15e51bfd..df5de6990 100644 --- a/NzbDrone.Web/Views/Series/Index.cshtml +++ b/NzbDrone.Web/Views/Series/Index.cshtml @@ -1,7 +1,7 @@ @using NzbDrone.Common @using NzbDrone.Web.Helpers @using NzbDrone.Web.Models; -@model IEnumerable +@model List @{ViewBag.Title = "NzbDrone";} @section HeaderContent @@ -117,9 +117,20 @@ - @foreach (var series in Model) + + @for (int i = 0; i < Model.Count; i++) { - Html.RenderPartial("Series", series); + var series = Model[i]; + + if (i % 2 == 0) + { + Html.RenderPartial("Series", series); + } + + else + { + Html.RenderPartial("Series", series, new ViewDataDictionary { new KeyValuePair("AltRow", true) }); + } } diff --git a/NzbDrone.Web/Views/Series/Season.cshtml b/NzbDrone.Web/Views/Series/Season.cshtml index fc03cb8ac..2f1cd6fbb 100644 --- a/NzbDrone.Web/Views/Series/Season.cshtml +++ b/NzbDrone.Web/Views/Series/Season.cshtml @@ -27,8 +27,18 @@ @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) - @foreach (var episode in Model.Episodes) + @for (int i = 0; i < Model.Episodes.Count; i++) { - Html.RenderPartial("Episode", episode); + var episode = Model.Episodes[i]; + + if (i % 2 == 0) + { + Html.RenderPartial("Episode", episode); + } + + else + { + Html.RenderPartial("Episode", episode, new ViewDataDictionary { new KeyValuePair("AltRow", true) }); + } } \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/Series.cshtml b/NzbDrone.Web/Views/Series/Series.cshtml index 1a542c925..65fec4f6e 100644 --- a/NzbDrone.Web/Views/Series/Series.cshtml +++ b/NzbDrone.Web/Views/Series/Series.cshtml @@ -1,7 +1,7 @@ @using NzbDrone.Web.Helpers @model NzbDrone.Web.Models.SeriesModel - + @Html.ActionLink(Model.Title, "Details", "Series", new { seriesId = Model.SeriesId }, null) @Model.SeasonsCount @Model.QualityProfileName @@ -20,7 +20,7 @@ - + Airs Day of Week: @Model.AirsDayOfWeek
Overview: @Model.Overview