From 3e28862e14e3172d639a977adf17d5a43a1012be Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 20 Apr 2011 21:10:08 -0700 Subject: [PATCH 1/6] AddSeries views updated to RAZOR. --- NzbDrone.Web/Views/AddSeries/AddExisting.aspx | 44 ------------- .../Views/AddSeries/AddExisting.cshtml | 35 +++++++++++ .../AddSeries/{AddNew.aspx => AddNew.cshtml} | 61 ++++++++----------- 3 files changed, 61 insertions(+), 79 deletions(-) delete mode 100644 NzbDrone.Web/Views/AddSeries/AddExisting.aspx create mode 100644 NzbDrone.Web/Views/AddSeries/AddExisting.cshtml rename NzbDrone.Web/Views/AddSeries/{AddNew.aspx => AddNew.cshtml} (62%) diff --git a/NzbDrone.Web/Views/AddSeries/AddExisting.aspx b/NzbDrone.Web/Views/AddSeries/AddExisting.aspx deleted file mode 100644 index eabe101b0..000000000 --- a/NzbDrone.Web/Views/AddSeries/AddExisting.aspx +++ /dev/null @@ -1,44 +0,0 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage>" %> - - Add Existing Series - - - <% - 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}); - } - -%> - - - - \ No newline at end of file diff --git a/NzbDrone.Web/Views/AddSeries/AddExisting.cshtml b/NzbDrone.Web/Views/AddSeries/AddExisting.cshtml new file mode 100644 index 000000000..3c6e98df7 --- /dev/null +++ b/NzbDrone.Web/Views/AddSeries/AddExisting.cshtml @@ -0,0 +1,35 @@ +@model IEnumerable + +@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}); + } + + +} \ No newline at end of file diff --git a/NzbDrone.Web/Views/AddSeries/AddNew.aspx b/NzbDrone.Web/Views/AddSeries/AddNew.cshtml similarity index 62% rename from NzbDrone.Web/Views/AddSeries/AddNew.aspx rename to NzbDrone.Web/Views/AddSeries/AddNew.cshtml index 995b545c8..c1c5ba653 100644 --- a/NzbDrone.Web/Views/AddSeries/AddNew.aspx +++ b/NzbDrone.Web/Views/AddSeries/AddNew.cshtml @@ -1,48 +1,50 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> - +@model NzbDrone.Web.Models.AddNewSeriesModel + +@section TitleContent{ Add New Series + - - +} + +@section MainContent{
- <%=Html.Label("Enter a Series Name")%> - <%=Html.TextBox("new_series_name", String.Empty, new {id = "new_series_id"})%> + @Html.Label("Enter a Series Name") + @Html.TextBox("new_series_name", String.Empty, new {id = "new_series_id"})
- <%=Html.LabelFor(m => m.QualityProfileId)%> - <%:Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)%> + @Html.LabelFor(m => m.QualityProfileId) + @Html.DropDownListFor(m => m.QualityProfileId, Model.QualitySelectList)
-
-
+ +
+ -
-
+ +
+ -
-
-
+} \ No newline at end of file From 273ab14a783b40683d2559d407bab843855d5a14 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 20 Apr 2011 21:20:39 -0700 Subject: [PATCH 2/6] Added Scripts section to SiteLayout. History view RAZORed. --- .../History/{Index.aspx => Index.cshtml} | 43 +++++++++---------- NzbDrone.Web/Views/Shared/SiteLayout.cshtml | 3 ++ 2 files changed, 23 insertions(+), 23 deletions(-) rename NzbDrone.Web/Views/History/{Index.aspx => Index.cshtml} (60%) diff --git a/NzbDrone.Web/Views/History/Index.aspx b/NzbDrone.Web/Views/History/Index.cshtml similarity index 60% rename from NzbDrone.Web/Views/History/Index.aspx rename to NzbDrone.Web/Views/History/Index.cshtml index c4d4c1b08..51747ccaf 100644 --- a/NzbDrone.Web/Views/History/Index.aspx +++ b/NzbDrone.Web/Views/History/Index.cshtml @@ -1,7 +1,7 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage>" %> -<%@ Import Namespace="NzbDrone.Web.Models" %> +@model List +@using NzbDrone.Web.Models - +@section Scripts{ - - +} + +@section TitleContent{ History - - - <% - Html.Telerik().Menu().Name("historyMenu").Items(items => - { - items.Add().Text("Trim History").Action("Trim", - "History"); - items.Add().Text("Purge History").Action("Purge", - "History"); - }).Render(); -%> - - - <% - Html.Telerik().Grid().Name("history") +} + +@section ActionMenu{ + @{Html.Telerik().Menu().Name("historyMenu").Items(items => + { + items.Add().Text("Trim History").Action("Trim", "History"); + items.Add().Text("Purge History").Action("Purge", "History"); + }).Render();} +} + +@section MainContent{ + @{Html.Telerik().Grid().Name("history") .Columns(columns => { columns.Bound(c => c.SeriesTitle).Title("Series Name").Width(120); @@ -61,6 +59,5 @@ c.PageSize(50).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious)) //.Filterable() //.ClientEvents(c => c.OnRowDataBound("onRowDataBound")) - .Render(); -%> - + .Render();} +} \ No newline at end of file diff --git a/NzbDrone.Web/Views/Shared/SiteLayout.cshtml b/NzbDrone.Web/Views/Shared/SiteLayout.cshtml index fed6c00c5..9f877b17a 100644 --- a/NzbDrone.Web/Views/Shared/SiteLayout.cshtml +++ b/NzbDrone.Web/Views/Shared/SiteLayout.cshtml @@ -47,6 +47,9 @@ + + @RenderSection("Scripts", required: false) + @{Html.Telerik().ScriptRegistrar().Scripts( c => c.Add("jquery-ui-1.8.8.min.js") .Add("jquery.form.js") From 13af6663fef0e8e655bb63bbb13d344ed20a865a Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 20 Apr 2011 23:18:28 -0700 Subject: [PATCH 3/6] RAZOR'd Log & Upcoming. Added CSS for setting Grid font size. --- NzbDrone.Web/Content/style.css | 6 +++ .../Views/Log/{Index.aspx => Index.cshtml} | 36 +++++++------ NzbDrone.Web/Views/Shared/SiteLayout.cshtml | 3 -- .../Upcoming/{Index.aspx => Index.cshtml} | 53 +++++++++---------- 4 files changed, 50 insertions(+), 48 deletions(-) rename NzbDrone.Web/Views/Log/{Index.aspx => Index.cshtml} (68%) rename NzbDrone.Web/Views/Upcoming/{Index.aspx => Index.cshtml} (83%) diff --git a/NzbDrone.Web/Content/style.css b/NzbDrone.Web/Content/style.css index 1e0e80e92..7f44c4fa0 100644 --- a/NzbDrone.Web/Content/style.css +++ b/NzbDrone.Web/Content/style.css @@ -268,3 +268,9 @@ button, input[type="button"], input[type="submit"], input[type="reset"] { width: 400px; } + +/* Set the font size for Grids */ +.Grid +{ + font-size: 13px; +} \ No newline at end of file diff --git a/NzbDrone.Web/Views/Log/Index.aspx b/NzbDrone.Web/Views/Log/Index.cshtml similarity index 68% rename from NzbDrone.Web/Views/Log/Index.aspx rename to NzbDrone.Web/Views/Log/Index.cshtml index 748108407..927c11cd3 100644 --- a/NzbDrone.Web/Views/Log/Index.aspx +++ b/NzbDrone.Web/Views/Log/Index.cshtml @@ -1,5 +1,6 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage>" %> - +@model IEnumerable + +@section Scripts{ - - +} + +@section TitleContent{ Logs - - - <% - Html.Telerik().Menu().Name("logMenu").Items(items => items.Add().Text("Clear Logs").Action("Clear", "Log")). - Render(); -%> - - - <% - Html.Telerik().Grid(Model).Name("logs") +} + +@section ActionMenu{ + @{Html.Telerik().Menu().Name("logMenu").Items(items => items.Add().Text("Clear Logs").Action("Clear", "Log")) + .Render();} +} + +@section MainContent{ + @{Html.Telerik().Grid(Model).Name("logsGrid") + .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => { columns.Bound(c => c.Time).Title("Time").Width(190); @@ -49,6 +51,6 @@ c.PageSize(50).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious)) .Filterable() .ClientEvents(c => c.OnRowDataBound("onRowDataBound")) - .Render(); -%> - + .Render();} +} + diff --git a/NzbDrone.Web/Views/Shared/SiteLayout.cshtml b/NzbDrone.Web/Views/Shared/SiteLayout.cshtml index 9f877b17a..a3a846299 100644 --- a/NzbDrone.Web/Views/Shared/SiteLayout.cshtml +++ b/NzbDrone.Web/Views/Shared/SiteLayout.cshtml @@ -14,9 +14,6 @@ - @**@ - @**@ - @**@ @RenderSection("HeaderContent", required: false) diff --git a/NzbDrone.Web/Views/Upcoming/Index.aspx b/NzbDrone.Web/Views/Upcoming/Index.cshtml similarity index 83% rename from NzbDrone.Web/Views/Upcoming/Index.aspx rename to NzbDrone.Web/Views/Upcoming/Index.cshtml index 1e87c184b..0f32918b4 100644 --- a/NzbDrone.Web/Views/Upcoming/Index.aspx +++ b/NzbDrone.Web/Views/Upcoming/Index.cshtml @@ -1,10 +1,10 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage>" %> -<%@ Import Namespace="NzbDrone.Web.Models" %> +@model List +@using NzbDrone.Web.Models + +@section Scripts{ - - - - Upcoming - - - <% - Html.Telerik().Menu().Name("historyMenu").Items( - items => { items.Add().Text("Start RSS Sync").Action("RssSync", "Series"); }).Render(); -%> - - +} +@section TitleContent{ + Upcoming +} + +@section ActionMenu{ + @{Html.Telerik().Menu().Name("historyMenu").Items( + items => { items.Add().Text("Start RSS Sync").Action("RssSync", "Series"); }).Render();} +} + +@section MainContent{

