Series grid updated to remove Telerik MVC Grid.

pull/3113/head
Mark McDowall 13 years ago
parent ea86ce2fcb
commit a330348c8e

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

@ -278,4 +278,51 @@ button span, input[type="button"] span, input[type="submit"] span, input[type="r
.episodeMissing
{
background-color: #F5A9A9;
}
}
.seriesTable
{
width: 100%;
border-width: 1px;
border-spacing: 2px;
border-style: none;
border-color: white;
border-collapse: collapse;
}
.seriesTable th
{
font-family: "Segoe UI Light" , "Open Sans" , "Segoe UI" , sans-serif;
border-width: 300;
font-size: 17px;
padding: 2px;
border-style: inset;
border-color: #EEEEEE;
padding-left: 7px;
text-align: left;
background-color: white;
font-weight: lighter;
}
.seriesTable td
{
border-width: 1px;
padding: 0px 8px 0px 8px;
border-style: inset;
border-color: #EEEEEE;
}
.detail-view
{
display: none;
}
/* Colour alternating rows */
.seriesTable tr:nth-child(4n)
{
background: #f0f5ff;
}
.seriesTable tr:nth-child(4n+1)
{
background: #f0f5ff;
}

@ -26,6 +26,11 @@
color: #065EFE;
}
.ui-progressbar-value
{
background: #065EFE url(./jQueryUI/images/ui-bg_flat_30_065efe_40x100.png) 50% 50% repeat-x;
}
.jquery-tabs
{
margin-top: 10px;

@ -37,6 +37,12 @@ namespace NzbDrone.Web.Controllers
}
public ActionResult Index()
{
var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount()).OrderBy(o => SortHelper.SkipArticles(o.Title));
return View(series);
}
public ActionResult SeriesEditor(int seriesId)
{
var profiles = _qualityProvider.All();
ViewData["SelectList"] = new SelectList(profiles, "QualityProfileId", "Name");
@ -50,47 +56,31 @@ namespace NzbDrone.Web.Controllers
ViewData["BacklogSettingSelectList"] = new SelectList(backlogStatusTypes, "Key", "Value");
return View();
}
[GridAction]
public ActionResult _AjaxSeriesGrid()
{
var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount()).OrderBy(o => SortHelper.SkipArticles(o.Title));
return View(new GridModel(series));
var series = GetSeriesModels(new List<Series>{_seriesProvider.GetSeries(seriesId)}).Single();
return View(series);
}
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult _SaveAjaxSeriesEditing(int id, string path, bool monitored, bool seasonFolder, int qualityProfileId, int backlogSetting)
[HttpPost]
public JsonResult SaveSeriesEditor(SeriesModel seriesModel)
{
var oldSeries = _seriesProvider.GetSeries(id);
oldSeries.Monitored = monitored;
oldSeries.SeasonFolder = seasonFolder;
oldSeries.QualityProfileId = qualityProfileId;
oldSeries.Path = path;
oldSeries.BacklogSetting = (BacklogSettingType)backlogSetting;
var series = _seriesProvider.GetSeries(seriesModel.SeriesId);
series.Monitored = seriesModel.Monitored;
series.SeasonFolder = seriesModel.SeasonFolder;
series.QualityProfileId = seriesModel.QualityProfileId;
series.Path = seriesModel.Path;
series.BacklogSetting = (BacklogSettingType)seriesModel.BacklogSetting;
_seriesProvider.UpdateSeries(oldSeries);
_seriesProvider.UpdateSeries(series);
var series = GetSeriesModels(_seriesProvider.GetAllSeriesWithEpisodeCount()).OrderBy(o => SortHelper.SkipArticles(o.Title));
return View(new GridModel(series));
return JsonNotificationResult.Info("Series Saved");
}
[GridAction]
public ActionResult _DeleteAjaxSeriesEditing(int id)
[HttpPost]
public JsonResult DeleteSeries(int seriesId)
{
//Grab the series from the DB so we can remove it from the list we return to the client
var seriesInDb = _seriesProvider.GetAllSeriesWithEpisodeCount().ToList();
//Remove this so we don't send it back to the client (since it hasn't really been deleted yet)
seriesInDb.RemoveAll(s => s.SeriesId == id);
//Start removing this series
_jobProvider.QueueJob(typeof(DeleteSeriesJob), id);
_jobProvider.QueueJob(typeof(DeleteSeriesJob), seriesId);
var series = GetSeriesModels(seriesInDb).OrderBy(o => SortHelper.SkipArticles(o.Title));
return View(new GridModel(series));
return JsonNotificationResult.Info("Series Deleted");
}
public JsonResult LocalSearch(string term)

