Root Dir cleanup
This commit is contained in:
parent
07312780f1
commit
cece6e9bf6
|
@ -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
|
||||||
|
{
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 570 B |
|
@ -87,6 +87,12 @@ namespace NzbDrone.Web.Controllers
|
||||||
return View(rootDirs);
|
return View(rootDirs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ActionResult Test()
|
||||||
|
{
|
||||||
|
return View();
|
||||||
|
}
|
||||||
|
|
||||||
public ActionResult AddExisting()
|
public ActionResult AddExisting()
|
||||||
{
|
{
|
||||||
var rootDirs = _rootFolderProvider.GetAll();
|
var rootDirs = _rootFolderProvider.GetAll();
|
||||||
|
@ -185,18 +191,15 @@ namespace NzbDrone.Web.Controllers
|
||||||
|
|
||||||
//Root Directory
|
//Root Directory
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public JsonResult SaveRootDir(int id, string path)
|
public JsonResult SaveRootDir(string path)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrWhiteSpace(path))
|
if (String.IsNullOrWhiteSpace(path))
|
||||||
return new JsonResult { Data = "failed" };
|
return new JsonResult { Data = "failed" };
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (id == 0)
|
_rootFolderProvider.Add(new RootDir { Path = path });
|
||||||
id = _rootFolderProvider.Add(new RootDir { Path = path });
|
|
||||||
|
|
||||||
else
|
|
||||||
_rootFolderProvider.Update(new RootDir { Id = id, Path = path });
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -206,7 +209,7 @@ namespace NzbDrone.Web.Controllers
|
||||||
return new JsonResult { Data = "failed" };
|
return new JsonResult { Data = "failed" };
|
||||||
}
|
}
|
||||||
|
|
||||||
return new JsonResult { Data = id };
|
return new JsonResult { };
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartialViewResult AddRootDir()
|
public PartialViewResult AddRootDir()
|
||||||
|
@ -238,11 +241,19 @@ namespace NzbDrone.Web.Controllers
|
||||||
return PartialView("RootDir", model);
|
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
|
try
|
||||||
{
|
{
|
||||||
_rootFolderProvider.Remove(rootDirId);
|
var id = _rootFolderProvider.GetAll().Where(c => c.Path == path).First().Id;
|
||||||
|
_rootFolderProvider.Remove(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
using System.Web.Helpers;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using NzbDrone.Core.Providers.Core;
|
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
|
try
|
||||||
{
|
{
|
||||||
//Windows (Including UNC)
|
//Windows (Including UNC)
|
||||||
var windowsSep = text.LastIndexOf('\\');
|
var windowsSep = q.LastIndexOf('\\');
|
||||||
|
|
||||||
if (windowsSep > -1)
|
if (windowsSep > -1)
|
||||||
{
|
{
|
||||||
var dirs = _diskProvider.GetDirectories(text.Substring(0, windowsSep + 1));
|
var dirs = _diskProvider.GetDirectories(q.Substring(0, windowsSep + 1));
|
||||||
return new SelectList(dirs, dirs.FirstOrDefault());
|
return Json(dirs, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Json(new string[] { }, JsonRequestBehavior.AllowGet);
|
||||||
//Unix
|
//Unix
|
||||||
var index = text.LastIndexOf('/');
|
var index = q.LastIndexOf('/');
|
||||||
|
|
||||||
if (index > -1)
|
if (index > -1)
|
||||||
{
|
{
|
||||||
var dirs = _diskProvider.GetDirectories(text.Substring(0, index + 1));
|
var dirs = _diskProvider.GetDirectories(q.Substring(0, index + 1));
|
||||||
return new SelectList(dirs, dirs.FirstOrDefault());
|
//return new SelectList(dirs, dirs.FirstOrDefault());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -55,7 +58,7 @@ namespace NzbDrone.Web.Controllers
|
||||||
//Swallow the exceptions so proper JSON is returned to the client (Empty results)
|
//Swallow the exceptions so proper JSON is returned to the client (Empty results)
|
||||||
}
|
}
|
||||||
|
|
||||||
return new SelectList(new List<string>());
|
return Json(new string[]{}, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -490,6 +490,7 @@
|
||||||
<Content Include="Content\2011.1.414\Windows7\slider-vs-right.gif" />
|
<Content Include="Content\2011.1.414\Windows7\slider-vs-right.gif" />
|
||||||
<Content Include="Content\2011.1.414\Windows7\sprite-vertical.png" />
|
<Content Include="Content\2011.1.414\Windows7\sprite-vertical.png" />
|
||||||
<Content Include="Content\2011.1.414\Windows7\sprite.png" />
|
<Content Include="Content\2011.1.414\Windows7\sprite.png" />
|
||||||
|
<Content Include="Content\ActionButton.css" />
|
||||||
<Content Include="Content\Blueprint\ie.css" />
|
<Content Include="Content\Blueprint\ie.css" />
|
||||||
<Content Include="Content\Blueprint\screen.css" />
|
<Content Include="Content\Blueprint\screen.css" />
|
||||||
<Content Include="Content\Blueprint\liquid.css" />
|
<Content Include="Content\Blueprint\liquid.css" />
|
||||||
|
@ -682,6 +683,9 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\System\PendingProcessing.cshtml" />
|
<Content Include="Views\System\PendingProcessing.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Views\AddSeries\Test.cshtml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
function bindFolderAutoComplete(selector) {
|
||||||
|
YUI().use("autocomplete", "autocomplete-highlighters", 'autocomplete-filters', function (Y) {
|
||||||
|
Y.one('body').addClass('yui3-skin-sam');
|
||||||
|
Y.one(selector).plug(Y.Plugin.AutoComplete, {
|
||||||
|
|
||||||
|
|
||||||
|
resultHighlighter: 'startsWith',
|
||||||
|
resultFilters: 'phraseMatch',
|
||||||
|
source: '/Directory/GetDirectories/?q={query}'
|
||||||
|
});
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
|
@ -1,25 +1,44 @@
|
||||||
@model NzbDrone.Web.Models.RootDirModel
|
@using NzbDrone.Web.Models
|
||||||
|
@model IEnumerable<String>
|
||||||
@{
|
@{
|
||||||
Layout = null;
|
Layout = null;
|
||||||
}
|
}
|
||||||
|
<div id="rootDirs">
|
||||||
|
@foreach (var root in Model)
|
||||||
|
{
|
||||||
|
<div class="actionButton delete">
|
||||||
|
<img src="/Content/Images/x_16.png" alt="delete" id='@root'/>
|
||||||
|
<span>@root</span>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<label for="ac-input">
|
||||||
|
Enter a GitHub username:</label>
|
||||||
|
<input id="rootDirInput" type="text" style="width: 100px" />
|
||||||
|
<button id="saveDir">
|
||||||
|
Save</button>
|
||||||
|
@(Html.Telerik().ScriptRegistrar().DefaultGroup(c => c.Add("http://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui-min.js")
|
||||||
|
.Add("AutoComplete.js")
|
||||||
|
).OnDocumentReady("bindFolderAutoComplete('#rootDirInput')"))
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
<div class="rootDirSection" id="rootDir_@(ViewData["guid"])" style="padding: 7px; padding-left: 3px;">
|
$(document).ready(function () {
|
||||||
<fieldset style="padding: 5px; height: 40px;">
|
$('#saveDir').click(saveRootDir);
|
||||||
@{Html.Telerik().ComboBox()
|
|
||||||
.Name("path_" + ViewData["guid"])
|
function saveRootDir() {
|
||||||
.BindTo(Model.SelectList)
|
var path = $("#rootDirInput").val();
|
||||||
.DataBinding(binding => binding.Ajax().Select("_autoCompletePath", "Directory").Delay(400).Cache(true))
|
$.post("/AddSeries/SaveRootDir", { Path: path });
|
||||||
.Filterable(f => f.FilterMode(AutoCompleteFilterMode.StartsWith))
|
}
|
||||||
.HighlightFirstMatch(true)
|
});
|
||||||
.HtmlAttributes(new { style = "width: 300px;" })
|
|
||||||
.Render();}
|
|
||||||
|
|
||||||
|
|
||||||
<a href="#RemoveRootDir" class="deleteRow" onclick="deleteRootDir('@ViewData["guid"]'); return false;">
|
$(document).ready(function () {
|
||||||
<img src="../../Content/Images/X.png" alt="Delete" width="20px" height="20px" style="vertical-align: middle; margin-top: 7px;"/></a>
|
$('#rootDirs .actionButton img').live('click',
|
||||||
<button style="padding: 2px 10px 2px 10px; vertical-align: middle; margin: 0px; margin-top: 7px;" onclick="saveRootDir('@ViewData["guid"]')">Save</button>
|
function (image) {
|
||||||
|
var path = $(image.srcElement).attr('id');
|
||||||
@Html.HiddenFor(x => x.Id, new { id = "id_" + ViewData["guid"] })
|
$.post("/AddSeries/DeleteRootDir", { Path: path });
|
||||||
</fieldset>
|
});
|
||||||
</div>
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
@{
|
||||||
|
ViewBag.Title = "Test";
|
||||||
|
Layout = "~/Views/Shared/_Layout.cshtml";
|
||||||
|
}
|
||||||
|
|
||||||
|
@{Html.RenderAction("RootDir");}
|
||||||
|
|
||||||
|
|
||||||
|
@(Html.Telerik().ScriptRegistrar().Scripts(c => c.AddGroup("TestGroup", group => group
|
||||||
|
.Add("telerik.common.js")
|
||||||
|
.Add("telerik.combobox.js")
|
||||||
|
.Add("telerik.list.js")
|
||||||
|
.Add("telerik.autocomplete.js")
|
||||||
|
)))
|
|
@ -99,7 +99,23 @@ Series
|
||||||
@section Scripts{
|
@section Scripts{
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var windowElement;
|
var windowElement;
|
||||||
|
|
||||||
|
(function ($) {
|
||||||
|
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
||||||
|
return this.each(
|
||||||
|
function () {
|
||||||
|
var div = $(this);
|
||||||
|
var progressBar = div.find(".progress");
|
||||||
|
|
||||||
|
var width = Math.round(episodes / totalEpisodes * 100);
|
||||||
|
|
||||||
|
progressBar.css("width", width + "%");
|
||||||
|
div.find(".progressText").html(episodes + " / " + totalEpisodes);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
|
|
||||||
function grid_edit(args) {
|
function grid_edit(args) {
|
||||||
$(args.form)
|
$(args.form)
|
||||||
.closest(".t-window")
|
.closest(".t-window")
|
||||||
|
@ -146,22 +162,7 @@ Series
|
||||||
|
|
||||||
$("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount);
|
$("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount);
|
||||||
}
|
}
|
||||||
</script>
|
|
||||||
<script type="text/javascript" src="../../Scripts/doTimeout.js"></script>
|
|
||||||
<script type="text/javascript">
|
|
||||||
(function ($) {
|
|
||||||
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
|
||||||
return this.each(
|
|
||||||
function () {
|
|
||||||
var div = $(this);
|
|
||||||
var progressBar = div.find(".progress");
|
|
||||||
|
|
||||||
var width = Math.round(episodes / totalEpisodes * 100);
|
|
||||||
|
|
||||||
progressBar.css("width", width + "%");
|
|
||||||
div.find(".progressText").html(episodes + " / " + totalEpisodes);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
})(jQuery);
|
|
||||||
</script>
|
</script>
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<link rel="SHORTCUT ICON" href="../../favicon.ico" />
|
<link rel="SHORTCUT ICON" href="../../favicon.ico" />
|
||||||
<title>NZBDrone</title>
|
<title>NZBDrone</title>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
@MvcMiniProfiler.MiniProfiler.RenderIncludes()
|
|
||||||
<link href="/Content/Blueprint/screen.css" rel="stylesheet" type="text/css" />
|
<link href="/Content/Blueprint/screen.css" rel="stylesheet" type="text/css" />
|
||||||
<link href="/Content/Blueprint/ie.css" rel="stylesheet" type="text/css" />
|
<link href="/Content/Blueprint/ie.css" rel="stylesheet" type="text/css" />
|
||||||
<link type="text/css" href="http://aspnet-skins.telerikstatic.com/mvcz/2011.1.414/telerik.common.min.css"
|
<link type="text/css" href="http://aspnet-skins.telerikstatic.com/mvcz/2011.1.414/telerik.common.min.css"
|
||||||
|
@ -16,6 +16,7 @@
|
||||||
rel="stylesheet" />
|
rel="stylesheet" />
|
||||||
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
|
<link href="/Content/Site.css" rel="stylesheet" type="text/css" />
|
||||||
<link href="/Content/Notibar.css" rel="stylesheet" type="text/css" />
|
<link href="/Content/Notibar.css" rel="stylesheet" type="text/css" />
|
||||||
|
<link href="/Content/ActionButton.css" rel="stylesheet" type="text/css" />
|
||||||
@RenderSection("HeaderContent", required: false)
|
@RenderSection("HeaderContent", required: false)
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -51,16 +52,12 @@
|
||||||
<div id="msgBox">
|
<div id="msgBox">
|
||||||
<span id="msgText">Scanning Series Folder...</span>
|
<span id="msgText">Scanning Series Folder...</span>
|
||||||
</div>
|
</div>
|
||||||
@(Html.Telerik().ScriptRegistrar().jQuery(true).Scripts(
|
@(Html.Telerik().ScriptRegistrar().Scripts(
|
||||||
c => c.AddGroup("CDN", group => group
|
c => c.AddGroup("CDN", group => group
|
||||||
.Add("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js")
|
.Add("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js")
|
||||||
|
//.Add("http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js")
|
||||||
.Add("http://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"))
|
.Add("http://ajax.aspnetcdn.com/ajax/4.0/1/MicrosoftAjax.js"))
|
||||||
.Add("2011.1.414/telerik.list.min.js")
|
.AddGroup("3rdParty", group => group
|
||||||
.Add("2011.1.414/telerik.combobox.min.js")
|
|
||||||
.Add("2011.1.414/telerik.textbox.min.js")
|
|
||||||
.Add("2011.1.414/telerik.window.min.js")
|
|
||||||
.Add("2011.1.414/telerik.autocomplete.min.js")
|
|
||||||
.AddGroup("3rdParty", group => group
|
|
||||||
.Add("jquery.form.js")
|
.Add("jquery.form.js")
|
||||||
.Add("jquery.jgrowl.js")
|
.Add("jquery.jgrowl.js")
|
||||||
.Add("jquery-tgc-countdown-1.0.js")
|
.Add("jquery-tgc-countdown-1.0.js")
|
||||||
|
|
Loading…
Reference in New Issue