Added "Tomorrow" view for the upcoming episodes page so it was separate from the weekly forecast.

pull/4/head
Mark McDowall 14 years ago
parent f1cf6ace73
commit de003b9774

@ -39,10 +39,15 @@ namespace NzbDrone.Core.Providers
return _repository.All<Episode>().Where(e => e.AirDate == DateTime.Today).ToList();
}
public virtual List<Episode> Tomorrow()
{
return _repository.All<Episode>().Where(e => e.AirDate == DateTime.Today.AddDays(1)).ToList();
}
public virtual List<Episode> Week()
{
return
_repository.All<Episode>().Where(e => e.AirDate > DateTime.Today && e.AirDate < DateTime.Today.AddDays(8))
_repository.All<Episode>().Where(e => e.AirDate > DateTime.Today.AddDays(1) && e.AirDate < DateTime.Today.AddDays(8))
.ToList();
}
}

@ -58,6 +58,23 @@ namespace NzbDrone.Web.Controllers
return View(new GridModel(upcoming));
}
[GridAction]
public ActionResult _AjaxBindingTomorrow()
{
var upcoming = _upcomingEpisodesProvider.Tomorrow().Select(e => new UpcomingEpisodeModel
{
SeriesId = e.Series.SeriesId,
SeriesName = e.Series.Title,
SeasonNumber = e.SeasonNumber,
EpisodeNumber = e.EpisodeNumber,
Title = e.Title,
Overview = e.Overview,
AirDate = e.AirDate.Add(Convert.ToDateTime(e.Series.AirTimes).TimeOfDay)
});
return View(new GridModel(upcoming));
}
[GridAction]
public ActionResult _AjaxBindingWeek()
{

@ -66,9 +66,37 @@ Upcoming
.Render();}
</div>
<br />
<div id="tomorrow">
<h2>
Tomorrow</h2>
@{Html.Telerik().Grid<UpcomingEpisodeModel>().Name("Tomorrow").NoRecordsTemplate(
"No watched shows airing tomorrow")
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(c => c.SeriesName)
.ClientTemplate("<a href=" +
Url.Action("Details", "Series", new { seriesId = "<#= SeriesId #>" }) +
"><#= SeriesName #></a>")
.Title("Series Name");
columns.Bound(c => c.SeasonNumber).Title("Season #").Width(40);
columns.Bound(c => c.EpisodeNumber).Title("Episode #").Width(40);
columns.Bound(c => c.Title).Title("Episode Title");
columns.Bound(c => c.AirDate).Title("Air Date").Width(160);
})
.DetailView(detailView => detailView.ClientTemplate(
"<fieldset>" +
"<div><b>Overview: </b><#= Overview #></div>" +
"</fieldset>"
))
.DataBinding(data => data.Ajax().Select("_AjaxBindingTomorrow", "Upcoming"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDate).Ascending()).Enabled(true))
.Render();}
</div>
<br />
<div id="week">
<h2>
7-Day Forecast</h2>
Future Forecast</h2>
@{Html.Telerik().Grid<UpcomingEpisodeModel>().Name("Week").NoRecordsTemplate(
"No watched shows airing in the next week...")
.TableHtmlAttributes(new { @class = "Grid" })

Loading…
Cancel
Save