Cleaned up SeriesController.

More CSS fixes for Series/Details
pull/4/head
Mark McDowall 13 years ago committed by kay.one
parent a7c90351ac
commit 9721738bec

@ -12,14 +12,17 @@ namespace NzbDrone.Web.Controllers
private readonly SabProvider _sabProvider; private readonly SabProvider _sabProvider;
private readonly SmtpProvider _smtpProvider; private readonly SmtpProvider _smtpProvider;
private readonly TwitterProvider _twitterProvider; private readonly TwitterProvider _twitterProvider;
private readonly EpisodeProvider _episodeProvider;
public CommandController(JobProvider jobProvider, SabProvider sabProvider, public CommandController(JobProvider jobProvider, SabProvider sabProvider,
SmtpProvider smtpProvider, TwitterProvider twitterProvider) SmtpProvider smtpProvider, TwitterProvider twitterProvider,
EpisodeProvider episodeProvider)
{ {
_jobProvider = jobProvider; _jobProvider = jobProvider;
_sabProvider = sabProvider; _sabProvider = sabProvider;
_smtpProvider = smtpProvider; _smtpProvider = smtpProvider;
_twitterProvider = twitterProvider; _twitterProvider = twitterProvider;
_episodeProvider = episodeProvider;
} }
public JsonResult RssSync() public JsonResult RssSync()
@ -88,5 +91,19 @@ namespace NzbDrone.Web.Controllers
return JsonNotificationResult.Info("Good News!", "Successfully verified Twitter Authorization."); return JsonNotificationResult.Info("Good News!", "Successfully verified Twitter Authorization.");
} }
[HttpPost]
public EmptyResult SaveSeasonIgnore(int seriesId, int seasonNumber, bool ignored)
{
_episodeProvider.SetSeasonIgnore(seriesId, seasonNumber, ignored);
return new EmptyResult();
}
[HttpPost]
public EmptyResult SaveEpisodeIgnore(int episodeId, bool ignored)
{
_episodeProvider.SetEpisodeIgnore(episodeId, ignored);
return new EmptyResult();
}
} }
} }

