Radarr/NzbDrone.Web/Views/AddSeries/AddNew.cshtml

98 lines
3.2 KiB
Plaintext
Raw Normal View History

2011-04-21 04:10:08 +00:00
@model NzbDrone.Web.Models.AddNewSeriesModel
@section TitleContent{
Add New Series
2011-04-21 04:10:08 +00:00
<script type="text/javascript">
jQuery(document).ready(function () {
$('#searchButton').attr('disabled', '');
});
</script>
2011-04-21 04:10:08 +00:00
}
@section MainContent{
<div style="width: 60%">
<div style="display: inline">
2011-04-21 04:10:08 +00:00
@Html.Label("Enter a Series Name")
@Html.TextBox("new_series_name", String.Empty, new {id = "new_series_id"})
<button class="t.button" id="searchButton" disabled="disabled" onclick="searchSeries ()">
Search</button>
</div>
<div style="display: inline; float: right;">
2011-04-21 04:10:08 +00:00
@Html.LabelFor(m => m.QualityProfileId)
@Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)
</div>
</div>
2011-04-21 04:10:08 +00:00
<div id="result"></div>
<div id="RootDirectories" class="rootDirectories" style="display: none">
<fieldset>
<legend>Root TV Folders</legend>
2011-04-21 04:10:08 +00:00
@{int d = 0;}
@foreach (var dir in Model.RootDirectories)
{
@Html.RadioButton("selectedRootDir", dir.Path, d == 0, new {@class = "dirList examplePart", id = "dirRadio_" + d});
@Html.Label(dir.Path)
}
</fieldset>
<div id="example">
</div>
<button class="t.button" onclick="addSeries ()">
Add New Series</button>
</div>
2011-04-21 04:10:08 +00:00
<div id="addResult"></div>
<script type="text/javascript" language="javascript">
$('#new_series_id').bind('keydown', function (e) {
if (e.keyCode == 13) {
$('#searchButton').click();
}
});
function searchSeries() {
var seriesSearch = $('#new_series_id');
$("#result").text("Searching...");
2011-04-10 02:44:01 +00:00
$("#result").load('<%=Url.Action("SearchForSeries", "Series")%>', {
seriesName: seriesSearch.val()
});
2011-03-29 00:12:48 +00:00
document.getElementById('RootDirectories').style.display = 'inline';
}
2011-04-21 04:10:08 +00:00
function addSeries() {
var checkedSeries = $("input[name='selectedSeries']:checked").val();
var checkedDir = $("input[name='selectedRootDir']:checked").val();
var id = "#" + checkedSeries + "_text";
var seriesName = $(id).val();
var qualityProfileId = $("#QualityProfileId").val();
2011-04-10 02:44:01 +00:00
$("#addResult").load('<%=Url.Action("AddSeries", "Series")%>', {
dir: checkedDir,
seriesId: checkedSeries,
seriesName: seriesName,
qualityProfileId: qualityProfileId
});
}
//Need to figure out how to use 'ViewData["DirSep"]' instead of hardcoding '\'
$(".examplePart").live("change", function () {
var dir = $("input[name='selectedRootDir']:checked").val();
var series = $("input[name='selectedSeries']:checked").val();
var id = "#" + series + "_text";
var seriesName = $(id).val();
var sep = "\\";
var str = "Target: " + dir + sep + seriesName;
$('#example').text(str);
});
</script>
2011-04-21 04:10:08 +00:00
}