1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-27 01:57:21 +00:00

Replaced Telerik SeasonGrid with simple table.

This commit is contained in:
Mark McDowall 2012-02-03 20:34:02 -08:00 committed by kay.one
parent 02a3b38210
commit f065d345a5
8 changed files with 310 additions and 48 deletions

View file

@ -138,7 +138,7 @@ public EmptyResult SaveEpisodeIgnore(int episodeId, bool ignored)
return new EmptyResult(); return new EmptyResult();
} }
public ActionResult Details(int seriesId) public ActionResult Details2(int seriesId)
{ {
var series = _seriesProvider.GetSeries(seriesId); var series = _seriesProvider.GetSeries(seriesId);
@ -161,6 +161,42 @@ public ActionResult Details(int seriesId)
return View(model); return View(model);
} }
public ActionResult Details(int seriesId)
{
var series = _seriesProvider.GetSeries(seriesId);
var model = new SeriesDetailsModel();
if (series.AirsDayOfWeek != null)
{
model.AirsDayOfWeek = series.AirsDayOfWeek.Value.ToString();
}
else
{
model.AirsDayOfWeek = "N/A";
}
model.Overview = series.Overview;
model.Title = series.Title;
model.SeriesId = series.SeriesId;
model.HasBanner = !String.IsNullOrEmpty(series.BannerUrl);
var seasons = new List<SeasonModel>();
var episodes = _episodeProvider.GetEpisodeBySeries(seriesId);
foreach (var season in episodes.Select(s => s.SeasonNumber).Distinct())
{
seasons.Add(new SeasonModel
{
SeasonNumber = season,
Episodes = GetEpisodeModels(episodes.Where(e => e.SeasonNumber == season).ToList()).OrderByDescending(e=> e.EpisodeNumber).ToList()
});
}
model.Seasons = seasons;
return View(model);
}
public ActionResult MassEdit() public ActionResult MassEdit()
{ {
var profiles = _qualityProvider.All(); var profiles = _qualityProvider.All();

View file

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Web;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository;
namespace NzbDrone.Web.Models
{
public class SeasonModel
{
public int SeasonNumber { get; set; }
public List<EpisodeModel> Episodes { get; set; }
}
}

View file

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Web;
using NzbDrone.Core.Model;
using NzbDrone.Core.Repository;
namespace NzbDrone.Web.Models
{
public class SeriesDetailsModel
{
public int SeriesId { get; set; }
public string Title { get; set; }
public string AirsDayOfWeek { get; set; }
public string QualityProfileName { get; set; }
public string Overview { get; set; }
public string NextAiring { get; set; }
public string Path { get; set; }
public bool HasBanner { get; set; }
public List<SeasonModel> Seasons { get; set; }
}
}

View file

@ -227,6 +227,8 @@
<Compile Include="Helpers\DescriptionExtension.cs" /> <Compile Include="Helpers\DescriptionExtension.cs" />
<Compile Include="Helpers\HtmlPrefixScopeExtensions.cs" /> <Compile Include="Helpers\HtmlPrefixScopeExtensions.cs" />
<Compile Include="Helpers\IsCurrentActionHelper.cs" /> <Compile Include="Helpers\IsCurrentActionHelper.cs" />
<Compile Include="Models\SeasonModel.cs" />
<Compile Include="Models\SeriesDetailsModel.cs" />
<Compile Include="Models\MiscSettingsModel.cs" /> <Compile Include="Models\MiscSettingsModel.cs" />
<Compile Include="Models\QualityProfileModel.cs" /> <Compile Include="Models\QualityProfileModel.cs" />
<Compile Include="Models\FooterModel.cs" /> <Compile Include="Models\FooterModel.cs" />
@ -423,7 +425,7 @@
<Content Include="Views\History\Index.cshtml" /> <Content Include="Views\History\Index.cshtml" />
<Content Include="Views\Log\Index.cshtml" /> <Content Include="Views\Log\Index.cshtml" />
<Content Include="Views\Upcoming\Index.cshtml" /> <Content Include="Views\Upcoming\Index.cshtml" />
<Content Include="Views\Series\Details.cshtml" /> <Content Include="Views\Series\Details2.cshtml" />
<Content Include="Views\Series\Index.cshtml" /> <Content Include="Views\Series\Index.cshtml" />
<Content Include="Views\Shared\Error.cshtml" /> <Content Include="Views\Shared\Error.cshtml" />
<Content Include="Views\Settings\QualityProfileItem.cshtml" /> <Content Include="Views\Settings\QualityProfileItem.cshtml" />
@ -538,6 +540,15 @@
<ItemGroup> <ItemGroup>
<Content Include="Views\Settings\Blackhole.cshtml" /> <Content Include="Views\Settings\Blackhole.cshtml" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="Views\Series\Episode.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\Season.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\Details.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View file

@ -1,5 +1,4 @@
@model SeriesModel @model SeriesDetailsModel
@using NzbDrone.Common
@using NzbDrone.Web.Helpers @using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models @using NzbDrone.Web.Models
@{ViewBag.Title = Model.Title;} @{ViewBag.Title = Model.Title;}
@ -44,7 +43,7 @@
width: 18px; width: 18px;
height: 18px; height: 18px;
padding: 1px; padding: 1px;
margin: 2px; margin: 0px;
} }
.searchImage:hover, .renameImage:hover, .ignoreEpisode:hover, .ignoreEpisodesMaster:hover .searchImage:hover, .renameImage:hover, .ignoreEpisode:hover, .ignoreEpisodesMaster:hover
@ -61,6 +60,35 @@
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
.seriesTable {
width: 100%;
border-width: 1px;
border-spacing: 2px;
border-style: none;
border-color: white;
border-collapse: collapse;
background-color: white;
}
.seriesTable th {
border-width: 1px;
padding: 2px;
border-style: inset;
border-color: #EEEEEE;
background-color: white;
padding-left: 7px;
text-align: left;
}
.seriesTable td {
border-width: 1px;
padding: 0 0.6em;
border-style: inset;
border-color: #EEEEEE;
background-color: white;
padding-left: 7px;
}
</style> </style>
@section ActionMenu{ @section ActionMenu{
<ul class="sub-menu"> <ul class="sub-menu">
@ -82,7 +110,7 @@
<img src="@bannerUrl" alt="Banner"/> <img src="@bannerUrl" alt="Banner"/>
</div> </div>
<div class="seasonToggleTopGroup"> <div class="seasonToggleTopGroup">
@foreach (var season in Model.Seasons) @foreach (var season in Model.Seasons.Select(s => s.SeasonNumber))
{ {
var ignoreSeason = "ignoreSeason_" + season; var ignoreSeason = "ignoreSeason_" + season;
<div class="seasonToggleTop"> <div class="seasonToggleTop">
@ -91,50 +119,10 @@
</div> </div>
} }
</div> </div>
@foreach (var s in Model.Seasons.Reverse()) @foreach (var s in Model.Seasons.OrderByDescending(a => a.SeasonNumber))
{ {
var seriesId = @Model.SeriesId;
var season = s; var season = s;
Html.RenderPartial("Season", season);
<h2>
@(season == 0 ? "Specials" : "Season " + season)
</h2>
Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season)
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(c => c.EpisodeNumber).Width(100).Title("Episode #").Sortable(true);
columns.Bound(c => c.Title).Title("Title").Sortable(false);
columns.Bound(c => c.AirDate).Width(100).Sortable(false);
columns.Bound(c => c.Quality).Width(100);
columns.Bound(c => c.Status).Sortable(false)
.Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_" + season + "' title='Click to toggle season ignore status' />" +
"<img src='../../Content/Images/Missing.png' alt='Status' title='Season Status' class='statusImage statusImageMaster' />" +
Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for all episodes in this season", @class = "searchImage searchImageMaster" }, "SearchSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null) +
Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename all episodes in this season", @class = "renameImage renameImageMaster" }, "RenameSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null))
.ClientTemplate("<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' title='Click to toggle episode ignore status' />" +
"<img src='../../Content/Images/<#= Status #>.png' alt='<#= Status #>' title='<#= Status #>' class='statusImage status-<#= Status #>' />" +
Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for episode", @class = "searchImage" }, "Search", "Episode", new { EpisodeId = "<#= EpisodeId #>" }, null, null) +
Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename episode", @class = "renameImage" }, "Rename", "Episode", new { EpisodeFileId = "<#= EpisodeFileId #>" }, null, null))
.Width(80);
})
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.Footer(true)
.DataBinding(
d =>
d.Ajax().Select("_AjaxSeasonGrid", "Series",
new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", season } }))
.ClientEvents(clientEvents =>
{
clientEvents.OnRowDataBound("grid_rowBound");
clientEvents.OnDataBound("grid_dataBound");
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Sortable(sorting => sorting
.OrderBy(sortOrder => sortOrder.Add(o => o.EpisodeNumber).Descending()).SortMode(GridSortMode.SingleColumn))
.Render();
} }
@section Scripts{ @section Scripts{
@Html.IncludeScript("NzbDrone/seriesDetails.js") @Html.IncludeScript("NzbDrone/seriesDetails.js")

View file

@ -0,0 +1,144 @@
@model SeriesModel
@using NzbDrone.Common
@using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models
@{ViewBag.Title = Model.Title;}
@section HeaderContent
{
@Html.IncludeCss("Grid.css")
}
@{ ViewBag.Title = Model.Title; }
<style>
.seasonToggleTopGroup
{
overflow: hidden;
}
.seasonToggleTop
{
background-color: #F1EDED;
background-position: 5px center;
background-repeat: no-repeat;
display: inline-block;
font-size: 15px;
margin: 2px;
padding: 2px 5px;
width: 100px;
}
.seasonToggleLabel
{
margin-left: 5px;
}
.seasonToggleTop .ignoredEpisodesMaster
{
padding-left: 0px;
padding-right: 0px;
margin-bottom: -4px;
border-style: none;
}
.statusImage, .searchImage, .renameImage, .ignoreEpisode, .ignoreEpisodesMaster
{
width: 18px;
height: 18px;
padding: 1px;
margin: 2px;
}
.searchImage:hover, .renameImage:hover, .ignoreEpisode:hover, .ignoreEpisodesMaster:hover
{
}
#banner-container
{
width: 758px;
height: 140px;
padding: 0px;
margin-top: 10px;
margin-bottom: 15px;
margin-left: auto;
margin-right: auto;
}
</style>
@section ActionMenu{
<ul class="sub-menu">
<li>@Ajax.ActionLink("Scan Disk", "ScanDisk", "Command", new { seriesId = Model.SeriesId }, null)</li>
<li>@Ajax.ActionLink("Update Info", "UpdateInfo", "Command", new { seriesId = Model.SeriesId }, null)</li>
<li>@Ajax.ActionLink("Search for missing episodes", "BacklogSeries", "Episode", new { seriesId = Model.SeriesId }, null)</li>
<li>@Ajax.ActionLink("Rename Episodes", "RenameEpisodes", "Episode", new { seriesId = Model.SeriesId }, null)</li>
</ul>
}
<div id="banner-container">
@{
var bannerUrl = "../../Content/Images/img03.jpg";
if (Model.HasBanner)
{
bannerUrl = "../../MediaCover/Banners/" + Model.SeriesId + ".jpg";
}
}
<img src="@bannerUrl" alt="Banner"/>
</div>
<div class="seasonToggleTopGroup">
@foreach (var season in Model.Seasons)
{
var ignoreSeason = "ignoreSeason_" + season;
<div class="seasonToggleTop">
<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode @ignoreSeason' title='Click to toggle season ignore status' />
<span class="seasonToggleLabel">@(season == 0 ? "Specials" : "Season " + season)</span>
</div>
}
</div>
@foreach (var s in Model.Seasons.Reverse())
{
var seriesId = @Model.SeriesId;
var season = s;
<h2>
@(season == 0 ? "Specials" : "Season " + season)
</h2>
Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season)
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(c => c.EpisodeNumber).Width(100).Title("Episode #").Sortable(true);
columns.Bound(c => c.Title).Title("Title").Sortable(false);
columns.Bound(c => c.AirDate).Width(100).Sortable(false);
columns.Bound(c => c.Quality).Width(100);
columns.Bound(c => c.Status).Sortable(false)
.Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_" + season + "' title='Click to toggle season ignore status' />" +
"<img src='../../Content/Images/Missing.png' alt='Status' title='Season Status' class='statusImage statusImageMaster' />" +
Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for all episodes in this season", @class = "searchImage searchImageMaster" }, "SearchSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null) +
Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename all episodes in this season", @class = "renameImage renameImageMaster" }, "RenameSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null))
.ClientTemplate("<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' title='Click to toggle episode ignore status' />" +
"<img src='../../Content/Images/<#= Status #>.png' alt='<#= Status #>' title='<#= Status #>' class='statusImage status-<#= Status #>' />" +
Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for episode", @class = "searchImage" }, "Search", "Episode", new { EpisodeId = "<#= EpisodeId #>" }, null, null) +
Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename episode", @class = "renameImage" }, "Rename", "Episode", new { EpisodeFileId = "<#= EpisodeFileId #>" }, null, null))
.Width(80);
})
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.Footer(true)
.DataBinding(
d =>
d.Ajax().Select("_AjaxSeasonGrid", "Series",
new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", season } }))
.ClientEvents(clientEvents =>
{
clientEvents.OnRowDataBound("grid_rowBound");
clientEvents.OnDataBound("grid_dataBound");
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Sortable(sorting => sorting
.OrderBy(sortOrder => sortOrder.Add(o => o.EpisodeNumber).Descending()).SortMode(GridSortMode.SingleColumn))
.Render();
}
@section Scripts{
@Html.IncludeScript("NzbDrone/seriesDetails.js")
<script type="text/javascript">
seriesId = @Model.SeriesId;
</script>
}

View file

@ -0,0 +1,17 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.EpisodeModel
<tr class="@Model.EpisodeId">
<td>@Model.EpisodeNumber</td>
<td>@Model.Title</td>
<td>@Model.AirDate</td>
<td>@Model.Quality</td>
@*Commands Column*@
<td>
<img src='../../Content/Images/@(Model.Ignored ? "ignored" : "notIgnored").png' class='ignoreEpisode ignoreEpisode_" + @Model.SeasonNumber + " ignored' id='@Model.EpisodeId' title='Click to toggle episode ignore status' />
<img src='../../Content/Images/@(Model.Status).png' alt='@Model.Status' title='@Model.Status' class='statusImage status-@Model.Status' />
@Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for episode", @class = "searchImage" }, "Search", "Episode", new { EpisodeId = Model.EpisodeId }, null, null)
@Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename episode", @class = "renameImage" }, "Rename", "Episode", new { EpisodeFileId = Model.EpisodeFileId }, null, null)
</td>
</tr>

View file

@ -0,0 +1,29 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.SeasonModel
<h2>
@(Model.SeasonNumber == 0 ? "Specials" : "Season " + Model.SeasonNumber)
</h2>
<table class="seriesTable">
<tr>
<th width="100px">Episode #</th>
<th>Title</th>
<th width="100px">Air Date</th>
<th width="100px">Quality</th>
@*Commands Column*@
<th width="110px">
Commands
@* <img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_" + season + "' title='Click to toggle season ignore status' />
<img src='../../Content/Images/Missing.png' alt='Status' title='Season Status' class='statusImage statusImageMaster' />
Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for all episodes in this season", @class = "searchImage searchImageMaster" }, "SearchSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null)
Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename all episodes in this season", @class = "renameImage renameImageMaster" }, "RenameSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null))*@
</th>
</tr>
@foreach (var episode in Model.Episodes)
{
Html.RenderPartial("Episode", episode);
}
</table>