AddSeries views updated to RAZOR.

This commit is contained in:
Mark McDowall 2011-04-20 21:10:08 -07:00
parent d3d138c2af
commit 3e28862e14
3 changed files with 61 additions and 79 deletions

View File

@ -1,44 +0,0 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<String>>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Add Existing Series
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
if (Model.Count() == 0)
Html.DisplayText("No Series to Add");
%>
<%:Html.DropDownList("masterDropbox", (SelectList) ViewData["qualities"],
new {style = "width: 100px;", id = "masterDropboxId"})%>
<%:
@Html.Telerik().DropDownList().Name("tester").BindTo((SelectList) ViewData["qualities"]).HtmlAttributes(
new {style = "width: 100px", @class = "qualityDropbox"})%>
<%
foreach (var path in Model)
{
Html.RenderAction("RenderPartial", "AddSeries", new {path});
}
%>
<script type="text/javascript">
$("#masterDropboxId").change(function () {
var selectedQuality = $('#masterDropboxId').get(0).selectedIndex;
//$(".qualityDropbox").data("tComboBox").value(selectedQuality);
//$(".qualityDropbox").data("tDropDownList").val(selectedQuality);
var comboBox = $(".qualityDropbox").data("tDropDownList");
comboBox.select(selectedQuality);
});
</script>
</asp:Content>

View File

@ -0,0 +1,35 @@
@model IEnumerable<String>
@section TitleContent{
Add Existing Series
}
@section MainContent{
@if (Model.Count() == 0)
{
@Html.DisplayText("No Series to Add");
}
@Html.DropDownList("masterDropbox", (SelectList) ViewData["qualities"],
new {style = "width: 100px;", id = "masterDropboxId"})
@Html.Telerik().DropDownList().Name("tester").BindTo((SelectList) ViewData["qualities"]).HtmlAttributes(
new {style = "width: 100px", @class = "qualityDropbox"})
@foreach (var path in Model)
{
Html.RenderAction("RenderPartial", "AddSeries", new {path});
}
<script type="text/javascript">
$("#masterDropboxId").change(function () {
var selectedQuality = $('#masterDropboxId').get(0).selectedIndex;
//$(".qualityDropbox").data("tComboBox").value(selectedQuality);
//$(".qualityDropbox").data("tDropDownList").val(selectedQuality);
var comboBox = $(".qualityDropbox").data("tDropDownList");
comboBox.select(selectedQuality);
});
</script>
}

View File

@ -1,48 +1,50 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NzbDrone.Web.Models.AddNewSeriesModel>" %> @model NzbDrone.Web.Models.AddNewSeriesModel
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
@section TitleContent{
Add New Series Add New Series
<script type="text/javascript"> <script type="text/javascript">
jQuery(document).ready(function () { jQuery(document).ready(function () {
$('#searchButton').attr('disabled', ''); $('#searchButton').attr('disabled', '');
}); });
</script> </script>
</asp:Content> }
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
@section MainContent{
<div style="width: 60%"> <div style="width: 60%">
<div style="display: inline"> <div style="display: inline">
<%=Html.Label("Enter a Series Name")%> @Html.Label("Enter a Series Name")
<%=Html.TextBox("new_series_name", String.Empty, new {id = "new_series_id"})%> @Html.TextBox("new_series_name", String.Empty, new {id = "new_series_id"})
<button class="t.button" id="searchButton" disabled="disabled" onclick="searchSeries ()"> <button class="t.button" id="searchButton" disabled="disabled" onclick="searchSeries ()">
Search</button> Search</button>
</div> </div>
<div style="display: inline; float: right;"> <div style="display: inline; float: right;">
<%=Html.LabelFor(m => m.QualityProfileId)%> @Html.LabelFor(m => m.QualityProfileId)
<%:Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)%> @Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)
</div> </div>
</div> </div>
<div id="result">
</div> <div id="result"></div>
<div id="RootDirectories" class="rootDirectories" style="display: none"> <div id="RootDirectories" class="rootDirectories" style="display: none">
<fieldset> <fieldset>
<legend>Root TV Folders</legend> <legend>Root TV Folders</legend>
<% @{int d = 0;}
int d = 0;%>
<% @foreach (var dir in Model.RootDirectories)
foreach (var dir in Model.RootDirectories) {
{%> @Html.RadioButton("selectedRootDir", dir.Path, d == 0, new {@class = "dirList examplePart", id = "dirRadio_" + d});
<%:Html.RadioButton("selectedRootDir", dir.Path, d == 0, @Html.Label(dir.Path)
new {@class = "dirList examplePart", id = "dirRadio_" + d})%> }
<%:Html.Label(dir.Path)%>
<%
}%>
</fieldset> </fieldset>
<div id="example"> <div id="example">
</div> </div>
<button class="t.button" onclick="addSeries ()"> <button class="t.button" onclick="addSeries ()">
Add New Series</button> Add New Series</button>
</div> </div>
<div id="addResult">
</div> <div id="addResult"></div>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
$('#new_series_id').bind('keydown', function (e) { $('#new_series_id').bind('keydown', function (e) {
@ -55,25 +57,16 @@
var seriesSearch = $('#new_series_id'); var seriesSearch = $('#new_series_id');
$("#result").text("Searching..."); $("#result").text("Searching...");
$("#result").load('<%=Url.Action("SearchForSeries", "Series")%>', { $("#result").load('<%=Url.Action("SearchForSeries", "Series")%>', {
seriesName: seriesSearch.val() seriesName: seriesSearch.val()
}); });
document.getElementById('RootDirectories').style.display = 'inline'; document.getElementById('RootDirectories').style.display = 'inline';
} }
function addSeries() { function addSeries() {
//Get the selected tvdbid + selected root folder
//jquery bit below doesn't want to work...
var checkedSeries = $("input[name='selectedSeries']:checked").val(); var checkedSeries = $("input[name='selectedSeries']:checked").val();
//var checkedSeries = $('input.searchRadio:checked').val();
//var checkedSeries = $('input:radio[name=selectedSeries]:checked').val();
//var checkedSeries = $('input:radio[class=searchRadio]:checked').val();
var checkedDir = $("input[name='selectedRootDir']:checked").val(); var checkedDir = $("input[name='selectedRootDir']:checked").val();
var id = "#" + checkedSeries + "_text"; var id = "#" + checkedSeries + "_text";
var seriesName = $(id).val(); var seriesName = $(id).val();
var qualityProfileId = $("#QualityProfileId").val(); var qualityProfileId = $("#QualityProfileId").val();
@ -102,6 +95,4 @@
}); });
</script> </script>
<div id="tester"> }
</div>
</asp:Content>