1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-11-01 00:12:30 +01:00
Sonarr/NzbDrone.Web/Views/Series/Index.cshtml

142 lines
5.0 KiB
Plaintext
Raw Normal View History

@using NzbDrone.Core.Helpers;
@using NzbDrone.Web.Models;
@model IEnumerable<NzbDrone.Core.Repository.Series>
@section TitleContent{
NZBDrone
}
<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;
}
.t-grid .t-alt
{
background: #E5ECF9;
}
</style>
@section ActionMenu{
<ul class="sub-menu">
<li>@Html.ActionLink("Add Series", "Index", "AddSeries")</li>
<li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null)</li>
</ul>
}
@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 #>" }) +
2011-05-19 05:37:26 +02:00
"><#= Title #></a>");
2011-06-05 07:23:50 +02:00
columns.Bound(o => o.SeasonsCount).Title("Seasons");
2011-05-19 05:37:26 +02:00
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>");
2011-06-29 06:51:30 +02:00
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
commands.Delete().ButtonType(GridButtonType.Image);
}).Title("Actions").Width(80);
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("<#= Overview #>"))
.ClientEvents(clientEvents =>
{
clientEvents.OnEdit("grid_edit");
clientEvents.OnSave("grid_save");
clientEvents.OnRowDataBound("grid_rowBound");
})
2011-05-19 05:37:26 +02:00
.Render();}
</div>
}
@section Scripts{
<script type="text/javascript">
var windowElement;
2011-06-30 08:15:06 +02:00
function grid_edit(args) {
$(args.form)
.closest(".t-window")
.data("tWindow")
.center();
}
function grid_save(e) {
$('#ajaxSaveWheel').show();
}
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);
}
(function ($) {
$.fn.episodeProgress = function (episodes, totalEpisodes) {
return this.each(
2011-06-23 08:56:17 +02: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);
});
};
})(jQuery);
</script>
}