2011-05-28 07:16:16 +00:00
|
|
|
@using NzbDrone.Web.Models
|
|
|
|
@{
|
|
|
|
Layout = null;
|
2011-04-21 04:10:08 +00:00
|
|
|
}
|
2011-05-28 07:16:16 +00:00
|
|
|
<div>
|
|
|
|
<fieldset>
|
|
|
|
<legend>Root Directory</legend>
|
|
|
|
@{int d = 0;
|
|
|
|
|
|
|
|
foreach (var dir in ViewData["RootDirs"] as List<RootDirModel>)
|
|
|
|
{
|
2011-06-28 02:24:42 +00:00
|
|
|
<div>
|
|
|
|
@Html.RadioButton("selectedRootDir", dir.CleanPath, d == 0, new { @class = "dirList examplePart", id = "dirRadio_" + d })
|
|
|
|
@Html.Label(dir.Path)
|
|
|
|
@{ d++; }
|
|
|
|
</div>
|
|
|
|
}
|
2011-03-11 09:04:56 +00:00
|
|
|
}
|
2011-05-28 07:16:16 +00:00
|
|
|
</fieldset>
|
|
|
|
</div>
|
2011-06-28 02:24:42 +00:00
|
|
|
<br />
|
2011-05-28 07:16:16 +00:00
|
|
|
<div>
|
|
|
|
@{Html.Telerik().ComboBox()
|
|
|
|
.Name("seriesList_new")
|
|
|
|
.DataBinding(binding => binding.Ajax().Select("_textLookUp", "AddSeries").Delay(400))
|
|
|
|
.Filterable(f => f.FilterMode(AutoCompleteFilterMode.Contains))
|
|
|
|
.HighlightFirstMatch(true)
|
|
|
|
.HtmlAttributes(new { style = "width: 300px;" })
|
|
|
|
.Render();}
|
|
|
|
@Html.Telerik().DropDownList().Name("qualityList_new").BindTo((SelectList)ViewData["quality"]).HtmlAttributes(new { style = "width: 100px", @class = "qualityDropbox" })
|
|
|
|
<button class="listButton" onclick="addNewSeries()">
|
|
|
|
Add</button>
|
|
|
|
</div>
|
2011-06-28 02:24:42 +00:00
|
|
|
@section Scripts{
|
|
|
|
<script type="text/javascript" language="javascript">
|
|
|
|
var addNewSeriesUrl = '@Url.Action("AddNewSeries", "AddSeries")';
|
2011-05-28 07:16:16 +00:00
|
|
|
|
2011-06-28 02:24:42 +00:00
|
|
|
function addNewSeries() {
|
2011-06-28 05:01:54 +00:00
|
|
|
var seriesComboBox = $("#seriesList_new").data("tDropDownList");
|
2011-06-28 02:24:42 +00:00
|
|
|
var qualityComboBox = $("#qualityList_new").data("tDropDownList");
|
|
|
|
var path = $("input[name='selectedRootDir']:checked").val();
|
|
|
|
|
|
|
|
sendToServerNew(seriesComboBox.value(), path, seriesComboBox.text(), qualityComboBox.value());
|
|
|
|
}
|
2011-05-28 07:16:16 +00:00
|
|
|
|
2011-06-28 02:24:42 +00:00
|
|
|
function sendToServerNew(id, rootPath, seriesName, quality) {
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: addNewSeriesUrl,
|
|
|
|
data: jQuery.param({ rootPath: rootPath, seriesName: seriesName, seriesId: id, qualityProfileId: quality }),
|
|
|
|
error: function (req, status, error) {
|
|
|
|
alert("Sorry! We could not add " + seriesName + " at this time. " + error);
|
|
|
|
},
|
|
|
|
success: function (data, textStatus, jqXHR) {
|
|
|
|
//Clear the search box
|
|
|
|
$("#seriesList_new").data("tComboBox").text('');
|
2011-05-28 07:16:16 +00:00
|
|
|
|
2011-06-28 02:24:42 +00:00
|
|
|
//Through up an alert if we failed to add the series
|
|
|
|
if (data != 'ok')
|
|
|
|
alert("Sorry! We could not add " + seriesName + ", does it already exist?");
|
|
|
|
|
|
|
|
else
|
|
|
|
closeAddNewSeries(); //Close the Window!
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
}
|