1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Fixed: Missing grid failing when too many episodes were missing.

This commit is contained in:
Mark McDowall 2012-05-10 09:53:37 -07:00
parent ffdc0f22fb
commit 74e78434b3
2 changed files with 54 additions and 89 deletions

View File

@ -37,9 +37,9 @@ public ActionResult Index()
AirDateString = e.AirDate.Value.ToBestDateString() AirDateString = e.AirDate.Value.ToBestDateString()
}); });
var serialized = new JavaScriptSerializer().Serialize(missing); //var serialized = new JavaScriptSerializer().Serialize(missing);
return View((object)serialized); return View(missing);
} }
} }
} }

View File

@ -1,5 +1,7 @@
@model String @model IEnumerable<NzbDrone.Web.Models.MissingEpisodeModel>
@using DataTables.Mvc.Core
@using NzbDrone.Web.Helpers @using NzbDrone.Web.Helpers
@using SortDirection = DataTables.Mvc.Core.Enum.SortDirection
@{ViewBag.Title = "Missing";} @{ViewBag.Title = "Missing";}
@section ActionMenu{ @section ActionMenu{
@ -9,61 +11,31 @@
<li>@Ajax.ActionLink("Start Recent Backlog Search", "RecentBacklogSearch", "Command", null, null, new { title = "Search and download missing episodes that aired in the last 30 days" })</li> <li>@Ajax.ActionLink("Start Recent Backlog Search", "RecentBacklogSearch", "Command", null, null, new { title = "Search and download missing episodes that aired in the last 30 days" })</li>
</ul> </ul>
} }
<div class="grid-container">
<table id="missingGrid" class="dataTablesGrid hidden-grid">
<thead>
<tr>
<th>
Series Title
</th>
<th>
Episode
</th>
<th>
Episode Title
</th>
<th>
AirDate
</th>
@*Commands Column*@
<th/>
@Html.GridHtml("missingGrid", "dataTablesGrid")
@*Details Column*@
<th style="display: none;">
Details
</th>
</tr>
</thead>
<tbody>
@*@foreach(var history in Model)
{
Html.RenderPartial("History", history);
}*@
</tbody>
</table>
</div>
@section Scripts @section Scripts
{ {
<script type="text/javascript"> @( Html.GridScriptForModel("#missingGrid")
$(document).ready(function() { .Paginate(true)
$('#missingGrid').removeClass('hidden-grid'); .PageLength(20)
.ChangePageLength(false)
.Filter(true)
.Sort(true)
.PaginationType("four_button")
.AddColumn(new Column().DataProperty("return seriesTitle(source, type, val);", true).Title("Series Title"))
.AddColumn(new Column().DataProperty("EpisodeNumbering").Width("80px").Sortable(false).Title("Episode"))
.AddColumn(new Column().DataProperty("EpisodeTitle").Sortable(false).Title("Episode Title"))
.AddColumn(new Column().DataProperty("return airDate(source, type, val);", true).Width("150px").Title("Air Date"))
.AddColumn(new Column().DataProperty("EpisodeId").Width("40px").Sortable(false).RenderFunction("return actions(row);"))
.AddColumn(new Column().DataProperty("Details").Sortable(false).Visible(false).RenderFunction("return details(row);"))
.AddSorting(3, SortDirection.Desc)
)
oTable = $('.dataTablesGrid').dataTable({ <script type="text/javascript">
//"sAjaxSource": "History/AjaxBinding",
//"bProcessing": true,
"bShowAll": false, function seriesTitle (source, type, val) {
"aaData": @Html.Raw(Model),
"bPaginate": true,
"bLengthChange": false,
"bFilter": true,
"bSort": true,
"bInfo": true,
"bAutoWidth": false,
"iDisplayLength": 20,
"sPaginationType": "four_button",
"aoColumns": [
{ sWidth: 'auto', "mDataProp": function (source, type, val) {
// 'display' and 'filter' use our fancy naming // 'display' and 'filter' use our fancy naming
if (type === 'display' || type === 'filter') { if (type === 'display' || type === 'filter') {
return "<a href='/Series/Details?seriesId=" + source["SeriesId"] + "'>" + source["SeriesTitle"] + "</a>"; return "<a href='/Series/Details?seriesId=" + source["SeriesId"] + "'>" + source["SeriesTitle"] + "</a>";
@ -71,10 +43,8 @@
// 'sort' and 'type' both just use the raw data // 'sort' and 'type' both just use the raw data
return source["SeriesTitleSorter"]; return source["SeriesTitleSorter"];
} }
}, //Series Title
{ sWidth: '80px', "mDataProp": "EpisodeNumbering", "bSortable": false }, //EpisodeNumbering function airDate (source, type, val) {
{ sWidth: 'auto', "mDataProp": "EpisodeTitle", "bSortable": false }, //Episode Title
{ sWidth: '150px', "mDataProp": function (source, type, val) {
// 'display' and 'filter' use our fancy naming // 'display' and 'filter' use our fancy naming
if (type === 'display' || type === 'filter') { if (type === 'display' || type === 'filter') {
return source["AirDateString"]; return source["AirDateString"];
@ -82,21 +52,16 @@
// 'sort' and 'type' both just use the raw data // 'sort' and 'type' both just use the raw data
return source["AirDate"]; return source["AirDate"];
} }
}, //Grabbed On
{ sWidth: '40px', "mDataProp": "EpisodeId", "bSortable": false, "fnRender": function (row) { function actions (row) {
var link = '@Ajax.ImageActionLink("../../Content/Images/Search.png", new { title = "Search for Episode", alt = "Search", @class = "gridAction" }, "Search", "Episode", new { episodeId = "REPLACE" }, null, null)'; var link = '@Ajax.ImageActionLink("../../Content/Images/Search.png", new { title = "Search for Episode", alt = "Search", @class = "gridAction" }, "Search", "Episode", new { episodeId = "REPLACE" }, null, null)';
link = link.replace("REPLACE", row.aData["EpisodeId"]); link = link.replace("REPLACE", row.aData["EpisodeId"]);
return link; return link;
} }
}, //Actions
{ sWidth: 'auto', "mDataProp": "Details", "bSortable": false, "bVisible": false, "fnRender": function (row) { function details (row) {
var result = "<b>Overview: </b>" + row.aData["Overview"] + "<br/>"; var result = "<b>Overview: </b>" + row.aData["Overview"] + "<br/>";
return result; return result;
} }
} //Details
],
"aaSorting": [[3, 'desc']]
});
});
</script> </script>
} }