2011-05-10 06:32:33 +00:00
|
|
|
@using NzbDrone.Core.Repository;
|
|
|
|
@using NzbDrone.Web.Models;
|
|
|
|
@model IEnumerable<NzbDrone.Core.Repository.Series>
|
2011-05-19 03:37:26 +00:00
|
|
|
|
2011-04-21 07:14:47 +00:00
|
|
|
@section TitleContent{
|
|
|
|
Series
|
|
|
|
}
|
|
|
|
|
2011-06-03 01:33:33 +00:00
|
|
|
<script type="text/javascript" src="../../Scripts/doTimeout.js"></script>
|
2011-06-02 03:36:30 +00:00
|
|
|
<script>
|
|
|
|
(function ($) {
|
|
|
|
$.fn.episodeProgress = function (episodes, totalEpisodes) {
|
|
|
|
return this.each(
|
2011-06-03 01:33:33 +00:00
|
|
|
function () {
|
2011-06-02 03:36:30 +00:00
|
|
|
var div = $(this);
|
2011-06-03 01:33:33 +00:00
|
|
|
var progressBar = div.find(".progress");
|
|
|
|
|
2011-06-02 03:36:30 +00:00
|
|
|
var width = Math.round(episodes / totalEpisodes * 100);
|
2011-06-03 01:33:33 +00:00
|
|
|
|
|
|
|
progressBar.css("width", width + "%");
|
2011-06-02 04:40:06 +00:00
|
|
|
|
|
|
|
if (width > 97) {
|
2011-06-03 01:33:33 +00:00
|
|
|
progressBar.css("-khtml-border-top-right-radius", "7px");
|
|
|
|
progressBar.css("border-top-right-radius", "7px");
|
|
|
|
progressBar.css("-moz-border-top-right-radius", "7px");
|
|
|
|
progressBar.css("-webkit-border-top-right-radius", "7px");
|
|
|
|
|
|
|
|
progressBar.css("-khtml-border-bottom-right-radius", "7px");
|
|
|
|
progressBar.css("border-bottom-right-radius", "7px");
|
|
|
|
progressBar.css("-moz-border-bottom-right-radius", "7px");
|
|
|
|
progressBar.css("-webkit-border-bottom-right-radius", "7px");
|
2011-06-02 04:40:06 +00:00
|
|
|
}
|
2011-06-03 01:33:33 +00:00
|
|
|
|
2011-06-02 03:36:30 +00:00
|
|
|
div.find(".progressText").html(episodes + " / " + totalEpisodes);
|
2011-06-03 01:33:33 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
})(jQuery);
|
2011-06-02 03:36:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
/* progress bar container */
|
|
|
|
.progressbar
|
|
|
|
{
|
|
|
|
border:1px solid grey;
|
2011-06-02 04:40:06 +00:00
|
|
|
-khtml-border-radius:8px;
|
|
|
|
border-radius:8px;
|
|
|
|
-moz-border-radius:8px;
|
|
|
|
-webkit-border-radius:8px;
|
2011-06-02 03:36:30 +00:00
|
|
|
width:125px;
|
|
|
|
height:20px;
|
|
|
|
position:relative;
|
2011-06-02 04:40:06 +00:00
|
|
|
color:black;
|
2011-06-02 03:36:30 +00:00
|
|
|
}
|
2011-06-02 04:40:06 +00:00
|
|
|
|
|
|
|
/* apply curves to the progress bar */
|
|
|
|
.progress
|
|
|
|
{
|
|
|
|
-khtml-border-top-left-radius:7px;
|
|
|
|
border-top-left-radius:7px;
|
|
|
|
-moz-border-top-left-radius:7px;
|
|
|
|
-webkit-border-top-left-radius:7px;
|
|
|
|
|
|
|
|
-khtml-border-bottom-left-radius:7px;
|
|
|
|
border-bottom-left-radius:7px;
|
|
|
|
-moz-border-bottom-left-radius:7px;
|
|
|
|
-webkit-border-bottom-left-radius:7px;
|
|
|
|
}
|
|
|
|
|
2011-06-02 03:36:30 +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;
|
|
|
|
}
|
|
|
|
</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=" +
|
|
|
|
Url.Action("Details", "Series", new {seriesId = "<#= SeriesId #>"}) +
|
|
|
|
"><#= 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\">" +
|
|
|
|
"<div class=\"progressText\"></div>" +
|
|
|
|
"<div class=\"progress\">" +
|
|
|
|
"<span class=\"progressText\" style=\"width: 125px;\"></span>" +
|
|
|
|
"</div>" +
|
|
|
|
"</div>");
|
2011-05-19 03:37:26 +00: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 06:32:33 +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))
|
|
|
|
.DetailView(detailView => detailView.ClientTemplate("<div style=\"width:95%\"><#= Overview #></div>"))
|
|
|
|
.ClientEvents(clientEvents => { clientEvents.OnEdit("grid_edit");
|
2011-06-05 05:23:50 +00:00
|
|
|
clientEvents.OnSave("grid_save");
|
2011-05-19 03:37:26 +00:00
|
|
|
clientEvents.OnDataBinding("grid_bind");
|
|
|
|
clientEvents.OnDataBound("grid_bound");
|
2011-06-02 03:36:30 +00:00
|
|
|
clientEvents.OnRowDataBound("grid_rowBound");
|
2011-05-19 03:37:26 +00:00
|
|
|
})
|
|
|
|
.Render();}
|
|
|
|
<span class="grid-loader"><img src="@Url.Content( "~/Content/Images/Loading.gif" )" alt="Loading"/> Loading...</span>
|
|
|
|
</div>
|
2011-04-21 07:14:47 +00:00
|
|
|
}
|
2011-05-12 02:53:19 +00:00
|
|
|
|
|
|
|
<script type="text/javascript">
|
2011-05-16 06:27:02 +00:00
|
|
|
var windowElement;
|
|
|
|
|
2011-05-12 02:53:19 +00:00
|
|
|
function grid_edit(args) {
|
2011-06-02 03:36:30 +00:00
|
|
|
$(args.form)
|
|
|
|
.closest(".t-window")
|
|
|
|
.data("tWindow")
|
|
|
|
.center();
|
2011-06-05 05:23:50 +00:00
|
|
|
|
|
|
|
var seriesId = args.dataItem.SeriesId;
|
|
|
|
var url = '@Url.Action("SeasonEditor", "Series")';
|
|
|
|
$('#season-editor').load(url, { seriesId: seriesId });
|
|
|
|
}
|
|
|
|
|
|
|
|
function grid_save(e) {
|
|
|
|
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) { }
|
|
|
|
});
|
|
|
|
});
|
2011-06-02 03:36:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function grid_rowBound(e) {
|
2011-06-02 07:23:38 +00:00
|
|
|
var dataItem = e.dataItem;
|
|
|
|
var seriesId = dataItem.SeriesId;
|
|
|
|
var getEpisodeCountUrl = '@Url.Action("GetEpisodeCount", "Series")';
|
|
|
|
|
|
|
|
$("#progressbar_" + seriesId).episodeProgress(0, 0);
|
2011-06-03 01:33:33 +00:00
|
|
|
|
2011-06-02 07:23:38 +00:00
|
|
|
$.ajax({
|
2011-06-03 01:33:33 +00:00
|
|
|
type: "GET",
|
|
|
|
url: getEpisodeCountUrl,
|
|
|
|
data: jQuery.param({ seriesId: seriesId }),
|
|
|
|
error: function (req, status, error) {
|
|
|
|
alert("Sorry! We could search for " + id + " at this time. " + error);
|
|
|
|
},
|
|
|
|
success: function (data, textStatus, jqXHR) {
|
|
|
|
var episodes = data.Episodes;
|
|
|
|
var episodeTotal = data.EpisodeTotal;
|
2011-06-03 03:04:39 +00:00
|
|
|
|
|
|
|
var counter = 0;
|
|
|
|
var max = episodes + 1;
|
|
|
|
|
|
|
|
$.doTimeout(10, function () {
|
|
|
|
if (counter >= max) {
|
|
|
|
$("#progressbar_" + seriesId).episodeProgress(episodes, episodeTotal);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$("#progressbar_" + seriesId).episodeProgress(counter, episodeTotal);
|
|
|
|
|
|
|
|
counter += 5;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
});
|
2011-06-03 01:33:33 +00:00
|
|
|
}
|
|
|
|
});
|
2011-06-02 03:36:30 +00:00
|
|
|
}
|
2011-05-12 02:53:19 +00:00
|
|
|
</script>
|