You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/NzbDrone.Web/Views/AddSeries/Index.cshtml

91 lines
3.0 KiB

@model List<RootDir>
@using NzbDrone.Core.Repository
@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
}
@section MainContent{
<div id="addNewWindow" class="dialog">
@{ Html.RenderAction("AddNew", "AddSeries"); }
</div>
@{Html.RenderAction("RootDir");}
<div id="existingSeries">
<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("AddExisting", "AddSeries"); }
</div>
}
@section Scripts
{
<script type="text/javascript">
$(document).ready(function () {
$("#addNewWindow").dialog({
title: 'add new series',
height: '500',
width: '700',
modal: true
});
});
function openAddNewSeries() {
var window = $('#Window').data('tWindow');
window.center().open();
window.refresh();
}
function closeAddNewSeries() {
var window = $('#Window').data("tWindow");
window.close();
}
function masterChanged() {
var masterQuality = $('#masterDropbox').data("tDropDownList").value();
var qualityDropbox = $(".qualityDropbox");
qualityDropbox.each(function () {
var child = $(this).children("[id^='qualityList']");
var comboBox = child.data("tDropDownList");
comboBox.value(masterQuality);
});
}
var addSeriesUrl = '@Url.Action("AddSeries", "AddSeries")';
function addSeries(guid, path) {
var seriesComboBox = $("#seriesList_" + guid).data("tComboBox");
var qualityComboBox = $("#qualityList_" + guid).data("tDropDownList");
sendToServer(seriesComboBox.value(), path, qualityComboBox.value());
$("#div_" + guid).hide();
}
function sendToServer(id, path, quality) {
$.ajax({
type: "POST",
url: addSeriesUrl,
data: jQuery.param({ path: path, seriesId: id, qualityProfileId: quality }),
error: function (req, status, error) {
alert("Sorry! We could not add " + path + " at this time. " + error);
}
});
}
function reloadExistingSeries() {
$('#reloadAjax').show();
$('#existingSeries').load('@Url.Action("AddExisting", "AddSeries")',
function (responseText, textStatus, XMLHttpRequest) {
$('#reloadAjax').hide();
});
}
</script>
}