Add Existing with Refresh button after modifying root dirs.

Renamed AddSeries/Add to AddSeries/Index
pull/2/head
Mark McDowall 14 years ago
parent cd4268cf4a
commit 8d38f98338

@ -260,6 +260,11 @@ button, input[type="button"], input[type="submit"], input[type="reset"]
margin: 10px; margin: 10px;
} }
button:active, input[type="button"]:active, input[type="submit"]:active, input[type="reset"]:active
{
border-color: #0C48B6;
}
.listButton .listButton
{ {
padding: 2px 10px 2px 10px; padding: 2px 10px 2px 10px;

@ -71,19 +71,25 @@ namespace NzbDrone.Web.Controllers
return View(); return View();
} }
public ActionResult Add() public ActionResult Index()
{ {
ViewData["RootDirs"] = _rootFolderProvider.GetAll(); var rootDirs = _rootFolderProvider.GetAll();
var unmappedList = new List<String>();
var profiles = _qualityProvider.GetAllProfiles(); var profiles = _qualityProvider.GetAllProfiles();
var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile); var defaultQuality = Convert.ToInt32(_configProvider.DefaultQualityProfile);
var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality); var selectList = new SelectList(profiles, "QualityProfileId", "Name", defaultQuality);
ViewData["qualities"] = selectList; ViewData["qualities"] = selectList;
foreach (var folder in _rootFolderProvider.GetAll()) return View(rootDirs);
}
public ActionResult AddExisting()
{
var rootDirs = _rootFolderProvider.GetAll();
var unmappedList = new List<String>();
foreach (var folder in rootDirs)
{ {
unmappedList.AddRange(_rootFolderProvider.GetUnmappedFolders(folder.Path)); unmappedList.AddRange(_rootFolderProvider.GetUnmappedFolders(folder.Path));
} }

@ -664,7 +664,7 @@
<Content Include="Scripts\jquery-tgc-countdown-1.0.js" /> <Content Include="Scripts\jquery-tgc-countdown-1.0.js" />
<Content Include="Scripts\jquery.simpledropdown.js" /> <Content Include="Scripts\jquery.simpledropdown.js" />
<Content Include="Scripts\Notification.js" /> <Content Include="Scripts\Notification.js" />
<Content Include="Views\AddSeries\Add.cshtml" /> <Content Include="Views\AddSeries\Index.cshtml" />
<Content Include="Views\AddSeries\AddNew.cshtml" /> <Content Include="Views\AddSeries\AddNew.cshtml" />
<Content Include="Views\AddSeries\AddSeriesItem.cshtml" /> <Content Include="Views\AddSeries\AddSeriesItem.cshtml" />
<Content Include="Web.config"> <Content Include="Web.config">
@ -871,6 +871,9 @@
<ItemGroup> <ItemGroup>
<Content Include="Views\Series\SingleSeason.cshtml" /> <Content Include="Views\Series\SingleSeason.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="Views\AddSeries\AddExisting.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,15 @@
@model IEnumerable<String>
@{
Layout = null;
}
@if (Model.Count() == 0)
{
@Html.DisplayText("No Series to Add");
}
@foreach (var path in Model)
{
Html.RenderAction("RenderPartial", "AddSeries", new {path});
}

@ -1,4 +1,4 @@
@model IEnumerable<String> @model List<RootDir>
@using NzbDrone.Core.Repository @using NzbDrone.Core.Repository
<script type="text/javascript" src="../../Scripts/2011.1.315/telerik.window.min.js"></script> <script type="text/javascript" src="../../Scripts/2011.1.315/telerik.window.min.js"></script>
@ -51,11 +51,12 @@
</div> </div>
<div id="root-dirs"> <div id="root-dirs">
@foreach (var root in ViewData["RootDirs"] as List<RootDir>) @foreach (var root in Model)
{ {
Html.RenderAction("GetRootDirView", root); Html.RenderAction("GetRootDirView", root);
} }
</div> </div>
<button onclick="reloadExistingSeries()" style="padding: 2px 10px 2px 10px; margin: 5px; margin-bottom: 10px;">Refresh Unmapped</button>
</div> </div>
</text>); </text>);
}).Render(); }).Render();
@ -69,15 +70,9 @@
</div> </div>
@if (Model.Count() == 0) <div id="existingSeries">
{ @{ Html.RenderAction("AddExisting", "AddSeries"); }
@Html.DisplayText("No Series to Add"); </div>
}
@foreach (var path in Model)
{
Html.RenderAction("RenderPartial", "AddSeries", new {path});
}
} }
<script type="text/javascript"> <script type="text/javascript">
@ -171,4 +166,8 @@
} }
}); });
} }
function reloadExistingSeries() {
$('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")');
}
</script> </script>

@ -9,7 +9,7 @@
@Html.TextBoxFor(m => m.Path, new { @class = "root_dir_text", id = "path_" + Model.Id }) @Html.TextBoxFor(m => m.Path, new { @class = "root_dir_text", id = "path_" + Model.Id })
<a href="#" class="deleteRow" onclick="deleteRootDir('@ViewData["RootDirId"]')"> <a href="#" class="deleteRow" onclick="deleteRootDir('@ViewData["RootDirId"]')">
<img src="../../Content/Images/X.png" alt="Delete" width="20px" height="20px" style="vertical-align: middle; margin-top: 7px;"/></a> <img src="../../Content/Images/X.png" alt="Delete" width="20px" height="20px" style="vertical-align: middle; margin-top: 7px;"/></a>
<input type="button" value="Save" style="padding: 2px 10px 2px 10px; vertical-align: middle; margin: 0px; margin-top: 7px;" onclick="saveRootDir(@Model.Id)"/> <button style="padding: 2px 10px 2px 10px; vertical-align: middle; margin: 0px; margin-top: 7px;" onclick="saveRootDir(@Model.Id)">Save</button>
@Html.HiddenFor(x => x.Id, new { id = "id_" + Model.Id }) @Html.HiddenFor(x => x.Id, new { id = "id_" + Model.Id })
</fieldset> </fieldset>

@ -2,7 +2,7 @@
@{Html.Telerik().Menu().Name("telerikGrid").Items(items => @{Html.Telerik().Menu().Name("telerikGrid").Items(items =>
{ {
items.Add().Text("Add Series").Action<AddSeriesController>(c => c.Add()); items.Add().Text("Add Series").Action<AddSeriesController>(c => c.Index());
items.Add().Text("Start RSS Sync").Action<SeriesController>(c => c.RssSync()); items.Add().Text("Start RSS Sync").Action<SeriesController>(c => c.RssSync());
items.Add().Text("Rename All").Action<SeriesController>(c => c.RenameAll()); items.Add().Text("Rename All").Action<SeriesController>(c => c.RenameAll());
}).Render();} }).Render();}
Loading…
Cancel
Save