mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-11-25 04:02:48 +01:00
Added QuickAdd for adding series, not displayed currently, needs some prettifying.
This commit is contained in:
parent
d62345f6d7
commit
a9bcbfad8c
@ -235,4 +235,11 @@ select, button, input[type="button"], input[type="submit"], input[type="reset"]
|
||||
{
|
||||
min-width: 60px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
#quickAdd
|
||||
{
|
||||
position: fixed;
|
||||
top: 30px;
|
||||
right: 15px;
|
||||
}
|
@ -53,9 +53,7 @@ namespace NzbDrone.Web.Controllers
|
||||
var defaultQuality = _configProvider.DefaultQualityProfile;
|
||||
var qualityProfiles = _qualityProvider.All();
|
||||
|
||||
ViewData["qualityList"] = qualityProfiles;
|
||||
|
||||
ViewData["quality"] = new SelectList(
|
||||
ViewData["qualityProfiles"] = new SelectList(
|
||||
qualityProfiles,
|
||||
"QualityProfileId",
|
||||
"Name",
|
||||
@ -132,6 +130,19 @@ namespace NzbDrone.Web.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public JsonResult QuickAddNewSeries(string seriesName, int seriesId, int qualityProfileId)
|
||||
{
|
||||
var path = _rootFolderProvider.GetMostFreeRootDir();
|
||||
path = Path.Combine(path, MediaFileProvider.CleanFilename(seriesName));
|
||||
|
||||
//Create the folder for the new series
|
||||
//Use the created folder name when adding the series
|
||||
path = _diskProvider.CreateDirectory(path);
|
||||
|
||||
return AddExistingSeries(path, seriesName, seriesId, qualityProfileId);
|
||||
}
|
||||
|
||||
public JsonResult AddSeries(string path, int seriesId, int qualityProfileId)
|
||||
{
|
||||
//Get TVDB Series Name
|
||||
@ -145,6 +156,21 @@ namespace NzbDrone.Web.Controllers
|
||||
return new JsonResult { Data = "ok" };
|
||||
}
|
||||
|
||||
[ChildActionOnly]
|
||||
public ActionResult QuickAdd()
|
||||
{
|
||||
var defaultQuality = _configProvider.DefaultQualityProfile;
|
||||
var qualityProfiles = _qualityProvider.All();
|
||||
|
||||
ViewData["qualityProfiles"] = new SelectList(
|
||||
qualityProfiles,
|
||||
"QualityProfileId",
|
||||
"Name",
|
||||
defaultQuality);
|
||||
|
||||
return PartialView();
|
||||
}
|
||||
|
||||
|
||||
//Root Directory
|
||||
[HttpPost]
|
||||
|
@ -929,6 +929,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Settings\System.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Shared\QuickAdd.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.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.
|
||||
|
@ -1,6 +1,7 @@
|
||||
//URLs
|
||||
var addSeriesUrl = '../AddSeries/AddExistingSeries';
|
||||
var addNewSeriesUrl = '../AddSeries/AddNewSeries';
|
||||
var quickAddNewSeriesUrl = '../AddSeries/QuickAddNewSeries';
|
||||
var existingSeriesUrl = '../AddSeries/ExistingSeries';
|
||||
var addNewUrl = '../AddSeries/AddNew';
|
||||
|
||||
@ -105,6 +106,26 @@ function reloadAddNew() {
|
||||
}
|
||||
|
||||
|
||||
//QuickAddNew
|
||||
$('#quickAddNew').live('click', function () {
|
||||
var seriesTitle = $("#newSeriesLookup").val();
|
||||
var seriesId = $("#newSeriesId").val();
|
||||
var qualityId = $("#qualityList").val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: quickAddNewSeriesUrl,
|
||||
data: jQuery.param({ seriesName: seriesTitle, seriesId: seriesId, qualityProfileId: qualityId }),
|
||||
error: function (req, status, error) {
|
||||
alert("Sorry! We could not add " + path + " at this time. " + error);
|
||||
},
|
||||
success: function () {
|
||||
$("#newSeriesLookup").val("");
|
||||
//$('#newSeriesPath').val("");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//On load
|
||||
jQuery(document).ready(function () {
|
||||
//RootDir
|
||||
|
@ -7,7 +7,7 @@
|
||||
@Html.Hidden("newSeriesId", 0, new { @class = "seriesId" })
|
||||
</div>
|
||||
@Html.DropDownList("newSeriesPath", new SelectList((IList)ViewData["RootDirs"]), new { style = "width: 406px; margin-left: 0px;" })
|
||||
@Html.DropDownList("qualityList", new SelectList((IList)ViewData["QualityList"], "QualityProfileId", "Name"), new { @class = "qualitySelector" })
|
||||
@Html.DropDownList("qualityList", (SelectList)ViewData["QualityProfiles"], new { @class = "qualitySelector" })
|
||||
<button id="saveNewSeries">
|
||||
Add</button>
|
||||
</div>
|
||||
|
@ -3,10 +3,6 @@
|
||||
Add Series
|
||||
}
|
||||
|
||||
@section HeaderContent{
|
||||
<script src="../../Scripts/addSeries.js" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
@section MainContent{
|
||||
<h2>Add New Series</h2>
|
||||
<div id="addNewSeries">
|
||||
|
15
NzbDrone.Web/Views/Shared/QuickAdd.cshtml
Normal file
15
NzbDrone.Web/Views/Shared/QuickAdd.cshtml
Normal file
@ -0,0 +1,15 @@
|
||||
@using System.Collections
|
||||
@using NzbDrone.Core
|
||||
<div id="quickAdd">
|
||||
<input id="quickSeriesLookup" class="seriesLookup" type="text" style="width: 400px" />
|
||||
@Html.Hidden("newSeriesId", 0, new { @class = "seriesId" })
|
||||
@Html.DropDownList("qualityList", (SelectList)ViewData["QualityProfiles"], new { @class = "qualitySelector" })
|
||||
<button id="quickAddNew">Add</button>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
//AddNew
|
||||
$('#quickSeriesLookup').watermark('Title of the series you want to add...');
|
||||
});
|
||||
</script>
|
1
SharedLiveTemplates.xml
Normal file
1
SharedLiveTemplates.xml
Normal file
@ -0,0 +1 @@
|
||||
<TemplatesExport />
|
Loading…
Reference in New Issue
Block a user