diff --git a/NzbDrone.Web/Content/ActionButton.css b/NzbDrone.Web/Content/ActionButton.css new file mode 100644 index 000000000..e10ebf0f9 --- /dev/null +++ b/NzbDrone.Web/Content/ActionButton.css @@ -0,0 +1,23 @@ +.actionButton +{ + margin: 5px 0px; + padding: 5px 10px 5px 10px; + background-repeat: no-repeat; + background-position: 5px center; + background-color: #dbe4e9; + margin-bottom: 10px; + display: inline-block; + font-size: 15px; +} + +.actionButton img +{ + cursor: pointer; + vertical-align: middle; + position: relative; + bottom: 1px; +} + +.delete +{ +} diff --git a/NzbDrone.Web/Content/Images/x_16.png b/NzbDrone.Web/Content/Images/x_16.png new file mode 100644 index 000000000..cf640c105 Binary files /dev/null and b/NzbDrone.Web/Content/Images/x_16.png differ diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index a2b0d3268..a5f71b593 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -87,6 +87,12 @@ namespace NzbDrone.Web.Controllers return View(rootDirs); } + + public ActionResult Test() + { + return View(); + } + public ActionResult AddExisting() { var rootDirs = _rootFolderProvider.GetAll(); @@ -185,18 +191,15 @@ namespace NzbDrone.Web.Controllers //Root Directory [HttpPost] - public JsonResult SaveRootDir(int id, string path) + public JsonResult SaveRootDir(string path) { if (String.IsNullOrWhiteSpace(path)) return new JsonResult { Data = "failed" }; try { - if (id == 0) - id = _rootFolderProvider.Add(new RootDir { Path = path }); + _rootFolderProvider.Add(new RootDir { Path = path }); - else - _rootFolderProvider.Update(new RootDir { Id = id, Path = path }); } catch (Exception ex) { @@ -206,7 +209,7 @@ namespace NzbDrone.Web.Controllers return new JsonResult { Data = "failed" }; } - return new JsonResult { Data = id }; + return new JsonResult { }; } public PartialViewResult AddRootDir() @@ -238,11 +241,19 @@ namespace NzbDrone.Web.Controllers return PartialView("RootDir", model); } - public JsonResult DeleteRootDir(int rootDirId) + + public ActionResult RootDir() + { + var rootDir = _rootFolderProvider.GetAll().Select(c => c.Path); + return PartialView("RootDir", rootDir); + } + + public JsonResult DeleteRootDir(string path) { try { - _rootFolderProvider.Remove(rootDirId); + var id = _rootFolderProvider.GetAll().Where(c => c.Path == path).First().Id; + _rootFolderProvider.Remove(id); } catch (Exception) diff --git a/NzbDrone.Web/Controllers/DirectoryController.cs b/NzbDrone.Web/Controllers/DirectoryController.cs index b7e446d35..69da11b35 100644 --- a/NzbDrone.Web/Controllers/DirectoryController.cs +++ b/NzbDrone.Web/Controllers/DirectoryController.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Web; +using System.Web.Helpers; using System.Web.Mvc; using NzbDrone.Core.Providers.Core; @@ -28,26 +29,28 @@ namespace NzbDrone.Web.Controllers }; } - public SelectList GetDirectories(string text) + [HttpGet] + public JsonResult GetDirectories(string q) { try { //Windows (Including UNC) - var windowsSep = text.LastIndexOf('\\'); + var windowsSep = q.LastIndexOf('\\'); if (windowsSep > -1) { - var dirs = _diskProvider.GetDirectories(text.Substring(0, windowsSep + 1)); - return new SelectList(dirs, dirs.FirstOrDefault()); + var dirs = _diskProvider.GetDirectories(q.Substring(0, windowsSep + 1)); + return Json(dirs, JsonRequestBehavior.AllowGet); } + return Json(new string[] { }, JsonRequestBehavior.AllowGet); //Unix - var index = text.LastIndexOf('/'); + var index = q.LastIndexOf('/'); if (index > -1) { - var dirs = _diskProvider.GetDirectories(text.Substring(0, index + 1)); - return new SelectList(dirs, dirs.FirstOrDefault()); + var dirs = _diskProvider.GetDirectories(q.Substring(0, index + 1)); + //return new SelectList(dirs, dirs.FirstOrDefault()); } } catch @@ -55,7 +58,7 @@ namespace NzbDrone.Web.Controllers //Swallow the exceptions so proper JSON is returned to the client (Empty results) } - return new SelectList(new List()); + return Json(new string[]{}, JsonRequestBehavior.AllowGet); } } } diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index a30124448..c7d826779 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -490,6 +490,7 @@ + @@ -682,6 +683,9 @@ + + +