Yesterday

- <% - Html.Telerik().Grid().Name("Yesterday").NoRecordsTemplate( + @{Html.Telerik().Grid().Name("Yesterday").NoRecordsTemplate( "No watched shows aired yesterday") + .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => { columns.Bound(c => c.SeriesName) @@ -59,16 +59,15 @@ //.Pageable(c => c.PageSize(20).Position(GridPagerPosition.Both).Style(GridPagerStyles.PageInput | GridPagerStyles.NextPreviousAndNumeric)) //.Filterable() //.ClientEvents(c => c.OnRowDataBound("onRowDataBound")) - .Render(); -%> + .Render();}

Today

- <% - Html.Telerik().Grid().Name("Today").NoRecordsTemplate("No watched shows airing today.") + @{Html.Telerik().Grid().Name("Today").NoRecordsTemplate("No watched shows airing today.") + .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => { columns.Bound(c => c.SeriesName) @@ -91,17 +90,16 @@ //.Pageable(c => c.PageSize(20).Position(GridPagerPosition.Both).Style(GridPagerStyles.PageInput | GridPagerStyles.NextPreviousAndNumeric)) //.Filterable() //.ClientEvents(c => c.OnRowDataBound("onRowDataBound")) - .Render(); -%> + .Render();}

7-Day Forecast

- <% - Html.Telerik().Grid().Name("Week").NoRecordsTemplate( + @{Html.Telerik().Grid().Name("Week").NoRecordsTemplate( "No watched shows airing in the next week...") + .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => { columns.Bound(c => c.SeriesName) @@ -124,7 +122,6 @@ //.Pageable(c => c.PageSize(20).Position(GridPagerPosition.Both).Style(GridPagerStyles.PageInput | GridPagerStyles.NextPreviousAndNumeric)) //.Filterable() //.ClientEvents(c => c.OnRowDataBound("onRowDataBound")) - .Render(); -%> + .Render();}
-
+} \ No newline at end of file From 33b67a138c48282de931aa7366775b997a5a9c8a Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 21 Apr 2011 00:14:47 -0700 Subject: [PATCH 4/6] RAZOR'd Series and the Error page. NzbDrone has been RAZORfied completely now, die ASPX pages! --- NzbDrone.Web/NzbDrone.Web.csproj | 22 ++-- NzbDrone.Web/Views/AddSeries/AddNew.cshtml | 4 +- .../Series/{Details.aspx => Details.cshtml} | 76 ++++++------ NzbDrone.Web/Views/Series/Edit.aspx | 115 ------------------ NzbDrone.Web/Views/Series/Edit.cshtml | 98 +++++++++++++++ NzbDrone.Web/Views/Series/Index.cshtml | 27 ++++ .../Views/Series/SeriesSearchResults.ascx | 30 ----- .../Views/Series/SeriesSearchResults.cshtml | 30 +++++ NzbDrone.Web/Views/Series/SubMenu.ascx | 21 ---- NzbDrone.Web/Views/Series/SubMenu.cshtml | 17 +++ NzbDrone.Web/Views/Series/index.aspx | 33 ----- NzbDrone.Web/Views/Shared/Error.aspx | 11 -- NzbDrone.Web/Views/Shared/Error.cshtml | 15 +++ 13 files changed, 237 insertions(+), 262 deletions(-) rename NzbDrone.Web/Views/Series/{Details.aspx => Details.cshtml} (82%) delete mode 100644 NzbDrone.Web/Views/Series/Edit.aspx create mode 100644 NzbDrone.Web/Views/Series/Edit.cshtml create mode 100644 NzbDrone.Web/Views/Series/Index.cshtml delete mode 100644 NzbDrone.Web/Views/Series/SeriesSearchResults.ascx create mode 100644 NzbDrone.Web/Views/Series/SeriesSearchResults.cshtml delete mode 100644 NzbDrone.Web/Views/Series/SubMenu.ascx create mode 100644 NzbDrone.Web/Views/Series/SubMenu.cshtml delete mode 100644 NzbDrone.Web/Views/Series/index.aspx delete mode 100644 NzbDrone.Web/Views/Shared/Error.aspx create mode 100644 NzbDrone.Web/Views/Shared/Error.cshtml diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index af29bd968..005585fd1 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -614,18 +614,10 @@ + + - - - - - - - - - - - + Designer @@ -667,6 +659,14 @@ + + + + + + + + diff --git a/NzbDrone.Web/Views/AddSeries/AddNew.cshtml b/NzbDrone.Web/Views/AddSeries/AddNew.cshtml index c1c5ba653..54e6a41e6 100644 --- a/NzbDrone.Web/Views/AddSeries/AddNew.cshtml +++ b/NzbDrone.Web/Views/AddSeries/AddNew.cshtml @@ -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, diff --git a/NzbDrone.Web/Views/Series/Details.aspx b/NzbDrone.Web/Views/Series/Details.cshtml similarity index 82% rename from NzbDrone.Web/Views/Series/Details.aspx rename to NzbDrone.Web/Views/Series/Details.cshtml index 0ce7b7c69..2de7aa9ad 100644 --- a/NzbDrone.Web/Views/Series/Details.aspx +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -1,12 +1,14 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> -<%@ Import Namespace="NzbDrone.Core.Repository" %> -<%@ Import Namespace="NzbDrone.Web.Models" %> - - <%:Model.Title%> - - - <% - 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(); -%> - - + }).Render();} +} + +@section MainContent{ +
ID
- <%:Model.SeriesId%>
+ @Model.SeriesId
Overview
- <%:Model.Overview%>
+ @Model.Overview
Status
- <%:Model.Status%>
+ @Model.Status
AirTimes
- <%:Model.AirTimes%>
+ @Model.AirTimes
Language
- <%:Model.Language.ToUpper()%>
+ @Model.Language.ToUpper()
Location
- <%:Model.Path%>
+ @Model.Path
- <% - //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()) { -%> +
-

- Season - <%:season.SeasonNumber%>

- <% +

Season @season.SeasonNumber

Season season1 = season; Html.Telerik().Grid().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) { -%> +

Specials

- <% - 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(); } -%> -
- - - +} diff --git a/NzbDrone.Web/Views/Series/Edit.aspx b/NzbDrone.Web/Views/Series/Edit.aspx deleted file mode 100644 index 9290a69a5..000000000 --- a/NzbDrone.Web/Views/Series/Edit.aspx +++ /dev/null @@ -1,115 +0,0 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> - - - Edit - - - - - - - - - -

<%:Html.DisplayTextFor(model => model.Title)%>

- - <% - Html.EnableClientValidation();%> - <% - using (Html.BeginForm("Edit", "Series", FormMethod.Post, new {id = "form", name = "form"})) - {%> - -
- Edit - -
- <%:Html.LabelFor(model => model.Path)%> -
-
- <%:Html.TextBoxFor(model => model.Path)%> - <%:Html.ValidationMessageFor(model => model.Path)%> -
- -
- <%:Html.LabelFor(model => model.Monitored)%> -
-
- <%:Html.CheckBoxFor(model => model.Monitored)%> - <%:Html.ValidationMessageFor(model => model.Monitored)%> -
- -
- <%:Html.LabelFor(model => model.SeasonFolder)%> -
-
- <%:Html.CheckBoxFor(model => model.SeasonFolder)%> - <%:Html.ValidationMessageFor(model => model.SeasonFolder)%> -
- -
- <%:Html.LabelFor(model => model.QualityProfileId)%> -
-
- <%:Html.DropDownListFor(model => model.QualityProfileId, (SelectList) ViewData["SelectList"])%> - <%:Html.ValidationMessageFor(model => model.QualityProfileId)%> -
- - - -

- -

-
- <% - }%> - -
- <%: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})%> -
- -
- -
- - - - - - - - - - diff --git a/NzbDrone.Web/Views/Series/Edit.cshtml b/NzbDrone.Web/Views/Series/Edit.cshtml new file mode 100644 index 000000000..8346c013f --- /dev/null +++ b/NzbDrone.Web/Views/Series/Edit.cshtml @@ -0,0 +1,98 @@ +@model NzbDrone.Core.Repository.Series + +@section TitleContent{ + Edit +} + +@section Scripts{ + +} + +@section MainContent{ +

@Html.DisplayTextFor(model => model.Title)

+ + @using (Html.BeginForm("Edit", "Series", FormMethod.Post, new { id = "form", name = "form" })) + { + +
+ Edit + +
+ @Html.LabelFor(model => model.Path) +
+
+ @Html.TextBoxFor(model => model.Path) + @Html.ValidationMessageFor(model => model.Path) +
+ +
+ @Html.LabelFor(model => model.Monitored) +
+
+ @Html.CheckBoxFor(model => model.Monitored) + @Html.ValidationMessageFor(model => model.Monitored) +
+ +
+ @Html.LabelFor(model => model.SeasonFolder) +
+
+ @Html.CheckBoxFor(model => model.SeasonFolder) + @Html.ValidationMessageFor(model => model.SeasonFolder) +
+ +
+ @Html.LabelFor(model => model.QualityProfileId) +
+
+ @Html.DropDownListFor(model => model.QualityProfileId, (SelectList) ViewData["SelectList"]) + @Html.ValidationMessageFor(model => model.QualityProfileId) +
+ + + +

+ +

+
+ } + +
+ @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}) +
+ +
+} \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/Index.cshtml b/NzbDrone.Web/Views/Series/Index.cshtml new file mode 100644 index 000000000..6c55cf444 --- /dev/null +++ b/NzbDrone.Web/Views/Series/Index.cshtml @@ -0,0 +1,27 @@ +@model IEnumerable + +@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();} +} diff --git a/NzbDrone.Web/Views/Series/SeriesSearchResults.ascx b/NzbDrone.Web/Views/Series/SeriesSearchResults.ascx deleted file mode 100644 index e2bc6a17a..000000000 --- a/NzbDrone.Web/Views/Series/SeriesSearchResults.ascx +++ /dev/null @@ -1,30 +0,0 @@ -<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl>" %> -
-
- Search Results - <% - if (Model.Count == 0) - {%> - No results found for the series name - <% - } -%> - <% - int r = 0;%> - <% - foreach (var result in Model) - {%> - <%:Html.RadioButton("selectedSeries", result.TvDbId, r == 0, - new {@class = "searchRadio examplePart", id = "searchRadio_" + r})%> - - <%:result.TvDbName + " (" + result.FirstAired.ToShortDateString()%>) - <%:Html.TextBox(result.TvDbName + "_text", result.TvDbName, - new {id = result.TvDbId + "_text", style = "display:none"})%> - <% - - r++;%> -
- <% - }%> -
-
diff --git a/NzbDrone.Web/Views/Series/SeriesSearchResults.cshtml b/NzbDrone.Web/Views/Series/SeriesSearchResults.cshtml new file mode 100644 index 000000000..ee5f5297b --- /dev/null +++ b/NzbDrone.Web/Views/Series/SeriesSearchResults.cshtml @@ -0,0 +1,30 @@ +@model List + +
+
+ Search Results + @if (Model.Count == 0) + { + No results found for the series name + } + + @{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}) + + + @result.TvDbName @open @result.FirstAired.ToShortDateString() @close + + +
+ + @Html.TextBox(result.TvDbName + "_text", result.TvDbName, new { id = result.TvDbId + "_text", style = "display:none" }) + r++; + } + +
+
diff --git a/NzbDrone.Web/Views/Series/SubMenu.ascx b/NzbDrone.Web/Views/Series/SubMenu.ascx deleted file mode 100644 index cfa5edc81..000000000 --- a/NzbDrone.Web/Views/Series/SubMenu.ascx +++ /dev/null @@ -1,21 +0,0 @@ -<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> -<%@ 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 - (c => c.AddNew())) - .Items( - subItem => - subItem.Add().Text("Existing Series").Action - (c => c.AddExisting())); - - items.Add().Text("Start RSS Sync").Action( - c => c.RssSync()); - items.Add().Text("Rename All").Action( - c => c.RenameAll()); - }).Render(); -%> \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/SubMenu.cshtml b/NzbDrone.Web/Views/Series/SubMenu.cshtml new file mode 100644 index 000000000..020c5e754 --- /dev/null +++ b/NzbDrone.Web/Views/Series/SubMenu.cshtml @@ -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(c => c.AddNew())) + .Items( + subItem => + subItem.Add().Text("Existing Series").Action(c => c.AddExisting())); + + items.Add().Text("Start RSS Sync").Action( + c => c.RssSync()); + items.Add().Text("Rename All").Action( + c => c.RenameAll()); + }).Render();} \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/index.aspx b/NzbDrone.Web/Views/Series/index.aspx deleted file mode 100644 index a72599ec3..000000000 --- a/NzbDrone.Web/Views/Series/index.aspx +++ /dev/null @@ -1,33 +0,0 @@ -<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage>" %> - - Series - - - <% - Html.RenderPartial("SubMenu"); -%> - - - <% - 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(); -%> - diff --git a/NzbDrone.Web/Views/Shared/Error.aspx b/NzbDrone.Web/Views/Shared/Error.aspx deleted file mode 100644 index 26b89d445..000000000 --- a/NzbDrone.Web/Views/Shared/Error.aspx +++ /dev/null @@ -1,11 +0,0 @@ -<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> - - EPIC FAIL!!! - - -

