RAZOR'd Series and the Error page.

NzbDrone has been RAZORfied completely now, die ASPX pages!
This commit is contained in:
Mark McDowall 2011-04-21 00:14:47 -07:00
parent 13af6663fe
commit 33b67a138c
13 changed files with 237 additions and 262 deletions

View File

@ -614,18 +614,10 @@
<Content Include="Scripts\jquery-tgc-countdown-1.0.js" />
<Content Include="Scripts\jquery.simpledropdown.js" />
<Content Include="Scripts\Notification.js" />
<Content Include="Views\AddSeries\AddExisting.cshtml" />
<Content Include="Views\AddSeries\AddNew.cshtml" />
<None Include="Views\AddSeries\AddSeriesItem.cshtml" />
<Content Include="Views\History\Index.aspx" />
<Content Include="Views\Log\Index.aspx" />
<Content Include="Views\AddSeries\AddExisting.aspx" />
<Content Include="Views\AddSeries\AddNew.aspx" />
<Content Include="Views\Series\Details.aspx" />
<Content Include="Views\Series\Edit.aspx" />
<Content Include="Views\Series\index.aspx" />
<Content Include="Views\Series\SeriesSearchResults.ascx" />
<Content Include="Views\Series\SubMenu.ascx" />
<Content Include="Views\Settings\Index2.aspx" />
<Content Include="Views\Upcoming\Index.aspx" />
<Content Include="Views\Series\SeriesSearchResults2.ascx" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
@ -667,6 +659,14 @@
<Content Include="Views\Shared\Footer.cshtml" />
<Content Include="Views\Settings\Index.cshtml" />
<Content Include="Views\_ViewStart.cshtml" />
<Content Include="Views\History\Index.cshtml" />
<Content Include="Views\Log\Index.cshtml" />
<Content Include="Views\Upcoming\Index.cshtml" />
<Content Include="Views\Series\Details.cshtml" />
<Content Include="Views\Series\Edit.cshtml" />
<Content Include="Views\Series\Index.cshtml" />
<Content Include="Views\Series\SubMenu.cshtml" />
<Content Include="Views\Series\SeriesSearchResult.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View File

