2011-05-10 08:32:33 +02:00
|
|
|
@using NzbDrone.Core.Repository;
|
|
|
|
@using NzbDrone.Web.Models;
|
|
|
|
@model IEnumerable<NzbDrone.Core.Repository.Series>
|
2011-05-19 05:37:26 +02:00
|
|
|
|
2011-04-21 09:14:47 +02:00
|
|
|
@section TitleContent{
|
|
|
|
Series
|
|
|
|
}
|
|
|
|
|
2011-06-02 05:36:30 +02:00
|
|
|
<script>
|
|
|
|
(function ($) {
|
|
|
|
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
|
|
|
return this.each(
|
|
|
|
function () {
|
|
|
|
var div = $(this);
|
|
|
|
var innerdiv = div.find(".progress");
|
|
|
|
|
|
|
|
var width = Math.round(episodes / totalEpisodes * 100);
|
|
|
|
innerdiv.css("width", width + "%");
|
|
|
|
div.find(".progressText").html(episodes + " / " + totalEpisodes);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
};
|
|
|
|
})(jQuery);
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
/* progress bar container */
|
|
|
|
.progressbar
|
|
|
|
{
|
|
|
|
border:1px solid grey;
|
|
|
|
width:125px;
|
|
|
|
height:20px;
|
|
|
|
position:relative;
|
|
|
|
color:black;
|
|
|
|
}
|
|
|
|
/* color bar */
|
|
|
|
.progressbar div.progress
|
|
|
|
{
|
|
|
|
position:absolute;
|
|
|
|
width:0;
|
|
|
|
height:100%;
|
|
|
|
overflow:hidden;
|
|
|
|
background-color:#065EFE;
|
|
|
|
}
|
|
|
|
/* text on bar */
|
|
|
|
.progressbar div.progress .progressText{
|
|
|
|
position:absolute;
|
|
|
|
text-align:center;
|
|
|
|
color:white;
|
|
|
|
}
|
|
|
|
/* text off bar */
|
|
|
|
.progressbar div.progressText{
|
|
|
|
position:absolute;
|
|
|
|
width:100%;
|
|
|
|
height:100%;
|
|
|
|
text-align:center;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2011-04-21 09:14:47 +02:00
|
|
|
@section ActionMenu{
|
|
|
|
@{Html.RenderPartial("SubMenu");}
|
|
|
|
}
|
|
|
|
|
|
|
|
@section MainContent{
|
2011-05-19 05:37:26 +02:00
|
|
|
<div class="grid-container">
|
|
|
|
@{Html.Telerik().Grid<SeriesModel>().Name("Grid")
|
|
|
|
.TableHtmlAttributes(new { @class = "Grid" })
|
|
|
|
.DataKeys(keys => keys.Add(p => p.SeriesId))
|
|
|
|
.DataBinding(data => data.Ajax()
|
|
|
|
.Select("_AjaxSeriesGrid", "Series")
|
|
|
|
.Update("_SaveAjaxSeriesEditing", "Series")
|
|
|
|
.Delete("_DeleteAjaxSeriesEditing", "Series"))
|
|
|
|
.Columns(columns =>
|
|
|
|
{
|
|
|
|
columns.Bound(o => o.Title)
|
|
|
|
.ClientTemplate("<a href=" +
|
|
|
|
Url.Action("Details", "Series", new {seriesId = "<#= SeriesId #>"}) +
|
|
|
|
"><#= Title #></a>");
|
|
|
|
columns.Bound(o => o.SeasonsCount).Title("Seasons")
|
|
|
|
.ClientTemplate("<a href=# onclick=\"openSeasonEditor(<#= SeriesId #>, \'<#= Title #>\'); return false;\"><#= SeasonsCount #></a>");
|
|
|
|
columns.Bound(o => o.QualityProfileName).Title("Quality");
|
|
|
|
columns.Bound(o => o.Status);
|
|
|
|
columns.Bound(o => o.AirsDayOfWeek);
|
2011-06-02 05:36:30 +02:00
|
|
|
columns.Bound(o => o.Episodes).Title("Episodes").Width(125)
|
|
|
|
.ClientTemplate("<div id=\"progressbar_<#= SeriesId #>\" class=\"progressbar\">" +
|
|
|
|
"<div class=\"progressText\"></div>" +
|
|
|
|
"<div class=\"progress\">" +
|
|
|
|
"<span class=\"progressText\" style=\"width: 125px;\"></span>" +
|
|
|
|
"</div>" +
|
|
|
|
"</div>");
|
2011-05-19 05:37:26 +02:00
|
|
|
columns.Bound(o => o.Path);
|
|
|
|
columns.Command(commands =>
|
|
|
|
{
|
|
|
|
commands.Edit().ButtonType(GridButtonType.Image);
|
|
|
|
commands.Delete().ButtonType(GridButtonType.Image);
|
|
|
|
}).Title("Actions").Width(80);
|
2011-05-10 08:32:33 +02:00
|
|
|
|
2011-05-19 05:37:26 +02:00
|
|
|
})
|
|
|
|
.Editable(editor => editor.Mode(GridEditMode.PopUp))
|
|
|
|
.Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(true))
|
|
|
|
.DetailView(detailView => detailView.ClientTemplate("<div style=\"width:95%\"><#= Overview #></div>"))
|
|
|
|
.ClientEvents(clientEvents => { clientEvents.OnEdit("grid_edit");
|
|
|
|
clientEvents.OnDataBinding("grid_bind");
|
|
|
|
clientEvents.OnDataBound("grid_bound");
|
2011-06-02 05:36:30 +02:00
|
|
|
clientEvents.OnRowDataBound("grid_rowBound");
|
2011-05-19 05:37:26 +02:00
|
|
|
})
|
|
|
|
.Render();}
|
|
|
|
<span class="grid-loader"><img src="@Url.Content( "~/Content/Images/Loading.gif" )" alt="Loading"/> Loading...</span>
|
|
|
|
</div>
|
2011-04-21 09:14:47 +02:00
|
|
|
}
|
2011-05-12 04:53:19 +02:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2011-05-16 08:27:02 +02:00
|
|
|
var windowElement;
|
|
|
|
|
2011-05-12 04:53:19 +02:00
|
|
|
function grid_edit(args) {
|
2011-06-02 05:36:30 +02:00
|
|
|
$(args.form)
|
|
|
|
.closest(".t-window")
|
|
|
|
.data("tWindow")
|
|
|
|
.center();
|
|
|
|
}
|
|
|
|
|
|
|
|
function grid_rowBound(e) {
|
|
|
|
var data = e.dataItem;
|
|
|
|
|
|
|
|
var seriesId = data.SeriesId;
|
|
|
|
var episodes = data.Episodes;
|
|
|
|
var episodeTotal = data.EpisodeTotal;
|
|
|
|
|
|
|
|
$("#progressbar_" + seriesId).episodeProgress(episodes, episodeTotal);
|
|
|
|
}
|
|
|
|
|
2011-05-16 08:27:02 +02:00
|
|
|
|
|
|
|
function openSeasonEditor(seriesId, seriesName) {
|
|
|
|
windowElement = null;
|
|
|
|
windowElement = $.telerik.window.create({
|
|
|
|
title: "<b>Season Editor: " + seriesName + "</b>",
|
|
|
|
contentUrl: '@Url.Action("SeasonEditor", "Series")' + '/?seriesId=' + seriesId,
|
|
|
|
width: 360,
|
|
|
|
height: 400,
|
|
|
|
modal: true,
|
|
|
|
resizable: false,
|
|
|
|
draggable: true,
|
|
|
|
scrollable: true
|
|
|
|
});
|
|
|
|
|
|
|
|
windowElement.data('tWindow').center();
|
|
|
|
}
|
|
|
|
|
|
|
|
function closeSeasonEditor() {
|
|
|
|
$('#form').remove();
|
|
|
|
var window = windowElement.data("tWindow");
|
|
|
|
window.close();
|
|
|
|
}
|
2011-05-12 04:53:19 +02:00
|
|
|
</script>
|