- <%:Model.Exception.Message%> -

-
- <%:Model.Exception.ToString()%> -
diff --git a/NzbDrone.Web/Views/Shared/Error.cshtml b/NzbDrone.Web/Views/Shared/Error.cshtml new file mode 100644 index 000000000..0afa1dc46 --- /dev/null +++ b/NzbDrone.Web/Views/Shared/Error.cshtml @@ -0,0 +1,15 @@ +@model System.Web.Mvc.HandleErrorInfo + +@section TitleContent +{ + EPIC FAIL!!! +} + +@section MainContent +{ +

+ @Model.Exception.Message +

+
+ @Model.Exception.ToString() +} \ No newline at end of file From 10b7c1d593fdd05d54659cbe64df07d31b71a3bb Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 21 Apr 2011 00:15:47 -0700 Subject: [PATCH 5/6] Removed Site.Master... all ASPX pages have been destroyed! --- NzbDrone.Web/Views/Shared/Site.Master | 63 --------------------------- 1 file changed, 63 deletions(-) delete mode 100644 NzbDrone.Web/Views/Shared/Site.Master diff --git a/NzbDrone.Web/Views/Shared/Site.Master b/NzbDrone.Web/Views/Shared/Site.Master deleted file mode 100644 index 939de7556..000000000 --- a/NzbDrone.Web/Views/Shared/Site.Master +++ /dev/null @@ -1,63 +0,0 @@ -<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %> -<%@ Import Namespace="Helpers" %> - - - - - - NZBDrone - <% - Html.Telerik().StyleSheetRegistrar().DefaultGroup(group => group.Add("telerik.common.css") - .Add("telerik.sitefinity.css") - .Add("notibar.css")) - .Render(); -%> - - - - - - <%----%> - - - - -
- - -
- - -
- -
- Scanning Series Folder... -
-
- - -<% - Html.Telerik().ScriptRegistrar().Scripts( - c => c.Add("jquery-ui-1.8.8.min.js") - .Add("jquery.form.js") - .Add("jquery.jgrowl.js") - .Add("Notification.js") - .Add("jquery-tgc-countdown-1.0.js") - .Add("MicrosoftAjax.js") - .Add("MicrosoftMvcValidation.js")) - .Render(); -%> - From ec8c83760b8fc4e9e4f6ac03e4a688964f47a483 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 21 Apr 2011 17:30:19 -0700 Subject: [PATCH 6/6] Adding/Deleting QualityProfiles will now save/delete the profile from the database to make the process less hacky. RootDir and UserProfileSection do not inherit the master layout automatically. --- NzbDrone.Core/Providers/QualityProvider.cs | 4 +- .../Controllers/AddSeriesController.cs | 1 - NzbDrone.Web/Controllers/SeriesController.cs | 17 ++---- .../Controllers/SettingsController.cs | 60 ++++++++++++++----- NzbDrone.Web/NzbDrone.Web.csproj | 8 +-- NzbDrone.Web/Views/Settings/Quality.cshtml | 36 ++++++++--- NzbDrone.Web/Views/Settings/RootDir.cshtml | 4 ++ .../Views/Settings/UserProfileSection.cshtml | 31 +++++++--- 8 files changed, 109 insertions(+), 52 deletions(-) diff --git a/NzbDrone.Core/Providers/QualityProvider.cs b/NzbDrone.Core/Providers/QualityProvider.cs index e7ced8ee8..8be07272e 100644 --- a/NzbDrone.Core/Providers/QualityProvider.cs +++ b/NzbDrone.Core/Providers/QualityProvider.cs @@ -21,9 +21,9 @@ namespace NzbDrone.Core.Providers _sonicRepo = sonicRepo; } - public virtual void Add(QualityProfile profile) + public virtual int Add(QualityProfile profile) { - _sonicRepo.Add(profile); + return Convert.ToInt32(_sonicRepo.Add(profile)); } public virtual void Update(QualityProfile profile) diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index 6e6182309..cee3db2c5 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -94,7 +94,6 @@ namespace NzbDrone.Web.Controllers "QualityProfileId", "Name", defaultQuality); - ; return PartialView("AddSeriesItem", suggestions); } diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 100320133..b659ec7da 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -70,22 +70,15 @@ namespace NzbDrone.Web.Controllers var episodes = _episodeProvider.GetEpisodeBySeason(seasonId).Select(c => new EpisodeModel { EpisodeId = c.EpisodeId, - EpisodeNumber = - c.EpisodeNumber, - SeasonNumber = - c.SeasonNumber, + EpisodeNumber = c.EpisodeNumber, + SeasonNumber = c.SeasonNumber, Title = c.Title, Overview = c.Overview, AirDate = c.AirDate, - Path = - GetEpisodePath( - c.EpisodeFile), - Quality = - c.EpisodeFile == null + Path = GetEpisodePath(c.EpisodeFile), + Quality = c.EpisodeFile == null ? String.Empty - : c.EpisodeFile. - Quality. - ToString() + : c.EpisodeFile.Quality.ToString() }); return View(new GridModel(episodes)); } diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index 15c4a13a4..7505c71f5 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -210,7 +210,35 @@ namespace NzbDrone.Web.Controllers ViewData["Qualities"] = qualityTypes; - return View("UserProfileSection", new QualityProfile { Name = "New Profile", UserProfile = true }); + var qualityProfile = new QualityProfile + { + Name = "New Profile", + UserProfile = true, + Allowed = new List {QualityTypes.Unknown}, + Cutoff = QualityTypes.Unknown, + }; + + var id = _qualityProvider.Add(qualityProfile); + qualityProfile.QualityProfileId = id; + qualityProfile.Allowed = null; + + ViewData["ProfileId"] = id; + + return View("UserProfileSection", qualityProfile); + } + + public ActionResult GetQualityProfileView(QualityProfile profile) + { + var qualityTypes = new List(); + + foreach (QualityTypes qual in Enum.GetValues(typeof(QualityTypes))) + { + qualityTypes.Add(qual); + } + ViewData["Qualities"] = qualityTypes; + ViewData["ProfileId"] = profile.QualityProfileId; + + return PartialView("UserProfileSection", profile); } public ViewResult AddRootDir() @@ -233,6 +261,21 @@ namespace NzbDrone.Web.Controllers return new QualityModel { DefaultQualityProfileId = defaultQualityQualityProfileId, SelectList = selectList }; } + public JsonResult DeleteQualityProfile(int profileId) + { + try + { + _qualityProvider.Delete(profileId); + } + + catch (Exception) + { + return new JsonResult { Data = "failed" }; + } + + return new JsonResult { Data = "ok" }; + } + [HttpPost] public ActionResult SaveGeneral(SettingsModel data) { @@ -343,12 +386,6 @@ namespace NzbDrone.Web.Controllers if (data.UserProfiles == null) return Content(SETTINGS_SAVED); - foreach (var dbProfile in _qualityProvider.GetAllProfiles().Where(q => q.UserProfile)) - { - if (!data.UserProfiles.Exists(p => p.QualityProfileId == dbProfile.QualityProfileId)) - _qualityProvider.Delete(dbProfile.QualityProfileId); - } - foreach (var profile in data.UserProfiles) { Logger.Debug(String.Format("Updating User Profile: {0}", profile)); @@ -365,14 +402,9 @@ namespace NzbDrone.Web.Controllers return Content("Error Saving Settings, please fix any errors"); //profile.Cutoff = profile.Allowed.Last(); - if (profile.QualityProfileId > 0) - _qualityProvider.Update(profile); - - else - _qualityProvider.Add(profile); - - return Content(SETTINGS_SAVED); + _qualityProvider.Update(profile); } + return Content(SETTINGS_SAVED); } return Content(SETTINGS_FAILED); diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 005585fd1..801ac9c28 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -617,7 +617,6 @@ - Designer @@ -635,8 +634,6 @@ - - @@ -654,7 +651,6 @@ - @@ -666,7 +662,9 @@ - + + +
diff --git a/NzbDrone.Web/Views/Settings/Quality.cshtml b/NzbDrone.Web/Views/Settings/Quality.cshtml index c65215dc9..4fe3b6a28 100644 --- a/NzbDrone.Web/Views/Settings/Quality.cshtml +++ b/NzbDrone.Web/Views/Settings/Quality.cshtml @@ -49,11 +49,10 @@
- - @foreach (var item in Model.UserProfiles) - { - Html.RenderPartial("UserProfileSection", item); - } + @foreach (var item in Model.UserProfiles) + { + Html.RenderAction("GetQualityProfileView", item); + }
@@ -77,8 +76,27 @@ return false; }); - $("a.deleteRow").live("click", function () { - $(this).parents("div.userProfileSectionEditor:first").remove(); - return false; - }); +// $("a.deleteRow").live("click", function () { +// $(this).parents("div.userProfileSectionEditor:first").remove(); +// return false; + // }); + + var deleteQualityProfileUrl = '@Url.Action("DeleteQualityProfile", "Settings")'; + + function deleteProfile(id) { + //$(this).parents("div.userProfileSectionEditor:first").remove(); + sendToServer(id); + $("#div_" + id).hide(); + } + + function sendToServer(id) { + $.ajax({ + type: "POST", + url: deleteQualityProfileUrl, + data: jQuery.param({ profileId: id }), + error: function (req, status, error) { + alert("Sorry! We could not add " + path + " at this time. " + error); + } + }); + } \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/RootDir.cshtml b/NzbDrone.Web/Views/Settings/RootDir.cshtml index b1f2da5ee..5ebe8ed1f 100644 --- a/NzbDrone.Web/Views/Settings/RootDir.cshtml +++ b/NzbDrone.Web/Views/Settings/RootDir.cshtml @@ -1,5 +1,9 @@ @model NzbDrone.Core.Repository.RootDir @using NzbDrone.Web.Helpers; + +@{ + Layout = null; +}