@ -57,7 +57,7 @@
var seriesSearch = $('#new_series_id');
$("#result").text("Searching...");
$("#result").load('<%=Url.Action("SearchForSeries", "Series")%>', {
$("#result").load('@Url.Action("SearchForSeries", "Series")', {
seriesName: seriesSearch.val()
});
@ -71,7 +71,7 @@
var seriesName = $(id).val();
var qualityProfileId = $("#QualityProfileId").val();
$("#addResult").load('<%=Url.Action("AddSeries", "Series")%>', {
$("#addResult").load('@Url.Action("AddSeries", "AddSeries")', {
dir: checkedDir,
seriesId: checkedSeries,
seriesName: seriesName,

View File

@ -1,12 +1,14 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NzbDrone.Core.Repository.Series>" %>
<%@ Import Namespace="NzbDrone.Core.Repository" %>
<%@ Import Namespace="NzbDrone.Web.Models" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
<%:Model.Title%>
</asp:Content>
<asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server">
<%
Html.Telerik().Menu().Name("SeriesMenu").Items(items =>
@model NzbDrone.Core.Repository.Series
@using NzbDrone.Core.Repository
@using NzbDrone.Web.Models
@section TitleContent{
@Model.Title
}
@section ActionMenu{
@{Html.Telerik().Menu().Name("SeriesMenu").Items(items =>
{
items.Add().Text("Edit").Action("Edit", "Series",
new
@ -31,49 +33,47 @@
Model.
SeriesId
});
}).Render();
%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
}).Render();}
}
@section MainContent{
<fieldset>
<div class="display-label">
ID</div>
<div class="display-field">
<%:Model.SeriesId%></div>
@Model.SeriesId</div>
<div class="display-label">
Overview</div>
<div class="display-field">
<%:Model.Overview%></div>
@Model.Overview</div>
<div class="display-label">
Status</div>
<div class="display-field">
<%:Model.Status%></div>
@Model.Status</div>
<div class="display-label">
AirTimes</div>
<div class="display-field">
<%:Model.AirTimes%></div>
@Model.AirTimes</div>
<div class="display-label">
Language</div>
<div class="display-field">
<%:Model.Language.ToUpper()%></div>
@Model.Language.ToUpper()</div>
<div class="display-label">
Location</div>
<div class="display-field">
<%:Model.Path%></div>
@Model.Path</div>
</fieldset>
<%
//Todo: This breaks when using SQLServer... thoughts?
//Normal Seasons
foreach (var season in Model.Seasons.Where(s => s.SeasonNumber > 0).Reverse())
@*Todo: This breaks when using SQLServer... thoughts?*@
@foreach (var season in Model.Seasons.Where(s => s.SeasonNumber > 0).Reverse())
{
%>
<br />
<h3>
Season
<%:season.SeasonNumber%></h3>
<%
<h3>Season @season.SeasonNumber</h3>
Season season1 = season;
Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season.SeasonNumber)
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(o => o.EpisodeId)
@ -107,17 +107,16 @@
}
//Specials
var specialSeasons = Model.Seasons.Where(s => s.SeasonNumber == 0).FirstOrDefault();
@{var specialSeasons = Model.Seasons.Where(s => s.SeasonNumber == 0).FirstOrDefault();}
if (specialSeasons != null)
@if (specialSeasons != null)
{
%>
<br />
<h3>
Specials</h3>
<%
Html.Telerik().Grid(specialSeasons.Episodes).Name("seasons_specials")
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode");
@ -129,14 +128,13 @@
.Footer(false)
.Render();
}
%>
</asp:Content>
<asp:Content ContentPlaceHolderID="Scripts" runat="server">
<script type="text/javascript">
}
@section Scripts{
<script type="text/javascript">
function episodeDetailExpanded(e) {
$console.log("OnDetailViewExpand :: " + e.masterRow.cells[1].innerHTML);
}
</script>
</asp:Content>
}

View File

@ -1,115 +0,0 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<NzbDrone.Core.Repository.Series>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Edit
<script type="text/javascript">
$(document).ready(function () {
var options = {
target: '#result',
beforeSubmit: showRequest,
success: showResponse,
type: 'post',
resetForm: false
};
$('#form').ajaxForm(options);
$('#save_button').attr('disabled', '');
});
function showRequest(formData, jqForm, options) {
$("#result").empty().html('Saving Series...');
$("#form :input").attr("disabled", true);
}
function showResponse(responseText, statusText, xhr, $form) {
$("#result").empty().html(responseText);
$("#form :input").attr("disabled", false);
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2><%:Html.DisplayTextFor(model => model.Title)%></h2>
<%
Html.EnableClientValidation();%>
<%
using (Html.BeginForm("Edit", "Series", FormMethod.Post, new {id = "form", name = "form"}))
{%>
<fieldset>
<legend>Edit</legend>
<div class="editor-label">
<%:Html.LabelFor(model => model.Path)%>
</div>
<div class="editor-field">
<%:Html.TextBoxFor(model => model.Path)%>
<%:Html.ValidationMessageFor(model => model.Path)%>
</div>
<div class="editor-label">
<%:Html.LabelFor(model => model.Monitored)%>
</div>
<div class="editor-field">
<%:Html.CheckBoxFor(model => model.Monitored)%>
<%:Html.ValidationMessageFor(model => model.Monitored)%>
</div>
<div class="editor-label">
<%:Html.LabelFor(model => model.SeasonFolder)%>
</div>
<div class="editor-field">
<%:Html.CheckBoxFor(model => model.SeasonFolder)%>
<%:Html.ValidationMessageFor(model => model.SeasonFolder)%>
</div>
<div class="editor-label">
<%:Html.LabelFor(model => model.QualityProfileId)%>
</div>
<div class="editor-field">
<%:Html.DropDownListFor(model => model.QualityProfileId, (SelectList) ViewData["SelectList"])%>
<%:Html.ValidationMessageFor(model => model.QualityProfileId)%>
</div>
<div class="hidden" style="display:none;">
<%:Html.TextBoxFor(model => model.SeriesId)%>
<%:Html.TextBoxFor(model => model.Title)%>
<%:Html.TextBoxFor(model => model.CleanTitle)%>
<%:Html.TextBoxFor(model => model.Status)%>
<%:Html.TextBoxFor(model => model.Overview)%>
<%:Html.TextBoxFor(model => model.AirsDayOfWeek)%>
<%:Html.TextBoxFor(model => model.AirTimes)%>
<%:Html.TextBoxFor(model => model.Language)%>
</div>
<p>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</p>
</fieldset>
<%
}%>
<div>
<%:Html.ActionLink("Back to Show", "Details", new {seriesId = Model.SeriesId})%> |
<%:Html.ActionLink("Back to List", "Index")%>
<%:Html.ActionLink("Delete Series", "Delete", new {seriesId = Model.SeriesId})%>
</div>
<div id="result"></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="headerContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ActionMenu" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="Scripts" runat="server">
</asp:Content>

View File

@ -0,0 +1,98 @@
@model NzbDrone.Core.Repository.Series
@section TitleContent{
Edit
}
@section Scripts{
<script type="text/javascript">
$(document).ready(function () {
var options = {
target: '#result',
beforeSubmit: showRequest,
success: showResponse,
type: 'post',
resetForm: false
};
$('#form').ajaxForm(options);
$('#save_button').attr('disabled', '');
});
function showRequest(formData, jqForm, options) {
$("#result").empty().html('Saving Series...');
$("#form :input").attr("disabled", true);
}
function showResponse(responseText, statusText, xhr, $form) {
$("#result").empty().html(responseText);
$("#form :input").attr("disabled", false);
}
</script>
}
@section MainContent{
<h2>@Html.DisplayTextFor(model => model.Title)</h2>
@using (Html.BeginForm("Edit", "Series", FormMethod.Post, new { id = "form", name = "form" }))
{
<fieldset>
<legend>Edit</legend>
<div class="editor-label">
@Html.LabelFor(model => model.Path)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.Path)
@Html.ValidationMessageFor(model => model.Path)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.Monitored)
</div>
<div class="editor-field">
@Html.CheckBoxFor(model => model.Monitored)
@Html.ValidationMessageFor(model => model.Monitored)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.SeasonFolder)
</div>
<div class="editor-field">
@Html.CheckBoxFor(model => model.SeasonFolder)
@Html.ValidationMessageFor(model => model.SeasonFolder)
</div>
<div class="editor-label">
@Html.LabelFor(model => model.QualityProfileId)
</div>
<div class="editor-field">
@Html.DropDownListFor(model => model.QualityProfileId, (SelectList) ViewData["SelectList"])
@Html.ValidationMessageFor(model => model.QualityProfileId)
</div>
<div class="hidden" style="display:none;">
@Html.TextBoxFor(model => model.SeriesId)
@Html.TextBoxFor(model => model.Title)
@Html.TextBoxFor(model => model.CleanTitle)
@Html.TextBoxFor(model => model.Status)
@Html.TextBoxFor(model => model.Overview)
@Html.TextBoxFor(model => model.AirsDayOfWeek)
@Html.TextBoxFor(model => model.AirTimes)
@Html.TextBoxFor(model => model.Language)
</div>
<p>
<input type="submit" id="save_button" value="Save" disabled="disabled" />
</p>
</fieldset>
}
<div>
@Html.ActionLink("Back to Show", "Details", new {seriesId = Model.SeriesId}) |
@Html.ActionLink("Back to List", "Index")
@Html.ActionLink("Delete Series", "Delete", new {seriesId = Model.SeriesId})
</div>
<div id="result"></div>
}

View File

@ -0,0 +1,27 @@
@model IEnumerable<NzbDrone.Core.Repository.Series>
@section TitleContent{
Series
}
@section ActionMenu{
@{Html.RenderPartial("SubMenu");}
}
@section MainContent{
@{Html.Telerik().Grid(Model).Name("Grid")
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Template(c => @Html.ActionLink(c.Title ?? "New Series", "Details",
new {seriesId = c.SeriesId})
).Title("Title");
columns.Bound(o => o.Seasons.Count).Title("Seasons");
columns.Bound(o => o.QualityProfile.Name).Title("Quality");
columns.Bound(o => o.Status);
columns.Bound(o => o.AirsDayOfWeek);
columns.Bound(o => o.Path);
})
.Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(false))
.Render();}
}

