root dir is done

pull/3113/head
kay.one 14 years ago
parent 859b68ed9e
commit 94e16a6037

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

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

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

@ -32,6 +32,7 @@ namespace NzbDrone.Web.Controllers
[HttpGet] [HttpGet]
public JsonResult GetDirectories(string q) public JsonResult GetDirectories(string q)
{ {
string[] dirs = null;
try try
{ {
//Windows (Including UNC) //Windows (Including UNC)
@ -39,18 +40,16 @@ namespace NzbDrone.Web.Controllers
if (windowsSep > -1) if (windowsSep > -1)
{ {
var dirs = _diskProvider.GetDirectories(q.Substring(0, windowsSep + 1)); dirs = _diskProvider.GetDirectories(q.Substring(0, windowsSep + 1));
return Json(dirs, JsonRequestBehavior.AllowGet);
} }
return Json(new string[] { }, JsonRequestBehavior.AllowGet);
//Unix //Unix
var index = q.LastIndexOf('/'); var index = q.LastIndexOf('/');
if (index > -1) if (index > -1)
{ {
var dirs = _diskProvider.GetDirectories(q.Substring(0, index + 1)); dirs = _diskProvider.GetDirectories(q.Substring(0, index + 1));
//return new SelectList(dirs, dirs.FirstOrDefault());
} }
} }
catch catch
@ -58,7 +57,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 Json(new string[]{}, JsonRequestBehavior.AllowGet); return Json(dirs, JsonRequestBehavior.AllowGet);
} }
} }
} }

@ -669,12 +669,6 @@
<ItemGroup> <ItemGroup>
<Content Include="Views\Series\EditorTemplates\SeriesModel.cshtml" /> <Content Include="Views\Series\EditorTemplates\SeriesModel.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\Test.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Settings\TestPartial.cshtml" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Views\Series\SeasonEditor.cshtml" /> <Content Include="Views\Series\SeasonEditor.cshtml" />
</ItemGroup> </ItemGroup>
@ -688,10 +682,11 @@
<Content Include="Views\System\PendingProcessing.cshtml" /> <Content Include="Views\System\PendingProcessing.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Views\AddSeries\Test.cshtml" /> <Content Include="Views\AddSeries\RootList.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="Views\AddSeries\RootList.cshtml" /> <Content Include="Views\Settings\Test.cshtml" />
<Content Include="Views\Settings\TestPartial.cshtml" />
</ItemGroup> </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" />

@ -1,14 +1,11 @@
@model List<RootDir> @model List<RootDir>
@using NzbDrone.Core.Repository @using NzbDrone.Core.Repository
<style>
.root_dir_text @section HeaderContent
{ {
width: 300px; <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/3.3.0/build/yui/yui-min.js"></script>
margin-top: 8px; }
margin-left: 3px;
vertical-align: middle;
}
</style>
@section TitleContent{ @section TitleContent{
Add Series Add Series
} }
@ -26,52 +23,20 @@ Add Series
.LoadContentFrom("AddNew", "AddSeries") .LoadContentFrom("AddNew", "AddSeries")
.Render(); .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;"> <div style="padding-bottom: 10px; padding-top: 15px;">
<button onclick="openAddNewSeries(); return false;" class="listButton" style="margin-left: 5px"> <button onclick="openAddNewSeries(); return false;" class="listButton" style="margin-left: 5px">
Add New</button> Add New</button>
@Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList)ViewData["qualities"]).HtmlAttributes( @Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList)ViewData["qualities"]).HtmlAttributes(
new { style = "width: 100px; margin-left:224px;" }).ClientEvents(events => events.OnChange("masterChanged")) new { style = "width: 100px; margin-left:224px;" }).ClientEvents(events => events.OnChange("masterChanged"))
</div> </div>
@{Html.RenderAction("RootDir");}
<div id="existingSeries"> <div id="existingSeries">
@{ Html.RenderAction("AddExisting", "AddSeries"); } @{ Html.RenderAction("AddExisting", "AddSeries"); }
</div> </div>
} }
@section Scripts @section Scripts
{ {
<script type="text/javascript"> <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() { function reloadExistingSeries() {
$('#reloadAjax').show(); $('#reloadAjax').show();
$('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")', $('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")',

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

@ -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");}
Loading…
Cancel
Save