2011-06-30 06:19:44 +00:00
|
|
|
@using NzbDrone.Core.Repository;
|
2011-05-10 06:32:33 +00:00
|
|
|
@using NzbDrone.Web.Models;
|
|
|
|
@model IEnumerable<NzbDrone.Core.Repository.Series>
|
2011-04-21 07:14:47 +00:00
|
|
|
@section TitleContent{
|
2011-06-25 01:20:52 +00:00
|
|
|
Series
|
2011-04-21 07:14:47 +00:00
|
|
|
}
|
2011-06-02 03:36:30 +00:00
|
|
|
<style>
|
2011-06-25 01:20:52 +00:00
|
|
|
/* progress bar container */
|
|
|
|
.progressbar
|
|
|
|
{
|
|
|
|
border: 1px solid #065EFE;
|
|
|
|
width: 125px;
|
|
|
|
height: 20px;
|
|
|
|
position: relative;
|
|
|
|
color: black;
|
|
|
|
}
|
2011-06-02 04:40:06 +00:00
|
|
|
|
2011-06-25 01:20:52 +00:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
}
|
2011-07-03 19:02:33 +00:00
|
|
|
|
|
|
|
.t-grid .t-alt
|
|
|
|
{
|
|
|
|
background: #E5ECF9;
|
|
|
|
}
|
2011-06-02 03:36:30 +00:00
|
|
|
</style>
|
2011-04-21 07:14:47 +00:00
|
|
|
@section ActionMenu{
|
|
|
|
@{Html.RenderPartial("SubMenu");}
|
|
|
|
}
|
|
|
|
@section MainContent{
|
2011-05-19 03:37:26 +00: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=" +
|
2011-06-25 01:20:52 +00:00
|
|
|
Url.Action("Details", "Series", new { seriesId = "<#= SeriesId #>" }) +
|
2011-05-19 03:37:26 +00:00
|
|
|
"><#= Title #></a>");
|
2011-06-05 05:23:50 +00:00
|
|
|
columns.Bound(o => o.SeasonsCount).Title("Seasons");
|
2011-05-19 03:37:26 +00:00
|
|
|
columns.Bound(o => o.QualityProfileName).Title("Quality");
|
|
|
|
columns.Bound(o => o.Status);
|
|
|
|
columns.Bound(o => o.AirsDayOfWeek);
|
2011-06-02 03:36:30 +00:00
|
|
|
columns.Bound(o => o.Episodes).Title("Episodes").Width(125)
|
|
|
|
.ClientTemplate("<div id=\"progressbar_<#= SeriesId #>\" class=\"progressbar\">" +
|
2011-06-25 01:20:52 +00:00
|
|
|
"<div class=\"progressText\"></div>" +
|
2011-06-02 03:36:30 +00:00
|
|
|
"<div class=\"progress\">" +
|
|
|
|
"<span class=\"progressText\" style=\"width: 125px;\"></span>" +
|
|
|
|
"</div>" +
|
|
|
|
"</div>");
|
2011-06-29 04:51:30 +00:00
|
|
|
columns.Command(commands =>
|
|
|
|
{
|
|
|
|
commands.Edit().ButtonType(GridButtonType.Image);
|
|
|
|
commands.Delete().ButtonType(GridButtonType.Image);
|
|
|
|
}).Title("Actions").Width(80);
|
2011-06-28 01:23:22 +00:00
|
|
|
|
2011-05-19 03:37:26 +00:00
|
|
|
})
|
|
|
|
.Editable(editor => editor.Mode(GridEditMode.PopUp))
|
|
|
|
.Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(true))
|
2011-06-30 05:22:34 +00:00
|
|
|
.DetailView(detailView => detailView.ClientTemplate("<#= Overview #>"))
|
2011-06-25 01:20:52 +00:00
|
|
|
.ClientEvents(clientEvents =>
|
|
|
|
{
|
|
|
|
clientEvents.OnEdit("grid_edit");
|
|
|
|
clientEvents.OnSave("grid_save");
|
|
|
|
clientEvents.OnRowDataBound("grid_rowBound");
|
|
|
|
})
|
2011-05-19 03:37:26 +00:00
|
|
|
.Render();}
|
|
|
|
</div>
|
2011-04-21 07:14:47 +00:00
|
|
|
}
|
2011-06-28 01:23:22 +00:00
|
|
|
@section Scripts{
|
|
|
|
<script type="text/javascript">
|
|
|
|
var windowElement;
|
2011-06-30 06:15:06 +00:00
|
|
|
|
2011-06-28 01:23:22 +00:00
|
|
|
function grid_edit(args) {
|
|
|
|
$(args.form)
|
2011-06-02 03:36:30 +00:00
|
|
|
.closest(".t-window")
|
|
|
|
.data("tWindow")
|
|
|
|
.center();
|
2011-06-25 01:20:52 +00:00
|
|
|
|
2011-06-28 01:23:22 +00:00
|
|
|
var seriesId = args.dataItem.SeriesId;
|
|
|
|
var url = '@Url.Action("SeasonEditor", "Series")';
|
|
|
|
$('#season-editor').load(url, { seriesId: seriesId }, function (response, status, xhr) {
|
|
|
|
$('#seasonEditorLoader').hide();
|
|
|
|
});
|
|
|
|
}
|
2011-06-05 06:56:05 +00:00
|
|
|
|
2011-06-28 01:23:22 +00:00
|
|
|
function grid_save(e) {
|
|
|
|
$('#ajaxSaveWheel').show();
|
2011-06-25 01:20:52 +00:00
|
|
|
|
2011-06-28 01:23:22 +00:00
|
|
|
var seasonEditor = e.form.SeasonEditor_collection;
|
|
|
|
var saveSeasonEditUrl = '@Url.Action("SaveSeason", "Series")';
|
2011-06-05 05:23:50 +00:00
|
|
|
|
2011-06-28 01:23:22 +00:00
|
|
|
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');
|
2011-06-25 01:20:52 +00:00
|
|
|
|
2011-06-28 01:23:22 +00:00
|
|
|
$.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) { }
|
|
|
|
});
|
2011-06-05 05:23:50 +00:00
|
|
|
});
|
2011-06-28 01:23:22 +00:00
|
|
|
}
|
2011-06-02 03:36:30 +00:00
|
|
|
|
2011-06-28 01:23:22 +00:00
|
|
|
function grid_rowBound(e) {
|
|
|
|
var dataItem = e.dataItem;
|
|
|
|
var seriesId = dataItem.SeriesId;
|
|
|
|
var episodeCount = dataItem.EpisodeCount;
|
|
|
|
var episodeFileCount = dataItem.EpisodeFileCount;
|
2011-06-02 07:23:38 +00:00
|
|
|
|
2011-06-28 01:23:22 +00:00
|
|
|
$("#progressbar_" + seriesId).episodeProgress(episodeFileCount, episodeCount);
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function ($) {
|
|
|
|
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
|
|
|
return this.each(
|
2011-06-23 06:56:17 +00:00
|
|
|
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);
|
|
|
|
});
|
2011-06-28 01:23:22 +00:00
|
|
|
};
|
|
|
|
})(jQuery);
|
|
|
|
</script>
|
|
|
|
}
|