Replaced Telerik SeasonGrid with simple table.

pull/6/head
Mark McDowall 13 years ago committed by kay.one
parent 02a3b38210
commit f065d345a5

@ -138,7 +138,7 @@ namespace NzbDrone.Web.Controllers
return new EmptyResult();
}
public ActionResult Details(int seriesId)
public ActionResult Details2(int seriesId)
{
var series = _seriesProvider.GetSeries(seriesId);
@ -161,6 +161,42 @@ namespace NzbDrone.Web.Controllers
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()
{
var profiles = _qualityProvider.All();

@ -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; }
}
}

@ -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; }
}
}

@ -227,6 +227,8 @@
<Compile Include="Helpers\DescriptionExtension.cs" />
<Compile Include="Helpers\HtmlPrefixScopeExtensions.cs" />
<Compile Include="Helpers\IsCurrentActionHelper.cs" />
<Compile Include="Models\SeasonModel.cs" />
<Compile Include="Models\SeriesDetailsModel.cs" />
<Compile Include="Models\MiscSettingsModel.cs" />
<Compile Include="Models\QualityProfileModel.cs" />
<Compile Include="Models\FooterModel.cs" />
@ -423,7 +425,7 @@
<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\Details2.cshtml" />
<Content Include="Views\Series\Index.cshtml" />
<Content Include="Views\Shared\Error.cshtml" />
<Content Include="Views\Settings\QualityProfileItem.cshtml" />
@ -538,6 +540,15 @@
<ItemGroup>
<Content Include="Views\Settings\Blackhole.cshtml" />
</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="$(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.

@ -1,5 +1,4 @@
@model SeriesModel
@using NzbDrone.Common
@model SeriesDetailsModel
@using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models
@{ViewBag.Title = Model.Title;}
@ -44,7 +43,7 @@
width: 18px;
height: 18px;
padding: 1px;
margin: 2px;
margin: 0px;
}
.searchImage:hover, .renameImage:hover, .ignoreEpisode:hover, .ignoreEpisodesMaster:hover
@ -61,6 +60,35 @@
margin-left: 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>
@section ActionMenu{
<ul class="sub-menu">
@ -82,7 +110,7 @@
<img src="@bannerUrl" alt="Banner"/>
</div>
<div class="seasonToggleTopGroup">
@foreach (var season in Model.Seasons)
@foreach (var season in Model.Seasons.Select(s => s.SeasonNumber))
{
var ignoreSeason = "ignoreSeason_" + season;
<div class="seasonToggleTop">
@ -91,50 +119,10 @@
</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;
<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();
Html.RenderPartial("Season", season);
}
@section Scripts{
@Html.IncludeScript("NzbDrone/seriesDetails.js")

@ -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>
}

@ -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>

@ -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>
Loading…
Cancel
Save