From cece6e9bf62d7c9b7b4a2d023703a1d5f2937ca0 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Wed, 29 Jun 2011 23:15:06 -0700 Subject: [PATCH] Root Dir cleanup --- NzbDrone.Web/Content/ActionButton.css | 23 ++++++++ NzbDrone.Web/Content/Images/x_16.png | Bin 0 -> 570 bytes .../Controllers/AddSeriesController.cs | 27 ++++++--- .../Controllers/DirectoryController.cs | 19 +++--- NzbDrone.Web/NzbDrone.Web.csproj | 4 ++ NzbDrone.Web/Scripts/AutoComplete.js | 13 +++++ NzbDrone.Web/Views/AddSeries/RootDir.cshtml | 55 ++++++++++++------ NzbDrone.Web/Views/AddSeries/Test.cshtml | 14 +++++ NzbDrone.Web/Views/Series/Index.cshtml | 33 ++++++----- NzbDrone.Web/Views/Shared/_Layout.cshtml | 13 ++--- 10 files changed, 143 insertions(+), 58 deletions(-) create mode 100644 NzbDrone.Web/Content/ActionButton.css create mode 100644 NzbDrone.Web/Content/Images/x_16.png create mode 100644 NzbDrone.Web/Scripts/AutoComplete.js create mode 100644 NzbDrone.Web/Views/AddSeries/Test.cshtml 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 0000000000000000000000000000000000000000..cf640c1058ffa30fe3de0bf9a35a04ce6a52dd45 GIT binary patch literal 570 zcmV-A0>%A_P)Q560ZAwo!~#h@(=+LR26Al?(i)ybijh9LY0T+=Q54}#W~T5PBgLEmIUic-*^ zREvWRHU$29{&<~p-c>YcsSDq`=brC7=bm%#eGbdA@Sow5?@5@yNx~^XCm6rzH9~=q z68(A3PB0#gB-j~=V4TgeKzCl`=aP(%LlUesyb+v~#L32RIFw)v2H=_21@mZMn*_7X zz8@M%;@~sr9_~u^#c1%?EZk2%(`mSa>K)PiYZ>AGyttbg9$(-vKz(ZEtHCSaR=%&|skF-jrvub#HppflbF7(-aj6!jr#-bj9-!H@ZLfDuGpn1c;C*jZBfGE`j{|RS zb`=b=*~c7fW@F?Q>f0;RN8(E)fP7xadZ{F{FBr794TVrorzf{#_#RuB+=9lZEx~tp za@sG&;^ee-w&iw+V~x5U`<-wFPn!#tb#-Q02Ri~@6Ex-&uZc$Std%u!(n4j!B~Llv z_oGs+N{M98J!SGsi!+*3pf*fOg7UiKPe0SvtE%8X<6D3M0AA%l 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 @@ + + +