@ -142,6 +142,7 @@
<Content Include="Content\2011.3.1115\telerik.sitefinity.min.css" />
<Content Include="Content\Images\background.jpg" />
<Content Include="Content\Images\blue.png" />
<Content Include="Content\Images\Delete.png" />
<Content Include="Content\Images\Gear.png" />
<Content Include="Content\Images\green.png" />
<Content Include="Content\Images\header.jpg" />
@ -455,9 +456,6 @@
<ItemGroup>
<Content Include="Views\Missing\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\EditorTemplates\SeriesModel.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\AddSeries\ExistingSeries.cshtml" />
</ItemGroup>
@ -548,6 +546,12 @@
<ItemGroup>
<Content Include="Views\Series\Details.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\Series.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Series\SeriesEditor.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

@ -1,4 +1,15 @@
function grid_onError(e) {
/* Click on row, show details */
$('.seriesTable a').live('click', function () {
var link = $(this).attr('href');
window.location = link;
event.preventDefault();
});
$('.seriesTable tr td:not(:last-child)').live('click', function () {
$(this).parent('tr').next('.detail-view').toggle();
});
function grid_onError(e) {
//Suppress the alert
e.preventDefault();
}

@ -143,9 +143,4 @@ function saveEpisodeIgnore(episodeId, ignored) {
alert("Sorry! We could save the ignore settings for Episode: " + episodeId + " at this time. " + error);
}
});
}
/* Click on row, show details */
$('.seriesTable tr td:not(:last-child)').live('click', function () {
$(this).parent('tr').next('.detail-view').toggle();
});
}

@ -157,6 +157,7 @@
}
@section Scripts{
@Html.IncludeScript("NzbDrone/seriesDetails.js")
@Html.IncludeScript("NzbDrone/grid.js")
<script type="text/javascript">
seriesId = @Model.SeriesId;
</script>

@ -1,53 +1,63 @@
@using NzbDrone.Common
@using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models;
@model IEnumerable<NzbDrone.Core.Repository.Series>
@model IEnumerable<NzbDrone.Web.Models.SeriesModel>
@{ViewBag.Title = "NzbDrone";}
@section HeaderContent
{
@Html.IncludeCss("Settings.css")
}
<style>
/* progress bar container */
.progressbar
<style>
.ui-progressbar
{
border: 1px solid #065EFE;
width: 125px;
position:relative;
width: 125px;
height: 20px;
position: relative;
color: black;
background-color: transparent;
border: 1px solid #065EFE;
margin: 2px;
}
/* color bar */
.progressbar div.progress
.progressBarText
{
position: absolute;
width: 0;
height: 100%;
display: block;
width: 100%;
text-align: center;
}
.ui-progressbar-value
{
overflow: hidden;
background-color: #065EFE;
border: 1px solid #065EFE;
}
/* text on bar */
.progressbar div.progress .progressText
.ui-progressbar-value .progressBarText
{
position: absolute;
text-align: center;
position: relative;
font-weight: normal;
color: white;
}
/* text off bar */
.progressbar div.progressText
/* Set the row height so it won't resize when the progress bar is created */
.seriesTable tr
{
position: absolute;
width: 100%;
height: 100%;
text-align: center;
height: 28px;
}
.editButton, .deleteButton
{
width: 18px;
height: 18px;
padding: 3px 1px;
margin: 0px;
vertical-align: middle;
}
.t-grid .t-alt
.editButton:hover, .deleteButton:hover
{
background: #E5ECF9;
background-color: #065EFE;
}
</style>
@section ActionMenu{
@ -56,90 +66,147 @@
<li>@Ajax.ActionLink("Start RSS Sync", "RssSync", "Command", null)</li>
</ul>
}
@{Html.Telerik().Grid<SeriesModel>().Name("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>");
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.NextAiring);
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>");
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);
commands.Delete().ButtonType(GridButtonType.Image);
}).Title("Actions").Width(90);
})
.Editable(editor => editor.Mode(GridEditMode.PopUp))
.DetailView(detailView => detailView.ClientTemplate(
"<b>Airs Day of Week:</b> " + "<#= AirsDayOfWeek #>" +
"<br />" +
"<b>Overview:</b> " +
"<#= Overview #>"
))
.ClientEvents(clientEvents =>
{
clientEvents.OnEdit("grid_edit");
clientEvents.OnSave("grid_save");
clientEvents.OnRowDataBound("grid_rowBound");
if(EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
<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" />
<col style="width:100px" />
</colgroup>
<tr>
<th>Title</th>
<th>Seasons</th>
<th>Quality</th>
<th>Status</th>
<th>Next Airing</th>
<th>Episodes</th>
@*Commands Column*@
<th>
Commands
</th>
</tr>
@foreach (var series in Model)
{
Html.RenderPartial("Series", series);
}
</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 windowElement;
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(
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);
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"))
});
};
})(jQuery);
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: {
"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>
}