View File

@ -1,30 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<List<NzbDrone.Web.Models.SeriesSearchResultModel>>" %>
<div id="searchResults">
<fieldset>
<legend>Search Results</legend>
<%
if (Model.Count == 0)
{%>
<b>No results found for the series name</b>
<%
}
%>
<%
int r = 0;%>
<%
foreach (var result in Model)
{%>
<%:Html.RadioButton("selectedSeries", result.TvDbId, r == 0,
new {@class = "searchRadio examplePart", id = "searchRadio_" + r})%>
<b>
<%:result.TvDbName + " (" + result.FirstAired.ToShortDateString()%>)
<%:Html.TextBox(result.TvDbName + "_text", result.TvDbName,
new {id = result.TvDbId + "_text", style = "display:none"})%>
<%
r++;%>
<br />
<%
}%>
</fieldset>
</div>

View File

@ -0,0 +1,30 @@
@model List<NzbDrone.Web.Models.SeriesSearchResultModel>
<div id="searchResults">
<fieldset>
<legend>Search Results</legend>
@if (Model.Count == 0)
{
<b>No results found for the series name</b>
}
@{var open = "(";}
@{var close = ")";}
@{int r = 0;}
@foreach (var result in Model)
{
@Html.RadioButton("selectedSeries", result.TvDbId, r == 0,
new {@class = "searchRadio examplePart", id = "searchRadio_" + r})
<b>@result.TvDbName</b> @open @result.FirstAired.ToShortDateString() @close
<br/>
@Html.TextBox(result.TvDbName + "_text", result.TvDbName, new { id = result.TvDbId + "_text", style = "display:none" })
r++;
}
</fieldset>
</div>

