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.
168 lines
6.5 KiB
168 lines
6.5 KiB
@using NzbDrone.Core.Repository;
|
|
@using NzbDrone.Web.Models;
|
|
@model IEnumerable<NzbDrone.Core.Repository.Series>
|
|
@section TitleContent{
|
|
Series
|
|
}
|
|
<style>
|
|
/* progress bar container */
|
|
.progressbar
|
|
{
|
|
border: 1px solid #065EFE;
|
|
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>
|
|
@section ActionMenu{
|
|
@{Html.RenderPartial("SubMenu");}
|
|
}
|
|
@section MainContent{
|
|
<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.Command(commands =>
|
|
{
|
|
commands.Edit().ButtonType(GridButtonType.Image);
|
|
commands.Delete().ButtonType(GridButtonType.Image);
|
|
}).Title("Actions").Width(80);
|
|
|
|
columns.Bound(o => o.Title)
|
|
.ClientTemplate("<a href=" +
|
|
Url.Action("Details", "Series", new { seriesId = "<#= SeriesId #>" }) +
|
|
"><#= Title #></a>");
|
|
columns.Bound(o => o.SeasonsCount).Title("Seasons");
|
|
columns.Bound(o => o.QualityProfileName).Title("Quality");
|
|
columns.Bound(o => o.Status);
|
|
columns.Bound(o => o.AirsDayOfWeek);
|
|
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>");
|
|
|
|
})
|
|
.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.OnSave("grid_save");
|
|
clientEvents.OnDataBinding("grid_bind");
|
|
clientEvents.OnDataBound("grid_bound");
|
|
clientEvents.OnRowDataBound("grid_rowBound");
|
|
})
|
|
.Render();}
|
|
<span class="grid-loader">
|
|
<img src="@Url.Content("~/Content/Images/Loading.gif")" alt="Loading"/>
|
|
Loading...</span>
|
|
</div>
|
|
}
|
|
|
|
@section Scripts{
|
|
<script type="text/javascript">
|
|
var windowElement;
|
|
|
|
function grid_edit(args) {
|
|
$(args.form)
|
|
.closest(".t-window")
|
|
.data("tWindow")
|
|
.center();
|
|
|
|
var seriesId = args.dataItem.SeriesId;
|
|
var url = '@Url.Action("SeasonEditor", "Series")';
|
|
$('#season-editor').load(url, { seriesId: seriesId }, function (response, status, xhr) {
|
|
$('#seasonEditorLoader').hide();
|
|
});
|
|
}
|
|
|
|
function grid_save(e) {
|
|
$('#ajaxSaveWheel').show();
|
|
|
|
var seasonEditor = e.form.SeasonEditor_collection;
|
|
var saveSeasonEditUrl = '@Url.Action("SaveSeason", "Series")';
|
|
|
|
jQuery.each(seasonEditor, function () {
|
|
var guid = $(this).val();
|
|
var prefix = '#SeasonEditor_' + guid + '__';
|
|
var seriesId = $(prefix + 'SeriesId').val();
|
|
var seasonNumber = $(prefix + 'SeasonNumber').val();
|
|
var monitored = $(prefix + 'Monitored').attr('checked');
|
|
|
|
$.ajax({
|
|
type: "POST",
|
|
url: saveSeasonEditUrl,
|
|
data: jQuery.param({ seriesId: seriesId, seasonNumber: seasonNumber, monitored: monitored }),
|
|
error: function (req, status, error) {
|
|
alert("Sorry! We could save season changes at this time. " + error);
|
|
},
|
|
success: function (data, textStatus, jqXHR) { }
|
|
});
|
|
});
|
|
}
|
|
|
|
function grid_rowBound(e) {
|
|
var dataItem = e.dataItem;
|
|
var seriesId = dataItem.SeriesId;
|
|
var episodeCount = dataItem.EpisodeCount;
|
|
var episodeFileCount = dataItem.EpisodeFileCount;
|
|
|
|
$("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount);
|
|
}
|
|
</script>
|
|
<script type="text/javascript" src="../../Scripts/doTimeout.js"></script>
|
|
<script type="text/javascript">
|
|
(function ($) {
|
|
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
|
return this.each(
|
|
function () {
|
|
var div = $(this);
|
|
var progressBar = div.find(".progress");
|
|
|
|
var width = Math.round(episodes / totalEpisodes * 100);
|
|
|
|
progressBar.css("width", width + "%");
|
|
div.find(".progressText").html(episodes + " / " + totalEpisodes);
|
|
});
|
|
};
|
|
})(jQuery);
|
|
</script>
|
|
}
|