Sonarr/NzbDrone.Web/Views/Series/Index.cshtml

273 lines
8.0 KiB
Plaintext
Raw Normal View History

@using NzbDrone.Common
2011-12-12 21:52:29 +00:00
@using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models;
@model List<NzbDrone.Web.Models.SeriesModel>
@{ViewBag.Title = "NzbDrone";}
2011-12-12 21:52:29 +00:00
@section HeaderContent
{
@Html.IncludeCss("Settings.css")
@Html.IncludeCss("Grid.css")
2011-12-12 21:52:29 +00:00
}
<style>
.ui-progressbar
{
position:relative;
width: 125px;
height: 20px;
background-color: transparent;
border: 1px solid #065EFE;
margin: 2px;
}
.progressBarText
{
position: absolute;
display: block;
width: 100%;
text-align: center;
}
.ui-progressbar-value
{
overflow: hidden;
border: 1px solid #065EFE;
}
.ui-progressbar-value .progressBarText
{
position: relative;
font-weight: normal;
color: white;
}
/* Set the row height so it won't resize when the progress bar is created */
.seriesTable tr
{
height: 28px;
}
.editButton, .deleteButton
{
width: 18px;
height: 18px;
padding: 3px 1px;
margin: 0px;
vertical-align: middle;
}
.editButton:hover, .deleteButton:hover
{
background-color: #065EFE;
}
2012-02-05 20:23:37 +00:00
.commandsColumn
{
text-align: center;
}
.ui-dialog-buttonpane .ui-dialog-buttonset .ui-delete-button
{
margin-right: 445px;
}
.ui-dialog-buttonset .ui-delete-button
{
background: url("images/ui-bg_flat_30_b40404_40x100.png") repeat-x scroll 50% 50% #B40404;
border: 1px solid #FFFFFF;
color: #FFFFFF;
font-weight: normal;
}
.ui-dialog-buttonset .ui-delete-button:active
{
background: url("images/ui-bg_flat_30_616161_40x100.png") repeat-x scroll 50% 50% #616161;
border: 1px solid #FFFFFF;
color: #FFFFFF;
font-weight: normal;
}
</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>
}
<table class="seriesTable">
<colgroup>
<col/>
<col style="width:100px" />
<col style="width:100px" />
<col style="width:100px" />
<col style="width:100px" />
<col style="width:140px" />
2012-02-05 20:23:37 +00:00
<col style="width:70px" />
</colgroup>
<tr>
<th>Title</th>
<th>Seasons</th>
<th>Quality</th>
<th>Status</th>
<th>Next Airing</th>
<th>Episodes</th>
@*Commands Column*@
<th>
2012-02-05 20:23:37 +00:00
</th>
</tr>
@for (int i = 0; i < Model.Count; i++)
{
var series = Model[i];
if (i % 2 == 0)
{
Html.RenderPartial("Series", series);
}
else
{
Html.RenderPartial("Series", series, new ViewDataDictionary { new KeyValuePair<string, object>("AltRow", true) });
}
}
</table>
<div id="seriesEditor" title="Edit Series"></div>
<div id="seriesDelete" title="Delete Series">
<input class="seriesId" type="hidden" value="">
Are you sure you want to delete '<span class="seriesTitle"></span>'?
</div>
@section Scripts{
<script type="text/javascript">
var seriesEditorUrl = './Series/SeriesEditor';
var saveSeriesEditorUrl = './Series/SaveSeriesEditor';
var seriesDeleteUrl = './Series/DeleteSeries';
$(document).ready(function () {
$(".progressBar").each(function () {
var element = this;
var progressbar = $(element).progressbar({
value: parseInt($(element).attr("value"))
2011-06-23 06:56:17 +00:00
});
var label = progressbar.find('.progressBarText').clone().width(progressbar.width());
progressbar.find('.ui-progressbar-value').append(label);
});
});
$("#seriesEditor").dialog({
autoOpen: false,
height: 350,
width: 670,
resizable: false,
modal: true,
buttons: {
"Delete": {
text: "Delete",
class: "ui-delete-button",
click: function () {
var answer = confirm("Are you sure you want to delete this series?");
if (answer) {
var seriesId = $('#SeriesId').val();
$.ajax({
type: "POST",
url: seriesDeleteUrl,
data: { seriesId: seriesId },
success: function (data) {
//Remove the row from the grid... along with the details row
$('.' + seriesId).hide();
$('.details_' + seriesId).hide();
}
});
$(this).dialog("close");
}
}
},
"Save": function () {
//Save the form
$('#SeriesEditorForm').submit();
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
$("#seriesDelete").dialog({
autoOpen: false,
resizable: false,
height: 170,
width: 450,
modal: true,
buttons: {
"Delete": function () {
var seriesId = $('.seriesId').val();
$.ajax({
type: "POST",
url: seriesDeleteUrl,
data: { seriesId: seriesId },
success: function (data) {
//Remove the row from the grid... along with the details row
$('.' + seriesId).hide();
$('.details_' + seriesId).hide();
}
});
$(this).dialog("close");
},
Cancel: function () {
$(this).dialog("close");
}
}
});
$(".editButton")
//.button()
.live('click', function () {
//Get the SeriesId and Title
var seriesId = parseInt($(this).attr("value"));
var title = $(this).attr("rel");
//Set the title of the dialog
$("#seriesEditor").dialog("option", "title", "Edit Series: " + title);
//Pre-populate the view with ajax
$('#seriesEditor').html('<div style="text-align: center; width: 100%; height: 100%;"><img src="../../Content/Images/ajax-loader.gif" style="padding-top: 120px;" /></div>');
//Get the view
$.ajax({
url: seriesEditorUrl,
data: { seriesId: seriesId },
success: function (data) {
$('#seriesEditor').html(data);
}
});
//Open the dialog
$("#seriesEditor").dialog("open");
});
$(".deleteButton")
//.button()
.live('click', function () {
//Get the SeriesId and Title
var seriesId = parseInt($(this).attr("value"));
var title = $(this).attr("rel");
//Set the title of the dialog
//$("#seriesDelete").dialog("option", "title", "Delete Series: " + title);
//Fill in the view
$('#seriesDelete').children('.seriesId').val(seriesId);
$('#seriesDelete').children('.seriesTitle').html(title);
//Open the dialog
$("#seriesDelete").dialog("open");
});
</script>
}