@ -0,0 +1,30 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.SeriesModel
<tr class="@Model.SeriesId">
<td>@Html.ActionLink(Model.Title, "Details", "Series", new { seriesId = Model.SeriesId }, null)</td>
<td>@Model.SeasonsCount</td>
<td>@Model.QualityProfileName</td>
<td>@Model.Status</td>
<td>@Model.NextAiring</td>
<td>
@{ double progress = (double)Model.EpisodeFileCount / (double)Model.EpisodeCount * 100; }
<div class='progressBar' rel='@progress.ToString("0")'>
<span class='progressBarText'>@Model.EpisodeFileCount / @Model.EpisodeCount</span>
</div>
</td>
@*Commands Column*@
<td>
<img src="../../Content/Images/Rename.png" class="editButton" value="@Model.SeriesId" rel="@Model.Title" />
<img src="../../Content/Images/Delete.png" class="deleteButton" value="@Model.SeriesId" rel="@Model.Title" />
@*<div class="editButton" value="@Model.SeriesId" rel="@Model.Title">Edit</div>
<div class="deleteButton" value="@Model.SeriesId" rel="@Model.Title">Delete</div>*@
</td>
</tr>
<tr class="detail-view details_@(Model.SeriesId)">
<td colspan="7">
<b>Airs Day of Week:</b> @Model.AirsDayOfWeek <br/>
<b>Overview:</b> @Model.Overview
</td>
</tr>

@ -12,7 +12,8 @@
</style>
<div id="stylized" style="border-color: transparent;">
<div class="settingsForm">
@using (Html.BeginForm("SaveSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditorForm", name = "SeriesEditorForm", @class = "settingsForm" }))
{
@Html.HiddenFor(m => m.SeriesId)
<label class="labelClass">@Html.LabelFor(m => m.Monitored)
<span class="small">@Html.DescriptionFor(m => m.Monitored)</span>
@ -27,12 +28,12 @@
</label>
@Html.DropDownListFor(m => m.QualityProfileId, (SelectList)ViewData["SelectList"], new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.Path)
<span class="small">@Html.DescriptionFor(m => m.Path)</span>
<span class="small">@Html.DescriptionFor(m => m.Path)</span>
</label>
@Html.TextBoxFor(m => m.Path, new { @class = "inputClass" })
<label class="labelClass">@Html.LabelFor(m => m.BacklogSetting)
<span class="small">@Html.DescriptionFor(m => m.BacklogSetting)</span>
<span class="small">@Html.DescriptionFor(m => m.BacklogSetting)</span>
</label>
@Html.DropDownListFor(m => m.BacklogSetting, (SelectList)ViewData["BacklogSettingSelectList"], new { @class = "inputClass" })
</div>
}
</div>
Loading…
Cancel
Save