You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Readarr/NzbDrone.Web/Views/Series/Details.cshtml

159 lines
7.4 KiB

@model NzbDrone.Web.Models.SeriesModel
@using NzbDrone.Core.Repository
@using NzbDrone.Web.Models
@section TitleContent{
@Model.Title
}
@section ActionMenu{
@{Html.Telerik().Menu().Name("SeriesMenu").Items(items =>
{
items.Add().Text("Back to Series List").Action("Index", "Series");
items.Add().Text("Scan For Episodes on Disk")
.Action("SyncEpisodesOnDisk", "Series", new { seriesId = Model.SeriesId });
items.Add().Text("Update Info").Action("UpdateInfo", "Series", new { seriesId = Model.SeriesId });
items.Add().Text("Rename Series").Action("RenameSeries", "Series", new { seriesId = Model.SeriesId });
}).Render();}
}
@section MainContent{
<fieldset>
<div class="display-label">
ID</div>
<div class="display-field">
@Model.SeriesId</div>
<div class="display-label">
Overview</div>
<div class="display-field">
@Model.Overview</div>
<div class="display-label">
Status</div>
<div class="display-field">
@Model.Status</div>
<div class="display-label">
AirTimes</div>
<div class="display-field">
@Model.AirsDayOfWeek.ToString()</div>
<div class="display-label">
Language</div>
<div class="display-label">
Location</div>
<div class="display-field">
@Model.Path</div>
</fieldset>
@*Todo: This breaks when using SQLServer... thoughts?*@ @*Easy, don't use SQL Server!!!*@
@foreach (var season in Model.Seasons.Where(s => s > 0).Reverse())
{
<br />
<h3>
Season @season</h3>
<div class="grid-container">
@{
Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season)
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(o => o.EpisodeId)
.ClientTemplate(
"<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />")
.Title("")
.Width(1)
.HtmlAttributes(new { style = "text-align:center" });
columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode");
columns.Bound(c => c.Title).Title("Title");
columns.Bound(c => c.AirDate).Format("{0:d}").Width(0);
columns.Bound(c => c.Quality).Width(0);
columns.Bound(c => c.Status).Width(0);
columns.Bound(o => o.EpisodeId).Title("")
.ClientTemplate("<a href='#Search' onClick=\"searchForEpisode('<#= EpisodeId #>'); return false;\">Search</a>"
+ " | " +
"<a href='#Rename' onClick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\">Rename</a>");
})
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.ClientEvents(clientEvents =>
{
clientEvents.OnDataBinding("grid_bind");
clientEvents.OnDataBound("grid_bound");
})
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true))
.Footer(true)
.DataBinding(
d =>
d.Ajax().Select("_AjaxSeasonGrid", "Series",
new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", season } }))
.ToolBar(
c =>
c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season })
.ButtonType(GridButtonType.Text))
.Render();}
<span class="grid-loader">
<img src="@Url.Content("~/Content/Images/Loading.gif")" alt="Loading"/>
Loading...</span>
</div>
}
@{var specialSeason = Model.Seasons.Where(s => s == 0).FirstOrDefault();}
@if (specialSeason != null)
{
<br />
<h3>
Specials</h3>
<div class="grid-container">
@{Html.Telerik().Grid<EpisodeModel>().Name("seasons_specials")
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(o => o.EpisodeId)
.ClientTemplate(
"<input type='checkbox' name='checkedEpisodes' value='<#= EpisodeId #>' />")
.Title("")
.Width(1)
.HtmlAttributes(new { style = "text-align:center" });
columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode");
columns.Bound(c => c.Title).Title("Title").Width(10000);
columns.Bound(c => c.AirDate).Format("{0:d}").Width(10);
columns.Bound(c => c.Quality).Width(10);
columns.Bound(c => c.Status).Width(10);
})
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))
.ClientEvents(clientEvents =>
{
clientEvents.OnDataBinding("grid_bind");
clientEvents.OnDataBound("grid_bound");
})
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true))
.Footer(true)
.DataBinding(
d =>
d.Ajax().Select("_AjaxSeasonGrid", "Series",
new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", specialSeason } }
)).Render(); }
<span class="grid-loader">
<img src="@Url.Content("~/Content/Images/Loading.gif")" alt="Loading"/>
Loading...</span>
</div>
}
}
@section Scripts{
<script type="text/javascript">
function episodeDetailExpanded(e) {
$console.log("OnDetailViewExpand :: " + e.masterRow.cells[1].innerHTML);
}
var renameEpisodeUrl = '@Url.Action("Rename", "Episode")';
function renameEpisode(id) {
$.ajax({
type: "POST",
url: renameEpisodeUrl,
data: jQuery.param({ episodeFileId: id }),
error: function (req, status, error) {
alert("Sorry! We could rename " + id + " at this time. " + error);
}
});
}
</script>
}