View File

@ -1,21 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<%@ Import Namespace="NzbDrone.Web.Controllers" %>
<%
Html.Telerik().Menu().Name("telerikGrid").Items(items =>
{
items.Add().Text("Add Series")
.Items(
subItem =>
subItem.Add().Text("New Series").Action
<AddSeriesController>(c => c.AddNew()))
.Items(
subItem =>
subItem.Add().Text("Existing Series").Action
<AddSeriesController>(c => c.AddExisting()));
items.Add().Text("Start RSS Sync").Action<SeriesController>(
c => c.RssSync());
items.Add().Text("Rename All").Action<SeriesController>(
c => c.RenameAll());
}).Render();
%>

View File

@ -0,0 +1,17 @@
@using NzbDrone.Web.Controllers
@{Html.Telerik().Menu().Name("telerikGrid").Items(items =>
{
items.Add().Text("Add Series")
.Items(
subItem =>
subItem.Add().Text("New Series").Action<AddSeriesController>(c => c.AddNew()))
.Items(
subItem =>
subItem.Add().Text("Existing Series").Action<AddSeriesController>(c => c.AddExisting()));
items.Add().Text("Start RSS Sync").Action<SeriesController>(
c => c.RssSync());
items.Add().Text("Rename All").Action<SeriesController>(
c => c.RenameAll());
}).Render();}

View File

@ -1,33 +0,0 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<NzbDrone.Core.Repository.Series>>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Series
</asp:Content>
<asp:Content ID="Menu" ContentPlaceHolderID="ActionMenu" runat="server">
<%
Html.RenderPartial("SubMenu");
%>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Template(c =>
{
%>
<%:Html.ActionLink(c.Title ?? "New Series",
"Details",
new {seriesId = c.SeriesId})%>
<%
}).Title("Title");
columns.Bound(o => o.Seasons.Count).Title("Seasons");
columns.Bound(o => o.QualityProfile.Name).Title("Quality");
columns.Bound(o => o.Status);
columns.Bound(o => o.AirsDayOfWeek);
columns.Bound(o => o.Path);
})
.Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(false))
.Render();
%>
</asp:Content>

View File

@ -1,11 +0,0 @@
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<System.Web.Mvc.HandleErrorInfo>" %>
<asp:Content ID="errorTitle" ContentPlaceHolderID="TitleContent" runat="server">
EPIC FAIL!!!
</asp:Content>
<asp:Content ID="errorContent" ContentPlaceHolderID="MainContent" runat="server">
<h2>
<%:Model.Exception.Message%>
</h2>
<br />
<%:Model.Exception.ToString()%>
</asp:Content>

View File

@ -0,0 +1,15 @@
@model System.Web.Mvc.HandleErrorInfo
@section TitleContent
{
EPIC FAIL!!!
}
@section MainContent
{
<h2>
@Model.Exception.Message
</h2>
<br />
@Model.Exception.ToString()
}