diff --git a/NzbDrone.Web/App_Start/DataTablesMvc.cs b/NzbDrone.Web/App_Start/DataTablesMvc.cs new file mode 100644 index 000000000..6ac4a3b4f --- /dev/null +++ b/NzbDrone.Web/App_Start/DataTablesMvc.cs @@ -0,0 +1,17 @@ +using DataTables.Mvc.Core.Helpers; +using DataTables.Mvc.Core.Models; +using System.Web.Mvc; + +[assembly: WebActivator.PreApplicationStartMethod(typeof(NzbDrone.Web.App_Start.DataTablesModelBinderActivator), "Start")] + +namespace NzbDrone.Web.App_Start +{ + public static class DataTablesModelBinderActivator + { + public static void Start() + { + if (!ModelBinders.Binders.ContainsKey(typeof(DataTablesParams))) + ModelBinders.Binders.Add(typeof(DataTablesParams), new DataTablesModelBinder()); + } + } +} \ No newline at end of file diff --git a/NzbDrone.Web/App_Start/RegisterDataTablesModelBinder.cs b/NzbDrone.Web/App_Start/RegisterDataTablesModelBinder.cs deleted file mode 100644 index cd2d24690..000000000 --- a/NzbDrone.Web/App_Start/RegisterDataTablesModelBinder.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Web.Mvc; -using System.Web.WebPages; -using NzbDrone.Web.Helpers; -using NzbDrone.Web.Models; - -[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(DataTablesParams))) - ModelBinders.Binders.Add(typeof(DataTablesParams), new DataTablesModelBinder()); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Web/Content/Images/logo_small.png b/NzbDrone.Web/Content/Images/logo_small.png new file mode 100644 index 000000000..574bad21a Binary files /dev/null and b/NzbDrone.Web/Content/Images/logo_small.png differ diff --git a/NzbDrone.Web/Controllers/LogController.cs b/NzbDrone.Web/Controllers/LogController.cs index bd414087a..60f9668de 100644 --- a/NzbDrone.Web/Controllers/LogController.cs +++ b/NzbDrone.Web/Controllers/LogController.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Linq.Dynamic; using System.Text; using System.Web.Mvc; +using DataTables.Mvc.Core.Models; using NzbDrone.Common; using NzbDrone.Core.Instrumentation; using NzbDrone.Web.Models; diff --git a/NzbDrone.Web/Helpers/DataTablesModelBinder.cs b/NzbDrone.Web/Helpers/DataTablesModelBinder.cs deleted file mode 100644 index 77b79f620..000000000 --- a/NzbDrone.Web/Helpers/DataTablesModelBinder.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using NzbDrone.Web.Models; - -namespace NzbDrone.Web.Helpers -{ - /// - /// Model binder for datatables.js parameters a la http://geeksprogramando.blogspot.com/2011/02/jquery-datatables-plug-in-with-asp-mvc.html - /// - public class DataTablesModelBinder : IModelBinder - { - public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) - { - DataTablesParams obj = new DataTablesParams(); - var request = controllerContext.HttpContext.Request.Params; - - obj.iDisplayStart = Convert.ToInt32(request["iDisplayStart"]); - obj.iDisplayLength = Convert.ToInt32(request["iDisplayLength"]); - obj.iColumns = Convert.ToInt32(request["iColumns"]); - obj.sSearch = request["sSearch"]; - obj.bEscapeRegex = Convert.ToBoolean(request["bEscapeRegex"]); - obj.iSortingCols = Convert.ToInt32(request["iSortingCols"]); - obj.sEcho = int.Parse(request["sEcho"]); - - for (int i = 0; i < obj.iColumns; i++) - { - obj.bSortable.Add(Convert.ToBoolean(request["bSortable_" + i])); - obj.bSearchable.Add(Convert.ToBoolean(request["bSearchable_" + i])); - obj.sSearchColumns.Add(request["sSearch_" + i]); - obj.bEscapeRegexColumns.Add(Convert.ToBoolean(request["bEscapeRegex_" + i])); - obj.iSortCol.Add(Convert.ToInt32(request["iSortCol_" + i])); - obj.sSortDir.Add(request["sSortDir_" + i]); - } - return obj; - } - } -} \ No newline at end of file diff --git a/NzbDrone.Web/Models/DataTablesParams.cs b/NzbDrone.Web/Models/DataTablesParams.cs deleted file mode 100644 index 021ff7924..000000000 --- a/NzbDrone.Web/Models/DataTablesParams.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace NzbDrone.Web.Models -{ - public class DataTablesParams - { - public int iDisplayStart { get; set; } - public int iDisplayLength { get; set; } - public int iColumns { get; set; } - public string sSearch { get; set; } - public bool bEscapeRegex { get; set; } - public int iSortingCols { get; set; } - public int sEcho { get; set; } - public List bSortable { get; set; } - public List bSearchable { get; set; } - public List sSearchColumns { get; set; } - public List iSortCol { get; set; } - public List sSortDir { get; set; } - public List bEscapeRegexColumns { get; set; } - - public DataTablesParams() - { - bSortable = new List(); - bSearchable = new List(); - sSearchColumns = new List(); - iSortCol = new List(); - sSortDir = new List(); - bEscapeRegexColumns = new List(); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 92dac587e..1d77ee308 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -51,6 +51,9 @@ x86 + + ..\packages\DataTables.Mvc.0.1.0.54\lib\DataTables.Mvc.Core.dll + ..\packages\DynamicQuery.1.0\lib\35\Dynamic.dll @@ -137,6 +140,7 @@ + @@ -204,7 +208,6 @@ - @@ -224,7 +227,6 @@ Global.asax - @@ -232,7 +234,6 @@ - diff --git a/NzbDrone.Web/packages.config b/NzbDrone.Web/packages.config index e93e28704..1427f9d68 100644 --- a/NzbDrone.Web/packages.config +++ b/NzbDrone.Web/packages.config @@ -1,5 +1,6 @@  + diff --git a/packages/DataTables.Mvc.0.1.0.54/Content/App_Start/DataTablesMvc.cs.pp b/packages/DataTables.Mvc.0.1.0.54/Content/App_Start/DataTablesMvc.cs.pp new file mode 100644 index 000000000..abaaa76f4 --- /dev/null +++ b/packages/DataTables.Mvc.0.1.0.54/Content/App_Start/DataTablesMvc.cs.pp @@ -0,0 +1,17 @@ +using DataTables.Mvc.Core.Helpers; +using DataTables.Mvc.Core.Models; +using System.Web.Mvc; + +[assembly: WebActivator.PreApplicationStartMethod(typeof($rootnamespace$.App_Start.DataTablesModelBinderActivator), "Start")] + +namespace $rootnamespace$.App_Start +{ + public static class DataTablesModelBinderActivator + { + public static void Start() + { + if (!ModelBinders.Binders.ContainsKey(typeof(DataTablesParams))) + ModelBinders.Binders.Add(typeof(DataTablesParams), new DataTablesModelBinder()); + } + } +} \ No newline at end of file diff --git a/packages/DataTables.Mvc.0.1.0.54/DataTables.Mvc.0.1.0.54.nupkg b/packages/DataTables.Mvc.0.1.0.54/DataTables.Mvc.0.1.0.54.nupkg new file mode 100644 index 000000000..28848589e Binary files /dev/null and b/packages/DataTables.Mvc.0.1.0.54/DataTables.Mvc.0.1.0.54.nupkg differ diff --git a/packages/DataTables.Mvc.0.1.0.54/lib/DataTables.Mvc.Core.dll b/packages/DataTables.Mvc.0.1.0.54/lib/DataTables.Mvc.Core.dll new file mode 100644 index 000000000..c6457bd9b Binary files /dev/null and b/packages/DataTables.Mvc.0.1.0.54/lib/DataTables.Mvc.Core.dll differ diff --git a/packages/DataTables.Mvc.0.1.0.54/tools/install.ps1 b/packages/DataTables.Mvc.0.1.0.54/tools/install.ps1 new file mode 100644 index 000000000..7e1f5357f --- /dev/null +++ b/packages/DataTables.Mvc.0.1.0.54/tools/install.ps1 @@ -0,0 +1,5 @@ +param($installPath, $toolsPath, $package, $project) + +$path = [System.IO.Path] +$appstart = $path::Combine($path::GetDirectoryName($project.FileName), "App_Start\DataTablesMvc.cs") +$DTE.ItemOperations.OpenFile($appstart) \ No newline at end of file