root dir is done

This commit is contained in:
kay.one 2011-07-01 13:59:25 -07:00
parent 859b68ed9e
commit 94e16a6037
8 changed files with 25 additions and 134 deletions

View File

@ -1,11 +1,10 @@
.actionButton
{
margin: 5px 0px;
margin: 5px 5px 5px 5px;
padding: 5px 10px 5px 10px;
background-repeat: no-repeat;
background-position: 5px center;
background-color: #cccccc;
margin-bottom: 10px;
display: inline-block;
font-size: 15px;
}

View File

@ -169,13 +169,13 @@ button:active, input[type="button"]:active, input[type="submit"]:active, input[t
border-color: #0C48B6;
}
input, select
input[type=text], select
{
font-size: larger;
padding: 4px 2px;
border: solid 1px #aacfe4;
width: 200px;
margin: 2px 0 20px 10px;
margin: 2px 0 10px 10px;
height: 20px;
}

View File

@ -55,7 +55,7 @@ namespace NzbDrone.Web.Controllers
Path = r.Path,
CleanPath = r.Path.Replace(Path.DirectorySeparatorChar, '|').Replace(Path.VolumeSeparatorChar, '^').Replace('\'', '`')
});
ViewData["RootDirs"] = rootDirs;
ViewData["RootDirs"] = rootDirs.ToList();
ViewData["DirSep"] = Path.DirectorySeparatorChar.ToString().Replace(Path.DirectorySeparatorChar, '|');
var defaultQuality = _configProvider.DefaultQualityProfile;
@ -88,11 +88,6 @@ namespace NzbDrone.Web.Controllers
}
public ActionResult Test()
{
return View();
}
public ActionResult AddExisting()
{
var rootDirs = _rootFolderProvider.GetAll();

View File

@ -32,6 +32,7 @@ namespace NzbDrone.Web.Controllers
[HttpGet]
public JsonResult GetDirectories(string q)
{
string[] dirs = null;
try
{
//Windows (Including UNC)
@ -39,18 +40,16 @@ namespace NzbDrone.Web.Controllers
if (windowsSep > -1)
{
var dirs = _diskProvider.GetDirectories(q.Substring(0, windowsSep + 1));
return Json(dirs, JsonRequestBehavior.AllowGet);
dirs = _diskProvider.GetDirectories(q.Substring(0, windowsSep + 1));
}
return Json(new string[] { }, JsonRequestBehavior.AllowGet);
//Unix
var index = q.LastIndexOf('/');
if (index > -1)
{
var dirs = _diskProvider.GetDirectories(q.Substring(0, index + 1));
//return new SelectList(dirs, dirs.FirstOrDefault());
dirs = _diskProvider.GetDirectories(q.Substring(0, index + 1));
}
}
catch
@ -58,7 +57,7 @@ namespace NzbDrone.Web.Controllers
//Swallow the exceptions so proper JSON is returned to the client (Empty results)
}
return Json(new string[]{}, JsonRequestBehavior.AllowGet);
return Json(dirs, JsonRequestBehavior.AllowGet);
}
}
}

View File

@ -669,12 +669,6 @@
<ItemGroup>
<Content Include="Views\Series\EditorTemplates\SeriesModel.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\Test.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\TestPartial.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\SeasonEditor.cshtml" />
</ItemGroup>
@ -688,10 +682,11 @@
<Content Include="Views\System\PendingProcessing.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\AddSeries\Test.cshtml" />
<Content Include="Views\AddSeries\RootList.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\AddSeries\RootList.cshtml" />
<Content Include="Views\Settings\Test.cshtml" />
<Content Include="Views\Settings\TestPartial.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

View File

