Series Details updated with overlay when loading.

pull/4/head
Mark McDowall 14 years ago
parent 1015193ef5
commit 1fca5f3e5f

@ -577,6 +577,7 @@
<Content Include="Content\Images\Indexers\NzbsOrg.png" /> <Content Include="Content\Images\Indexers\NzbsOrg.png" />
<Content Include="Content\Images\Indexers\NzbsRus.png" /> <Content Include="Content\Images\Indexers\NzbsRus.png" />
<Content Include="Content\Images\Indexers\Unknown.png" /> <Content Include="Content\Images\Indexers\Unknown.png" />
<Content Include="Content\Images\Loading.gif" />
<Content Include="Content\Images\Plus.png" /> <Content Include="Content\Images\Plus.png" />
<Content Include="Content\Images\spin.gif" /> <Content Include="Content\Images\spin.gif" />
<Content Include="Content\Images\ui-bg_diagonals-small_0_aaaaaa_40x40.png" /> <Content Include="Content\Images\ui-bg_diagonals-small_0_aaaaaa_40x40.png" />

@ -58,60 +58,72 @@
{ {
<br /> <br />
<h3> <h3>Season @season.SeasonNumber</h3>
Season @season.SeasonNumber</h3> <div class="grid-container">
Season season1 = season; @{Season season1 = season;
Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season.SeasonNumber) Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season.SeasonNumber)
.TableHtmlAttributes(new { @class = "Grid" }) .TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns => .Columns(columns =>
{ {
columns.Bound(o => o.EpisodeId) columns.Bound(o => o.EpisodeId)
.ClientTemplate( .ClientTemplate(
"<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />") "<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />")
.Title("") .Title("")
.Width(1) .Width(1)
.HtmlAttributes(new { style = "text-align:center" }); .HtmlAttributes(new { style = "text-align:center" });
columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode");
columns.Bound(c => c.Title).Title("Title").Width(300); columns.Bound(c => c.Title).Title("Title").Width(300);
columns.Bound(c => c.AirDate).Format("{0:d}").Width(10); columns.Bound(c => c.AirDate).Format("{0:d}").Width(10);
columns.Bound(c => c.Quality).Width(10); columns.Bound(c => c.Quality).Width(10);
columns.Bound(c => c.Path); columns.Bound(c => c.Path);
}) })
//.DetailView(detailView => detailView.Template(e => Html.RenderPartial("EpisodeDetail", e))) .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>")) .ClientEvents(clientEvents =>
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) {
.Footer(false) clientEvents.OnDataBinding("grid_bind");
.DataBinding( clientEvents.OnDataBound("grid_bound");
d => })
d.Ajax().Select("_AjaxSeasonGrid", "Series", .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true))
new RouteValueDictionary { { "seasonId", season1.SeasonId.ToString() } })) .Footer(false)
//.EnableCustomBinding(true) .DataBinding(
//.ClientEvents(e => e.OnDetailViewExpand("episodeDetailExpanded")) //Causes issues displaying the episode detail multiple times... d =>
.ToolBar( d.Ajax().Select("_AjaxSeasonGrid", "Series",
c => new RouteValueDictionary { { "seasonId", season1.SeasonId.ToString() } }))
c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season1.SeasonId }) .ToolBar(
.ButtonType(GridButtonType.Text)) c =>
.Render(); c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season1.SeasonId })
.ButtonType(GridButtonType.Text))
.Render();}
<span class="grid-loader"><img src="@Url.Content("~/Content/Images/Loading.gif")" alt="Loading"/> Loading...</span>
</div>
} }
@{var specialSeasons = Model.Seasons.Where(s => s.SeasonNumber == 0).FirstOrDefault();} @{var specialSeasons = Model.Seasons.Where(s => s.SeasonNumber == 0).FirstOrDefault();}
@if (specialSeasons != null) @if (specialSeasons != null)
{ {
<br /> <br />
<h3> <h3>Specials</h3>
Specials</h3> <div class="grid-container">
Html.Telerik().Grid(specialSeasons.Episodes).Name("seasons_specials") @{Html.Telerik().Grid(specialSeasons.Episodes).Name("seasons_specials")
.TableHtmlAttributes(new { @class = "Grid" }) .TableHtmlAttributes(new {@class = "Grid"})
.Columns(columns => .Columns(columns =>
{ {
columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode");
columns.Bound(c => c.Title); columns.Bound(c => c.Title);
columns.Bound(c => c.AirDate).Format("{0:d}").Width(0); columns.Bound(c => c.AirDate).Format("{0:d}").Width(0);
}) })
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber)).Enabled(false)) //.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.Footer(false) .ClientEvents(clientEvents =>
.Render(); {
clientEvents.OnDataBinding("grid_bind");
clientEvents.OnDataBound("grid_bound");
})
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber)).Enabled(false))
.Footer(false)
.Render(); }
<span class="grid-loader"><img src="@Url.Content("~/Content/Images/Loading.gif")" alt="Loading"/> Loading...</span>
</div>
} }
} }
@section Scripts{ @section Scripts{
@ -119,5 +131,13 @@
function episodeDetailExpanded(e) { function episodeDetailExpanded(e) {
$console.log("OnDetailViewExpand :: " + e.masterRow.cells[1].innerHTML); $console.log("OnDetailViewExpand :: " + e.masterRow.cells[1].innerHTML);
} }
function grid_bind(args) {
$('.grid-container').children('.grid-loader').stop().css("top", "0px").fadeIn('slow');
}
function grid_bound(args) {
$('.grid-container').children('.grid-loader').stop().fadeOut('slow');
}
</script> </script>
} }

Loading…
Cancel
Save