mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-10-30 23:42:33 +01:00
AddSeries javascript fixes.
Add new series now has a drop box for rootdir. Moved add series javascript to addSeries.js.
This commit is contained in:
parent
fb9c2b6d9e
commit
88525a0b7c
@ -166,7 +166,7 @@ namespace NzbDrone.Web.Controllers
|
||||
return new JsonResult { Data = "failed" };
|
||||
}
|
||||
|
||||
return new JsonResult { };
|
||||
return new JsonResult { Data = "ok" };
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
@ -267,6 +267,7 @@
|
||||
<Content Include="favicon.ico" />
|
||||
<Content Include="Global.asax" />
|
||||
<Content Include="Scripts\AutoComplete.js" />
|
||||
<Content Include="Scripts\addSeries.js" />
|
||||
<Content Include="Scripts\Plugins\jquery.gritter.js" />
|
||||
<Content Include="Scripts\seriesDetails.js" />
|
||||
<Content Include="Scripts\Plugins\jquery.livequery.js" />
|
||||
|
119
NzbDrone.Web/Scripts/addSeries.js
Normal file
119
NzbDrone.Web/Scripts/addSeries.js
Normal file
@ -0,0 +1,119 @@
|
||||
//URLs
|
||||
var addSeriesUrl = '../AddSeries/AddExistingSeries';
|
||||
var addNewSeriesUrl = '../AddSeries/AddNewSeries';
|
||||
var existingSeriesUrl = '../AddSeries/ExistingSeries';
|
||||
var addNewUrl = '../AddSeries/AddNew';
|
||||
|
||||
var deleteRootDirUrl = '../AddSeries/DeleteRootDir';
|
||||
var saveRootDirUrl = '../AddSeries/SaveRootDir';
|
||||
var rootListUrl = '../AddSeries/RootList';
|
||||
|
||||
|
||||
//ExistingSeries
|
||||
$(".masterQualitySelector").live('change', function () {
|
||||
|
||||
var profileId = $(this).val();
|
||||
$("#existingSeries").find(".qualitySelector").each(function () {
|
||||
$(this).val(profileId);
|
||||
});
|
||||
});
|
||||
|
||||
$(".addExistingButton").live('click', function () {
|
||||
|
||||
var root = $(this).parents(".existingSeries");
|
||||
|
||||
var title = $(this).siblings(".seriesLookup").val();
|
||||
var qualityId = $(this).siblings(".qualitySelector").val();
|
||||
|
||||
var path = root.find(".seriesPathValue Label").text();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: addSeriesUrl,
|
||||
data: jQuery.param({ path: path, seriesName: title, qualityProfileId: qualityId }),
|
||||
error: function (req, status, error) {
|
||||
alert("Sorry! We could not add " + path + " at this time. " + error);
|
||||
},
|
||||
success: function () {
|
||||
root.hide('highlight', 'fast');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function reloadExistingSeries() {
|
||||
$.get(existingSeriesUrl, function (data) {
|
||||
$('#existingSeries').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
//RootDir
|
||||
//$('#rootDirInput').watermark('Start typing to add new root folder...');
|
||||
|
||||
$('#rootDirs .actionButton img').live('click', function (image) {
|
||||
var path = $(image.target).attr('id');
|
||||
$.post(deleteRootDirUrl, { Path: path }, function () {
|
||||
refreshRoot();
|
||||
});
|
||||
});
|
||||
|
||||
$('#saveDir').live('click', saveRootDir);
|
||||
|
||||
function saveRootDir() {
|
||||
var path = $("#rootDirInput").val();
|
||||
if (path) {
|
||||
$.post(saveRootDirUrl, { Path: path }, function () {
|
||||
refreshRoot();
|
||||
$("#rootDirInput").val('');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function refreshRoot() {
|
||||
$.get(rootListUrl, function (data) {
|
||||
$('#rootDirs').html(data);
|
||||
});
|
||||
reloadAddNew();
|
||||
reloadExistingSeries();
|
||||
}
|
||||
|
||||
|
||||
//AddNew
|
||||
//$('#newSeriesPath').watermark('Path for the new series...');
|
||||
//$('#newSeriesLookup').watermark('Title of the series you want to add...');
|
||||
|
||||
$('#saveNewSeries').live('click', function () {
|
||||
var seriesTitle = $("#newSeriesLookup").val();
|
||||
var qualityId = $("#qualityList").val();
|
||||
var path = $('#newSeriesPath').val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: addNewSeriesUrl,
|
||||
data: jQuery.param({ path: path, seriesName: seriesTitle, qualityProfileId: qualityId }),
|
||||
error: function (req, status, error) {
|
||||
alert("Sorry! We could not add " + path + " at this time. " + error);
|
||||
},
|
||||
success: function () {
|
||||
$("#newSeriesLookup").val("");
|
||||
//$('#newSeriesPath').val("");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function reloadAddNew() {
|
||||
$.get(addNewUrl, function (data) {
|
||||
$('#addNewSeries').html(data);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//On load
|
||||
jQuery(document).ready(function () {
|
||||
//RootDir
|
||||
$('#rootDirInput').watermark('Start typing to add new root folder...');
|
||||
|
||||
//AddNew
|
||||
$('#newSeriesPath').watermark('Path for the new series...');
|
||||
$('#newSeriesLookup').watermark('Title of the series you want to add...');
|
||||
});
|
@ -5,41 +5,10 @@
|
||||
<div>
|
||||
<input id="newSeriesLookup" class="seriesLookup" type="text" style="width: 400px" />
|
||||
</div>
|
||||
<input id="newSeriesPath" class="folderLookup" type="text" style="width: 400px" />
|
||||
@*<input id="newSeriesPath" class="folderLookup" type="text" style="width: 400px" />*@
|
||||
@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" })
|
||||
<button id="saveNewSeries">
|
||||
Add</button>
|
||||
</div>
|
||||
<br />
|
||||
<script type="text/javascript" language="javascript">
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
$('#newSeriesPath').watermark('Path for the new series...');
|
||||
$('#newSeriesLookup').watermark('Title of the series you want to add...');
|
||||
|
||||
$('#saveNewSeries').click(function () {
|
||||
|
||||
var addSeriesUrl = '@Url.Action("AddNewSeries", "AddSeries")';
|
||||
var seriesTitle = $("#newSeriesLookup").val();
|
||||
var qualityId = $("#qualityList").val();
|
||||
var path = $('#newSeriesPath').val();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: addSeriesUrl,
|
||||
data: jQuery.param({ path: path, seriesName: seriesTitle, qualityProfileId: qualityId }),
|
||||
error: function (req, status, error) {
|
||||
alert("Sorry! We could not add " + path + " at this time. " + error);
|
||||
},
|
||||
success: function () {
|
||||
$("#newSeriesLookup").val("");
|
||||
$('#newSeriesPath').val("");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
@ -5,6 +5,26 @@
|
||||
@{
|
||||
Layout = null;
|
||||
}
|
||||
|
||||
<style>
|
||||
.existingSeries
|
||||
{
|
||||
border-color: #f2f2f2;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
background-color: #f2f2f2;
|
||||
margin: 0px 10px 10px 0px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
.masterQualitySelector
|
||||
{
|
||||
left: 202px;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
|
||||
@if (Model.ExistingSeries.Count == 0)
|
||||
{
|
||||
<h3 style="color: tomato">
|
||||
@ -38,59 +58,3 @@ else
|
||||
</div>
|
||||
</span>
|
||||
}
|
||||
|
||||
<style>
|
||||
.existingSeries
|
||||
{
|
||||
border-color: #f2f2f2;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
background-color: #f2f2f2;
|
||||
margin: 0px 10px 10px 0px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
.masterQualitySelector
|
||||
{
|
||||
left: 202px;
|
||||
position: relative;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery(document).ready(function () {
|
||||
|
||||
$(".masterQualitySelector").change(function () {
|
||||
|
||||
var profileId = $(this).val();
|
||||
$("#existingSeries").find(".qualitySelector").each(function () {
|
||||
$(this).val(profileId);
|
||||
});
|
||||
});
|
||||
|
||||
$(".addExistingButton").click(function () {
|
||||
|
||||
var root = $(this).parents(".existingSeries");
|
||||
|
||||
var addSeriesUrl = '@Url.Action("AddExistingSeries", "AddSeries")';
|
||||
var title = $(this).siblings(".seriesLookup").val();
|
||||
var qualityId = $(this).siblings(".qualitySelector").val();
|
||||
|
||||
var path = root.find(".seriesPathValue Label").text();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: addSeriesUrl,
|
||||
data: jQuery.param({ path: path, seriesName: title, qualityProfileId: qualityId }),
|
||||
error: function (req, status, error) {
|
||||
alert("Sorry! We could not add " + path + " at this time. " + error);
|
||||
},
|
||||
success: function () {
|
||||
root.hide('highlight', 'fast');
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
@ -2,10 +2,16 @@
|
||||
@section TitleContent{
|
||||
Add Series
|
||||
}
|
||||
|
||||
@section HeaderContent{
|
||||
<script src="../../Scripts/addSeries.js" type="text/javascript"></script>
|
||||
}
|
||||
|
||||
@section MainContent{
|
||||
<h2>
|
||||
Add New Series</h2>
|
||||
@{ Html.RenderAction("AddNew", "AddSeries"); }
|
||||
<h2>Add New Series</h2>
|
||||
<div id="addNewSeries">
|
||||
@{ Html.RenderAction("AddNew", "AddSeries"); }
|
||||
</div>
|
||||
<h2>
|
||||
Add Series Already on Disk</h2>
|
||||
<h3>
|
||||
|
@ -5,37 +5,3 @@
|
||||
</span><span id="rootDirs">
|
||||
@{Html.RenderAction("RootList");}
|
||||
</span>
|
||||
<script type="text/javascript">
|
||||
jQuery(document).ready(function () {
|
||||
$('#rootDirInput').watermark('Start typing to add new root folder...');
|
||||
|
||||
$('#rootDirs .actionButton img').live('click',
|
||||
function (image) {
|
||||
var path = $(image.target).attr('id');
|
||||
$.post('@Url.Action("DeleteRootDir", "AddSeries")', { Path: path }, function () {
|
||||
refreshRoot();
|
||||
});
|
||||
});
|
||||
|
||||
$('#saveDir').click(saveRootDir);
|
||||
|
||||
function saveRootDir() {
|
||||
var path = $("#rootDirInput").val();
|
||||
if (path) {
|
||||
$.post('@Url.Action("SaveRootDir", "AddSeries")', { Path: path }, function () {
|
||||
refreshRoot();
|
||||
$("#rootDirInput").val('');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function refreshRoot() {
|
||||
$.get('@Url.Action("RootList", "AddSeries")', function (data) {
|
||||
$('#rootDirs').html(data);
|
||||
});
|
||||
reloadExistingSeries();
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user