From fdfd0a21539bb9b87daba3e5d59fa36e4a5266be Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 1 Jun 2011 20:36:30 -0700 Subject: [PATCH] Added Episodes of Episodes Total progress bar to Series Grid. --- NzbDrone.Web/Controllers/SeriesController.cs | 33 +++--- NzbDrone.Web/Models/SeriesModel.cs | 2 + NzbDrone.Web/NzbDrone.Web.csproj | 2 +- NzbDrone.Web/Views/Series/Index.cshtml | 80 ++++++++++++- NzbDrone.Web/Views/Settings/Test.cshtml | 113 +++++++++++-------- 5 files changed, 166 insertions(+), 64 deletions(-) diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 0d78d8f00..be9ef56d2 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -235,20 +235,27 @@ private List GetSeriesModels(List seriesInDb) { var series = new List(); - seriesInDb.ForEach(s => series.Add(new SeriesModel + foreach (var s in seriesInDb) { - SeriesId = s.SeriesId, - Title = s.Title, - AirsDayOfWeek = s.AirsDayOfWeek.ToString(), - Monitored = s.Monitored, - Overview = s.Overview, - Path = s.Path, - QualityProfileId = s.QualityProfileId, - QualityProfileName = s.QualityProfile.Name, - SeasonsCount = s.Seasons.Where(x => x.SeasonNumber > 0).Count(), - SeasonFolder = s.SeasonFolder, - Status = s.Status - })); + var episodesTotal = s.Episodes; + + series.Add(new SeriesModel + { + SeriesId = s.SeriesId, + Title = s.Title, + AirsDayOfWeek = s.AirsDayOfWeek.ToString(), + Monitored = s.Monitored, + Overview = s.Overview, + Path = s.Path, + QualityProfileId = s.QualityProfileId, + QualityProfileName = s.QualityProfile.Name, + SeasonsCount = s.Seasons.Where(x => x.SeasonNumber > 0).Count(), + SeasonFolder = s.SeasonFolder, + Status = s.Status, + Episodes = episodesTotal.Where(e => e.EpisodeFileId != 0).Count(), + EpisodeTotal = episodesTotal.Count() + }); + } return series; } diff --git a/NzbDrone.Web/Models/SeriesModel.cs b/NzbDrone.Web/Models/SeriesModel.cs index afd894856..d2b03473e 100644 --- a/NzbDrone.Web/Models/SeriesModel.cs +++ b/NzbDrone.Web/Models/SeriesModel.cs @@ -18,6 +18,8 @@ public class SeriesModel public string AirsDayOfWeek { get; set; } public string QualityProfileName { get; set; } public string Overview { get; set; } + public int Episodes { get; set; } + public int EpisodeTotal { get; set; } //View & Edit [DisplayName("Path")] diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 09c9ed2bf..159cf426d 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -640,7 +640,7 @@ - + diff --git a/NzbDrone.Web/Views/Series/Index.cshtml b/NzbDrone.Web/Views/Series/Index.cshtml index 5dea9dc03..6fd46c996 100644 --- a/NzbDrone.Web/Views/Series/Index.cshtml +++ b/NzbDrone.Web/Views/Series/Index.cshtml @@ -6,6 +6,57 @@ Series } + + + + @section ActionMenu{ @{Html.RenderPartial("SubMenu");} } @@ -30,6 +81,13 @@ columns.Bound(o => o.QualityProfileName).Title("Quality"); columns.Bound(o => o.Status); columns.Bound(o => o.AirsDayOfWeek); + columns.Bound(o => o.Episodes).Title("Episodes").Width(125) + .ClientTemplate("
\" class=\"progressbar\">" + + "
" + + "
" + + "" + + "
" + + "
"); columns.Bound(o => o.Path); columns.Command(commands => { @@ -44,6 +102,7 @@ .ClientEvents(clientEvents => { clientEvents.OnEdit("grid_edit"); clientEvents.OnDataBinding("grid_bind"); clientEvents.OnDataBound("grid_bound"); + clientEvents.OnRowDataBound("grid_rowBound"); }) .Render();} Loading Loading... @@ -54,11 +113,22 @@ var windowElement; function grid_edit(args) { - $(args.form) - .closest(".t-window") - .data("tWindow") - .center(); - } + $(args.form) + .closest(".t-window") + .data("tWindow") + .center(); + } + + function grid_rowBound(e) { + var data = e.dataItem; + + var seriesId = data.SeriesId; + var episodes = data.Episodes; + var episodeTotal = data.EpisodeTotal; + + $("#progressbar_" + seriesId).episodeProgress(episodes, episodeTotal); + } + function openSeasonEditor(seriesId, seriesName) { windowElement = null; diff --git a/NzbDrone.Web/Views/Settings/Test.cshtml b/NzbDrone.Web/Views/Settings/Test.cshtml index e2ec5cac0..e5d1073df 100644 --- a/NzbDrone.Web/Views/Settings/Test.cshtml +++ b/NzbDrone.Web/Views/Settings/Test.cshtml @@ -1,49 +1,72 @@ - -
-SDTV -
+
+
+
+ +
+
-
-DVD -
- -
-HDTV -
- -
-WEBDL -
- -
-Bluray720p -
- -
-Bluray1080p -
- -
- -@Html.TextBox("result", "") - - \ No newline at end of file