@ -1,14 +1,11 @@
@model List<RootDir>
@using NzbDrone.Core.Repository
<style>
.root_dir_text
{
width: 300px;
margin-top: 8px;
margin-left: 3px;
vertical-align: middle;
}
</style>
@section HeaderContent
{
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui-min.js"></script>
}
@section TitleContent{
Add Series
}
@ -26,52 +23,20 @@ Add Series
.LoadContentFrom("AddNew", "AddSeries")
.Render();
}
@{ Html.Telerik().PanelBar()
.Name("RootDirPanel")
.HtmlAttributes(new { style = "margin: 0px;" })
.ExpandMode(PanelBarExpandMode.Multiple)
.Items(panelItem =>
{
panelItem.Add()
.Text("Root Directories")
.ImageUrl("~/Content/Images/VideoFolder.png")
.Selected((bool)ViewData["ShowRootDirs"])
.Expanded((bool)ViewData["ShowRootDirs"])
.Content(@<text>
<div style="padding-top: 10px;">
<div style="padding-left: 7px; margin-bottom: 5px;">
<a id="addItem" style="text-decoration:none;" href="@Url.Action("AddRootDir", "AddSeries")">
<img src="../../Content/Images/Plus.png" alt="Add New Profile" width="20px" height="20px" />
<h4 style="margin-left: 3px; display: inline; color: Black;">
Add New Root Directory</h4>
</a>
</div>
<div id="root-dirs">
@foreach (var root in Model)
{
Html.RenderAction("GetRootDirView", root);
}
</div>
<button onclick="reloadExistingSeries()" style="padding: 2px 10px 2px 10px; margin: 5px;
margin-bottom: 10px;">
Refresh Unmapped</button>
<span id="reloadAjax" style="display: none">
<img src="../../Content/Images/ajax-loader.gif" width="22px" height="22px" style="margin-bottom: -6px;" /></span>
</div>
</text>);
}).Render();
}
<div style="padding-bottom: 10px; padding-top: 15px;">
<button onclick="openAddNewSeries(); return false;" class="listButton" style="margin-left: 5px">
Add New</button>
@Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList)ViewData["qualities"]).HtmlAttributes(
new { style = "width: 100px; margin-left:224px;" }).ClientEvents(events => events.OnChange("masterChanged"))
</div>
@{Html.RenderAction("RootDir");}
<div id="existingSeries">
@{ Html.RenderAction("AddExisting", "AddSeries"); }
</div>
}
@section Scripts
{
<script type="text/javascript">
@ -119,59 +84,6 @@ Add Series
});
}
$("#addItem").click(function () {
$.ajax({
url: this.href,
cache: false,
success: function (html) { $("#root-dirs").append(html); }
});
return false;
});
var deleteRootDirUrl = '@Url.Action("DeleteRootDir", "AddSeries")';
function deleteRootDir(guid) {
var id = $('#id_' + guid).val();
sendDeleteToServer(id, guid);
}
function sendDeleteToServer(id, guid) {
$.ajax({
type: "POST",
url: deleteRootDirUrl,
data: jQuery.param({ rootDirId: id }),
error: function (req, status, error) {
alert("Sorry! We could not delete your Root Directory at this time. " + error);
},
success: function () {
$("#rootDir_" + guid).remove();
}
});
}
var saveRootDirUrl = '@Url.Action("SaveRootDir", "AddSeries")';
function saveRootDir(guid) {
var path = $("#path_" + guid).data("tComboBox").value();
var id = $("#id_" + guid).val();
$.ajax({
type: "POST",
url: saveRootDirUrl,
data: jQuery.param({ id: id, path: path }),
error: function (req, status, error) {
alert("Sorry! We could not save " + path + " at this time. " + error);
},
success: function (data, textStatus, jqXHR) {
if (data == 'failed')
alert("An error occurred while saving Root Directory: " + path);
else {
$("#id_" + guid).val(data);
}
}
});
}
function reloadExistingSeries() {
$('#reloadAjax').show();
$('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")',

View File

@ -1,11 +1,11 @@
<div>
<span>
<input id="rootDirInput" type="text" style="width: 400px" />
<button id="saveDir">
Add</button>
</div>
<div id="rootDirs">
</span>
<span id="rootDirs">
@{Html.RenderAction("RootList");}
</div>
</span>
<script type="text/javascript">
jQuery(document).ready(function() {

View File

@ -1,9 +0,0 @@
@{
ViewBag.Title = "Test";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@section HeaderContent
{
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui-min.js"></script>
}
@{Html.RenderAction("RootDir");}