diff --git a/NzbDrone.Web/Content/Site.css b/NzbDrone.Web/Content/Site.css index 157a35e79..3d70c9020 100644 --- a/NzbDrone.Web/Content/Site.css +++ b/NzbDrone.Web/Content/Site.css @@ -190,14 +190,14 @@ hr /* Config Pages */ .config-section { - width: 650px; + width: 800px; height: 45px; display: block; } .config-group { - width: 300px; + width: 385px; display: block; float: left; height: 20px; @@ -205,7 +205,7 @@ hr .config-group2 { - width: 300px; + width: 385px; display: block; float: right; height: 20px; @@ -223,6 +223,11 @@ hr float: right; } +input[type=text] +{ + width: 220px; +} + .config-validation { color: Red; diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index a4c5b09a8..8df3391db 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -184,6 +184,7 @@ namespace NzbDrone.Web.Controllers return new SelectList(dataVal, "Id", "SeriesName", selectId); } + //Root Directory [HttpPost] public JsonResult SaveRootDir(int id, string path) { @@ -202,23 +203,29 @@ namespace NzbDrone.Web.Controllers return new JsonResult { Data = "ok" }; } - public ViewResult AddRootDir() + public PartialViewResult AddRootDir() { var rootDir = new RootDir { Path = String.Empty }; var id = _rootFolderProvider.Add(rootDir); rootDir.Id = id; - ViewData["RootDirId"] = id; + var model = new RootDirModel(); + model.Id = rootDir.Id; + model.Path = rootDir.Path; + model.SelectList = new SelectList(new List { rootDir.Path }, rootDir.Path); - return View("RootDir", rootDir); + return PartialView("RootDir", model); } public ActionResult GetRootDirView(RootDir rootDir) { - ViewData["RootDirId"] = rootDir.Id; + var model = new RootDirModel(); + model.Id = rootDir.Id; + model.Path = rootDir.Path; + model.SelectList = new SelectList(new List { rootDir.Path }, rootDir.Path); - return PartialView("RootDir", rootDir); + return PartialView("RootDir", model); } public JsonResult DeleteRootDir(int rootDirId) @@ -235,28 +242,5 @@ namespace NzbDrone.Web.Controllers return new JsonResult { Data = "ok" }; } - - public JsonResult JsonAutoCompletePath(string term) - { - var windowsSep = term.LastIndexOf('\\'); - - if (windowsSep > -1) - { - var start = term.Substring(windowsSep + 1); - var dirs = _diskProvider.GetDirectories(term.Substring(0, windowsSep + 1)).Where(d => new DirectoryInfo(d).Name.ToLower().StartsWith(start.ToLower())).Take(10); - return Json(dirs.ToArray(), JsonRequestBehavior.AllowGet); - } - - var index = term.LastIndexOf('/'); - - if (index > -1) - { - var start = term.Substring(index + 1); - var dirs = _diskProvider.GetDirectories(term.Substring(0, index + 1)).Where(d => new DirectoryInfo(d).Name.ToLower().StartsWith(start.ToLower())).Take(10); - return Json(dirs.ToArray(), JsonRequestBehavior.AllowGet); - } - - return Json(new JsonResult(), JsonRequestBehavior.AllowGet); - } } } \ No newline at end of file diff --git a/NzbDrone.Web/Controllers/DirectoryController.cs b/NzbDrone.Web/Controllers/DirectoryController.cs new file mode 100644 index 000000000..013bc066c --- /dev/null +++ b/NzbDrone.Web/Controllers/DirectoryController.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using NzbDrone.Core.Providers.Core; + +namespace NzbDrone.Web.Controllers +{ + public class DirectoryController : Controller + { + private readonly DiskProvider _diskProvider; + + public DirectoryController(DiskProvider diskProvider) + { + _diskProvider = diskProvider; + } + + public ActionResult Test() + { + return Content("Testing..."); + } + + [HttpPost] + public ActionResult _autoCompletePath(string text, int? filterMode) + { + var data = GetDirectories(text); + + return new JsonResult + { + JsonRequestBehavior = JsonRequestBehavior.AllowGet, + Data = data + }; + } + + public SelectList GetDirectories(string text) + { + //Windows (Including UNC) + var windowsSep = text.LastIndexOf('\\'); + + if (windowsSep > -1) + { + var dirs = _diskProvider.GetDirectories(text.Substring(0, windowsSep + 1)); + return new SelectList(dirs, dirs.FirstOrDefault()); + } + + //Unix + var index = text.LastIndexOf('/'); + + if (index > -1) + { + var dirs = _diskProvider.GetDirectories(text.Substring(0, index + 1)); + return new SelectList(dirs, dirs.FirstOrDefault()); + } + + return new SelectList(new List()); + } + } +} diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index cee95e93a..335c7eda9 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -96,6 +96,9 @@ namespace NzbDrone.Web.Controllers { ViewData["viewName"] = "Sabnzbd"; + var sabDropDir = _configProvider.SabDropDirectory; + var selectList = new SelectList(new List {sabDropDir}, sabDropDir); + var model = new SabnzbdSettingsModel { SabHost = _configProvider.SabHost, @@ -105,7 +108,8 @@ namespace NzbDrone.Web.Controllers SabPassword = _configProvider.SabPassword, SabTvCategory = _configProvider.SabTvCategory, SabTvPriority = _configProvider.SabTvPriority, - SabDropDirectory = _configProvider.SabDropDirectory + SabDropDirectory = sabDropDir, + SabDropDirectorySelectList = selectList }; return View("Index", model); diff --git a/NzbDrone.Web/Models/RootDirModel.cs b/NzbDrone.Web/Models/RootDirModel.cs index b3c231f9d..3df627585 100644 --- a/NzbDrone.Web/Models/RootDirModel.cs +++ b/NzbDrone.Web/Models/RootDirModel.cs @@ -2,12 +2,15 @@ using System.Collections.Generic; using System.Linq; using System.Web; +using System.Web.Mvc; namespace NzbDrone.Web.Models { public class RootDirModel { + public int Id { get; set; } public string Path { get; set; } public string CleanPath { get; set; } + public SelectList SelectList { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/Models/SabnzbdSettingsModel.cs b/NzbDrone.Web/Models/SabnzbdSettingsModel.cs index 179a7b398..5b0aef49b 100644 --- a/NzbDrone.Web/Models/SabnzbdSettingsModel.cs +++ b/NzbDrone.Web/Models/SabnzbdSettingsModel.cs @@ -56,5 +56,7 @@ namespace NzbDrone.Web.Models [Description("The directory where SABnzbd stores TV shows (NzbDrone will sort them for you)")] [DisplayFormat(ConvertEmptyStringToNull = false)] public string SabDropDirectory { get; set; } + + public SelectList SabDropDirectorySelectList { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 4b3ba59be..7f99cbdda 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -236,6 +236,7 @@ True UploadLocalization.en-US.resx + diff --git a/NzbDrone.Web/Views/AddSeries/Index.cshtml b/NzbDrone.Web/Views/AddSeries/Index.cshtml index e010497df..ce1e3e29e 100644 --- a/NzbDrone.Web/Views/AddSeries/Index.cshtml +++ b/NzbDrone.Web/Views/AddSeries/Index.cshtml @@ -153,7 +153,7 @@ var saveRootDirUrl = '@Url.Action("SaveRootDir", "AddSeries")'; function saveRootDir(id) { - var path = $('#path_' + id).val(); + var path = $("#path_" + id).data("tComboBox").value(); $.ajax({ type: "POST", diff --git a/NzbDrone.Web/Views/AddSeries/RootDir.cshtml b/NzbDrone.Web/Views/AddSeries/RootDir.cshtml index c5b2b7963..618e70eae 100644 --- a/NzbDrone.Web/Views/AddSeries/RootDir.cshtml +++ b/NzbDrone.Web/Views/AddSeries/RootDir.cshtml @@ -1,4 +1,4 @@ -@model NzbDrone.Core.Repository.RootDir +@model NzbDrone.Web.Models.RootDirModel @{ Layout = null; @@ -6,8 +6,17 @@
- @Html.TextBoxFor(m => m.Path, new { @class = "root_dir_text", id = "path_" + Model.Id }) - + @{Html.Telerik().ComboBox() + .Name("path_" + Model.Id) + .BindTo(Model.SelectList) + .DataBinding(binding => binding.Ajax().Select("_autoCompletePath", "Directory").Delay(400).Cache(false)) + .Filterable(f => f.FilterMode(AutoCompleteFilterMode.StartsWith)) + .HighlightFirstMatch(true) + .HtmlAttributes(new { style = "width: 300px;" }) + .Render();} + + + Delete diff --git a/NzbDrone.Web/Views/Settings/Indexers.cshtml b/NzbDrone.Web/Views/Settings/Indexers.cshtml index 3c43f26e3..f61eed739 100644 --- a/NzbDrone.Web/Views/Settings/Indexers.cshtml +++ b/NzbDrone.Web/Views/Settings/Indexers.cshtml @@ -32,7 +32,7 @@ .indexer_group { - width: 220px; + width: 290px; } .indexer_left @@ -48,8 +48,10 @@ .indexer_checkbox { - margin-right: 135px; + margin-right: 205px; + margin-top: 8px; } + @using (Html.BeginForm("SaveIndexers", "Settings", FormMethod.Post, new { id = "form", name = "form" })) { @@ -60,7 +62,7 @@
@{ Html.Telerik().PanelBar() .Name("PanelBar") - .HtmlAttributes(new { style = "width: 300px; margin: 10px;" }) + .HtmlAttributes(new { style = "width: 500px; margin: 10px;" }) .ExpandMode(PanelBarExpandMode.Single) .SelectedIndex(0) .Items(indexerItem => diff --git a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml index 0a96eac48..e1eeb900f 100644 --- a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml +++ b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml @@ -49,7 +49,7 @@
@Html.LabelFor(x => x.Name)
-
@Html.TextBoxFor(x => x.Name, new { maxlength = 15 })
+
@Html.TextBoxFor(x => x.Name, new { maxlength = 15, style="width: 150px" })
@Html.ValidationMessageFor(x => x.Name)
diff --git a/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml b/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml index 7e4dcf0d7..6848daec0 100644 --- a/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml +++ b/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml @@ -112,7 +112,14 @@
@Html.LabelFor(m => m.SabDropDirectory)
-
@Html.TextBoxFor(m => m.SabDropDirectory)
+
@{Html.Telerik().ComboBoxFor(m => m.SabDropDirectory) + .BindTo(Model.SabDropDirectorySelectList) + .DataBinding(binding => binding.Ajax().Select("_autoCompletePath", "Directory").Delay(400).Cache(false)) + .Filterable(f => f.FilterMode(AutoCompleteFilterMode.StartsWith)) + .HighlightFirstMatch(true) + .HtmlAttributes(new { style = "margin-left: -2px; width: 220px;" }) + .Render();}
+
@Html.ValidationMessageFor(m => m.SabDropDirectory)