From ca5888160dd5f05b315cb8968f637ea598f461f4 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 8 Feb 2012 17:05:16 -0800 Subject: [PATCH] Removed some extraneous code. Missing grid is now a Datatable grid. --- .../RegisterDatatablesModelBinder.cs | 14 --- NzbDrone.Web/Controllers/HistoryController.cs | 1 - NzbDrone.Web/Controllers/MissingController.cs | 24 +++- NzbDrone.Web/Models/MissingEpisodeModel.cs | 6 +- NzbDrone.Web/NzbDrone.Web.csproj | 7 -- NzbDrone.Web/Views/History/Index.cshtml | 44 +++---- NzbDrone.Web/Views/Missing/Index.cshtml | 109 +++++++++++------- 7 files changed, 114 insertions(+), 91 deletions(-) delete mode 100644 NzbDrone.Web/App_Start/RegisterDatatablesModelBinder.cs diff --git a/NzbDrone.Web/App_Start/RegisterDatatablesModelBinder.cs b/NzbDrone.Web/App_Start/RegisterDatatablesModelBinder.cs deleted file mode 100644 index abf48c1e8..000000000 --- a/NzbDrone.Web/App_Start/RegisterDatatablesModelBinder.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Web.Mvc; -using System.Web.WebPages; -//using RazorGenerator.Mvc; - -[assembly: WebActivator.PreApplicationStartMethod(typeof(NzbDrone.Web.App_Start.RegisterDatatablesModelBinder), "Start")] - -namespace NzbDrone.Web.App_Start { - public static class RegisterDatatablesModelBinder { - public static void Start() { - if (!ModelBinders.Binders.ContainsKey(typeof(Mvc.JQuery.Datatables.DataTablesParam))) - ModelBinders.Binders.Add(typeof(Mvc.JQuery.Datatables.DataTablesParam), new Mvc.JQuery.Datatables.DataTablesModelBinder()); - } - } -} diff --git a/NzbDrone.Web/Controllers/HistoryController.cs b/NzbDrone.Web/Controllers/HistoryController.cs index 9c1b80a68..a822e8c2b 100644 --- a/NzbDrone.Web/Controllers/HistoryController.cs +++ b/NzbDrone.Web/Controllers/HistoryController.cs @@ -1,7 +1,6 @@ using System.Linq; using System.Web.Mvc; using System.Web.Script.Serialization; -using Mvc.JQuery.Datatables; using NzbDrone.Core.Jobs; using NzbDrone.Core.Providers; using NzbDrone.Web.Models; diff --git a/NzbDrone.Web/Controllers/MissingController.cs b/NzbDrone.Web/Controllers/MissingController.cs index ffae561c4..5bb3a4037 100644 --- a/NzbDrone.Web/Controllers/MissingController.cs +++ b/NzbDrone.Web/Controllers/MissingController.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; +using System.Web.Script.Serialization; using NzbDrone.Core; using NzbDrone.Core.Providers; using NzbDrone.Web.Models; @@ -21,7 +22,23 @@ namespace NzbDrone.Web.Controllers public ActionResult Index() { - return View(); + var missingEpisodes = _episodeProvider.EpisodesWithoutFiles(false); + + var missing = missingEpisodes.Select(e => new MissingEpisodeModel + { + EpisodeId = e.EpisodeId, + SeriesId = e.SeriesId, + EpisodeNumbering = string.Format("{0}x{1:00}", e.SeasonNumber, e.EpisodeNumber), + EpisodeTitle = e.Title, + Overview = e.Overview, + SeriesTitle = e.Series.Title, + AirDate = e.AirDate.Value.ToString(), + AirDateString = e.AirDate.Value.ToBestDateString() + }); + + var serialized = new JavaScriptSerializer().Serialize(missing); + + return View((object)serialized); } [GridAction] @@ -33,12 +50,11 @@ namespace NzbDrone.Web.Controllers { EpisodeId = e.EpisodeId, SeriesId = e.SeriesId, - SeasonNumber = e.SeasonNumber, - EpisodeNumber = e.EpisodeNumber, + EpisodeNumbering = string.Format("{0}x{1:00}", e.SeasonNumber, e.EpisodeNumber), EpisodeTitle = e.Title, Overview = e.Overview, SeriesTitle = e.Series.Title, - AirDate = e.AirDate.Value, + AirDate = e.AirDate.Value.ToString(), AirDateString = e.AirDate.Value.ToBestDateString() }); diff --git a/NzbDrone.Web/Models/MissingEpisodeModel.cs b/NzbDrone.Web/Models/MissingEpisodeModel.cs index 4a949b372..d0790e281 100644 --- a/NzbDrone.Web/Models/MissingEpisodeModel.cs +++ b/NzbDrone.Web/Models/MissingEpisodeModel.cs @@ -9,11 +9,11 @@ namespace NzbDrone.Web.Models public int SeriesId { get; set; } public int EpisodeId { get; set; } public string SeriesTitle { get; set; } - public int SeasonNumber { get; set; } - public int EpisodeNumber { get; set; } + public string EpisodeNumbering { get; set; } public string EpisodeTitle { get; set; } - public DateTime AirDate { get; set; } + public string AirDate { get; set; } public string AirDateString { get; set; } public string Overview { get; set; } + public string Details { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 139890885..b1fb325d2 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -53,9 +53,6 @@ True ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - ..\packages\Mvc.JQuery.Datatables.1.1.47\lib\net40\Mvc.JQuery.Datatables.dll - ..\packages\MiniProfiler.1.9\lib\net40\MvcMiniProfiler.dll @@ -273,7 +270,6 @@ - @@ -301,7 +297,6 @@ - @@ -489,7 +484,6 @@ - @@ -686,7 +680,6 @@ - diff --git a/NzbDrone.Web/Views/History/Index.cshtml b/NzbDrone.Web/Views/History/Index.cshtml index 9ea805a4d..dcfbfebfa 100644 --- a/NzbDrone.Web/Views/History/Index.cshtml +++ b/NzbDrone.Web/Views/History/Index.cshtml @@ -15,30 +15,30 @@ }
- - - - - - - - - +
Series TitleEpisodeEpisode TitleQualityGrabbed On
+ + + + + + + + - @*Commands Column*@ - + @*Commands Column*@ + - @*Details Column*@ - - - - - @*@foreach(var history in Model) - { - Html.RenderPartial("History", history); - }*@ - -
Series TitleEpisodeEpisode TitleQualityGrabbed OnActionsActionsDetails
+ @*Details Column*@ + Details + + + + @*@foreach(var history in Model) + { + Html.RenderPartial("History", history); + }*@ + +
\ No newline at end of file