@ -23,25 +23,17 @@ namespace NzbDrone.Web.Controllers
private readonly EpisodeProvider _episodeProvider; private readonly EpisodeProvider _episodeProvider;
private readonly QualityProvider _qualityProvider; private readonly QualityProvider _qualityProvider;
private readonly SeriesProvider _seriesProvider; private readonly SeriesProvider _seriesProvider;
private readonly TvDbProvider _tvDbProvider;
private readonly JobProvider _jobProvider; private readonly JobProvider _jobProvider;
private readonly MediaFileProvider _mediaFileProvider;
// //
// GET: /Series/ // GET: /Series/
public SeriesController(SeriesProvider seriesProvider, public SeriesController(SeriesProvider seriesProvider, EpisodeProvider episodeProvider,
EpisodeProvider episodeProvider, QualityProvider qualityProvider, JobProvider jobProvider)
QualityProvider qualityProvider,
TvDbProvider tvDbProvider,
JobProvider jobProvider,
MediaFileProvider mediaFileProvider)
{ {
_seriesProvider = seriesProvider; _seriesProvider = seriesProvider;
_episodeProvider = episodeProvider; _episodeProvider = episodeProvider;
_qualityProvider = qualityProvider; _qualityProvider = qualityProvider;
_tvDbProvider = tvDbProvider;
_jobProvider = jobProvider; _jobProvider = jobProvider;
_mediaFileProvider = mediaFileProvider;
} }
public ActionResult Index() public ActionResult Index()
@ -101,16 +93,6 @@ namespace NzbDrone.Web.Controllers
return View(new GridModel(series)); return View(new GridModel(series));
} }
[GridAction]
public ActionResult _AjaxSeasonGrid(int seriesId, int seasonNumber)
{
using (MiniProfiler.StepStatic("Controller"))
{
var episodes = GetEpisodeModels(_episodeProvider.GetEpisodesBySeason(seriesId, seasonNumber));
return View(new GridModel(episodes));
}
}
public JsonResult LocalSearch(string term) public JsonResult LocalSearch(string term)
{ {
//Get Results from the local DB and return //Get Results from the local DB and return
@ -124,43 +106,6 @@ namespace NzbDrone.Web.Controllers
return Json(results, JsonRequestBehavior.AllowGet); return Json(results, JsonRequestBehavior.AllowGet);
} }
[HttpPost]
public EmptyResult SaveSeasonIgnore(int seriesId, int seasonNumber, bool ignored)
{
_episodeProvider.SetSeasonIgnore(seriesId, seasonNumber, ignored);
return new EmptyResult();
}
[HttpPost]
public EmptyResult SaveEpisodeIgnore(int episodeId, bool ignored)
{
_episodeProvider.SetEpisodeIgnore(episodeId, ignored);
return new EmptyResult();
}
public ActionResult Details2(int seriesId)
{
var series = _seriesProvider.GetSeries(seriesId);
var model = new SeriesModel();
if (series.AirsDayOfWeek != null)
{
model.AirsDayOfWeek = series.AirsDayOfWeek.Value.ToString();
}
else
{
model.AirsDayOfWeek = "N/A";
}
model.Overview = series.Overview;
model.Seasons = _episodeProvider.GetSeasons(seriesId);
model.Title = series.Title;
model.SeriesId = series.SeriesId;
model.HasBanner = !String.IsNullOrEmpty(series.BannerUrl);
return View(model);
}
public ActionResult Details(int seriesId) public ActionResult Details(int seriesId)
{ {
var series = _seriesProvider.GetSeries(seriesId); var series = _seriesProvider.GetSeries(seriesId);

@ -425,7 +425,6 @@
<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\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" />

@ -5,8 +5,8 @@ var readyImage = '../../Content/Images/Ready.png';
var downloadingImage = '../../Content/Images/Downloading.png'; var downloadingImage = '../../Content/Images/Downloading.png';
var seriesId = 0; var seriesId = 0;
var saveSeasonIgnoreUrl = '../Series/SaveSeasonIgnore'; var saveSeasonIgnoreUrl = '../Command/SaveSeasonIgnore';
var saveEpisodeIgnoreUrl = '../Series/SaveEpisodeIgnore'; var saveEpisodeIgnoreUrl = '../Command/SaveEpisodeIgnore';
//Episode Ignore Functions //Episode Ignore Functions
$(".ignoreEpisode").live("click", function () { $(".ignoreEpisode").live("click", function () {
@ -146,6 +146,6 @@ function saveEpisodeIgnore(episodeId, ignored) {
} }
/* Click on row, show details */ /* Click on row, show details */
$('.seriesTable tr').live('click', function() { $('.seriesTable tr td:not(:last-child)').live('click', function () {
$(this).next('.detail-view').toggle(); $(this).parent('tr').next('.detail-view').toggle();
}); });

@ -42,12 +42,14 @@
{ {
width: 18px; width: 18px;
height: 18px; height: 18px;
padding: 1px; padding: 3px 1px;
margin: 0px; margin: 0px;
vertical-align: middle;
} }
.searchImage:hover, .renameImage:hover, .ignoreEpisode:hover, .ignoreEpisodesMaster:hover .searchImage:hover, .renameImage:hover, .ignoreEpisode:hover, .ignoreEpisodesMaster:hover
{ {
background-color: #065EFE;
} }
#banner-container #banner-container
@ -82,10 +84,9 @@
.seriesTable td { .seriesTable td {
border-width: 1px; border-width: 1px;
padding: 0 0.6em; padding: 0px 0.6em 0 7px;
border-style: inset; border-style: inset;
border-color: #EEEEEE; border-color: #EEEEEE;
padding-left: 7px;
} }
.detail-view { .detail-view {

@ -1,144 +0,0 @@
@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>
}

@ -7,7 +7,7 @@
<table class="seriesTable"> <table class="seriesTable">
<colgroup> <colgroup>
<col style="width:100px" /> <col style="width:80px" />
<col> <col>
<col style="width:100px" /> <col style="width:100px" />
<col style="width:100px" /> <col style="width:100px" />

Loading…
Cancel
Save