1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-25 09:18:34 +00:00

episode grid is now sortable.

This commit is contained in:
kay.one 2011-12-03 15:44:48 -08:00
parent f84f8ac992
commit f4047dee2c
3 changed files with 68 additions and 80 deletions

View file

@ -93,7 +93,7 @@ namespace NzbDrone.Web.Controllers
{ {
using (MiniProfiler.StepStatic("Controller")) using (MiniProfiler.StepStatic("Controller"))
{ {
var episodes = GetEpisodeModels(_episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber)).OrderByDescending(e => e.EpisodeNumber); var episodes = GetEpisodeModels(_episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber));
return View(new GridModel(episodes)); return View(new GridModel(episodes));
} }
} }

View file

@ -3,10 +3,8 @@
@section TitleContent{ @section TitleContent{
@Model.Title @Model.Title
} }
<script src="../../Scripts/NzbDrone/seriesDetails.js" type="text/javascript"></script> <script src="../../Scripts/NzbDrone/seriesDetails.js" type="text/javascript"></script>
<link href="../../Content/Grid.css" rel="stylesheet" type="text/css" /> <link href="../../Content/Grid.css" rel="stylesheet" type="text/css" />
<style> <style>
.seasonToggleTopGroup .seasonToggleTopGroup
{ {
@ -48,7 +46,6 @@
.searchImage:hover, .renameImage:hover, .ignoreEpisode:hover, .ignoreEpisodesMaster:hover .searchImage:hover, .renameImage:hover, .ignoreEpisode:hover, .ignoreEpisodesMaster:hover
{ {
} }
#banner-container #banner-container
@ -62,7 +59,6 @@
margin-right: auto; margin-right: auto;
} }
</style> </style>
@section ActionMenu{ @section ActionMenu{
<ul class="sub-menu"> <ul class="sub-menu">
<li>@Ajax.ActionLink("Scan Disk", "ScanDisk", "Command", new { seriesId = Model.SeriesId }, null)</li> <li>@Ajax.ActionLink("Scan Disk", "ScanDisk", "Command", new { seriesId = Model.SeriesId }, null)</li>
@ -71,20 +67,18 @@
<li>@Ajax.ActionLink("Rename Episodes", "RenameEpisodes", "Episode", new { seriesId = Model.SeriesId }, null)</li> <li>@Ajax.ActionLink("Rename Episodes", "RenameEpisodes", "Episode", new { seriesId = Model.SeriesId }, null)</li>
</ul> </ul>
} }
<div id="banner-container">
<div id="banner-container">
@{ @{
var bannerUrl = "../../Content/Images/img03.jpg"; var bannerUrl = "../../Content/Images/img03.jpg";
if(Model.HasBanner) if (Model.HasBanner)
{ {
bannerUrl = "../../MediaCover/Banners/" + Model.SeriesId + ".jpg"; bannerUrl = "../../MediaCover/Banners/" + Model.SeriesId + ".jpg";
} }
} }
<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)
{ {
var ignoreSeason = "ignoreSeason_" + season; var ignoreSeason = "ignoreSeason_" + season;
@ -93,10 +87,9 @@
<span class="seasonToggleLabel">@(season == 0 ? "Specials" : "Season " + season)</span> <span class="seasonToggleLabel">@(season == 0 ? "Specials" : "Season " + season)</span>
</div> </div>
} }
</div> </div>
@foreach (var s in Model.Seasons.Reverse())
@foreach (var s in Model.Seasons.Reverse()) {
{
var seriesId = @Model.SeriesId; var seriesId = @Model.SeriesId;
var season = s; var season = s;
@ -104,20 +97,18 @@
@(season == 0 ? "Specials" : "Season " + season) @(season == 0 ? "Specials" : "Season " + season)
</h2> </h2>
<div class="grid-container">
@{
Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season) Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season)
.TableHtmlAttributes(new { @class = "Grid" }) .TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns => .Columns(columns =>
{ {
columns.Bound(c => c.EpisodeNumber).Width(50).Title("Episode"); columns.Bound(c => c.EpisodeNumber).Width(100).Title("Episode").Sortable(true);
columns.Bound(c => c.Title).Title("Title"); columns.Bound(c => c.Title).Title("Title").Sortable(false);
columns.Bound(c => c.AirDate).Width(100); columns.Bound(c => c.AirDate).Width(100).Sortable(false);
columns.Bound(c => c.Quality).Width(100); columns.Bound(c => c.Quality).Width(100);
columns.Bound(c => c.Status) 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' />" + .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' />" + "<img src='../../Content/Images/Missing.png' alt='Status' title='Season Status' class='statusImage statusImageMaster' />" +
"<a href=\"../Episode/SearchSeason?seriesId=" + @seriesId + "&seasonNumber=" + @season + "\" onclick=\"searchSeason(" + @seriesId + ", "+ @season + "); return false;\"><img src='../../Content/Images/Search.png' alt='Search' title='Search for all episodes in this season' class='searchImage searchImageMaster' /></a>" + "<a href=\"../Episode/SearchSeason?seriesId=" + @seriesId + "&seasonNumber=" + @season + "\" onclick=\"searchSeason(" + @seriesId + ", " + @season + "); return false;\"><img src='../../Content/Images/Search.png' alt='Search' title='Search for all episodes in this season' class='searchImage searchImageMaster' /></a>" +
"<a href=\"../Episode/RenameSeason?seriesId=" + @seriesId + "&seasonNumber=" + @season + "\" onclick=\"renameSeason(" + @seriesId + ", " + @season + "); return false;\"><img src='../../Content/Images/Rename.png' alt='Rename' title='Rename all episodes in this season' class=renameImage renameImageMaster' /></a>") "<a href=\"../Episode/RenameSeason?seriesId=" + @seriesId + "&seasonNumber=" + @season + "\" onclick=\"renameSeason(" + @seriesId + ", " + @season + "); return false;\"><img src='../../Content/Images/Rename.png' alt='Rename' title='Rename all episodes in this season' class=renameImage renameImageMaster' /></a>")
.ClientTemplate("<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' title='Click to toggle episode ignore status' />" + .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 #>' />" + "<img src='../../Content/Images/<#= Status #>.png' alt='<#= Status #>' title='<#= Status #>' class='statusImage status-<#= Status #>' />" +
@ -137,10 +128,11 @@
clientEvents.OnRowDataBound("grid_rowBound"); clientEvents.OnRowDataBound("grid_rowBound");
clientEvents.OnDataBound("grid_dataBound"); clientEvents.OnDataBound("grid_dataBound");
}) })
.Render();} .Sortable(sorting => sorting
</div> .OrderBy(sortOrder => sortOrder.Add(o => o.EpisodeNumber).Descending()).SortMode(GridSortMode.SingleColumn))
} .Render();
}
}
@section Scripts{ @section Scripts{
<script type="text/javascript"> <script type="text/javascript">
seriesId = @Model.SeriesId; seriesId = @Model.SeriesId;

View file

@ -51,9 +51,7 @@ NzbDrone
<li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null)</li> <li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null)</li>
</ul> </ul>
} }
<div class="grid-container"> @{Html.Telerik().Grid<SeriesModel>().Name("Grid")
@{Html.Telerik().Grid<SeriesModel>().Name("Grid")
.TableHtmlAttributes(new { @class = "Grid" })
.DataKeys(keys => keys.Add(p => p.SeriesId)) .DataKeys(keys => keys.Add(p => p.SeriesId))
.DataBinding(data => data.Ajax() .DataBinding(data => data.Ajax()
.Select("_AjaxSeriesGrid", "Series") .Select("_AjaxSeriesGrid", "Series")
@ -85,7 +83,6 @@ NzbDrone
}) })
.Editable(editor => editor.Mode(GridEditMode.PopUp)) .Editable(editor => editor.Mode(GridEditMode.PopUp))
//.Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(true))
.DetailView(detailView => detailView.ClientTemplate( .DetailView(detailView => detailView.ClientTemplate(
"<b>Airs Day of Week:</b> " + "<#= AirsDayOfWeek #>" + "<b>Airs Day of Week:</b> " + "<#= AirsDayOfWeek #>" +
"<br />" + "<br />" +
@ -99,7 +96,6 @@ NzbDrone
clientEvents.OnRowDataBound("grid_rowBound"); clientEvents.OnRowDataBound("grid_rowBound");
}) })
.Render();} .Render();}
</div>
@section Scripts{ @section Scripts{
<script type="text/javascript"> <script type="text/javascript">
var windowElement; var windowElement;