Removed some extraneous code.

Missing grid is now a Datatable grid.
pull/6/head
Mark McDowall 13 years ago
parent b82c63e2ec
commit ca5888160d

@ -1,14 +0,0 @@
using System.Web.Mvc;
using System.Web.WebPages;
//using RazorGenerator.Mvc;
[assembly: WebActivator.PreApplicationStartMethod(typeof(NzbDrone.Web.App_Start.RegisterDatatablesModelBinder), "Start")]
namespace NzbDrone.Web.App_Start {
public static class RegisterDatatablesModelBinder {
public static void Start() {
if (!ModelBinders.Binders.ContainsKey(typeof(Mvc.JQuery.Datatables.DataTablesParam)))
ModelBinders.Binders.Add(typeof(Mvc.JQuery.Datatables.DataTablesParam), new Mvc.JQuery.Datatables.DataTablesModelBinder());
}
}
}

@ -1,7 +1,6 @@
using System.Linq;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using Mvc.JQuery.Datatables;
using NzbDrone.Core.Jobs;
using NzbDrone.Core.Providers;
using NzbDrone.Web.Models;

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using NzbDrone.Core;
using NzbDrone.Core.Providers;
using NzbDrone.Web.Models;
@ -21,7 +22,23 @@ namespace NzbDrone.Web.Controllers
public ActionResult Index()
{
return View();
var missingEpisodes = _episodeProvider.EpisodesWithoutFiles(false);
var missing = missingEpisodes.Select(e => new MissingEpisodeModel
{
EpisodeId = e.EpisodeId,
SeriesId = e.SeriesId,
EpisodeNumbering = string.Format("{0}x{1:00}", e.SeasonNumber, e.EpisodeNumber),
EpisodeTitle = e.Title,
Overview = e.Overview,
SeriesTitle = e.Series.Title,
AirDate = e.AirDate.Value.ToString(),
AirDateString = e.AirDate.Value.ToBestDateString()
});
var serialized = new JavaScriptSerializer().Serialize(missing);
return View((object)serialized);
}
[GridAction]
@ -33,12 +50,11 @@ namespace NzbDrone.Web.Controllers
{
EpisodeId = e.EpisodeId,
SeriesId = e.SeriesId,
SeasonNumber = e.SeasonNumber,
EpisodeNumber = e.EpisodeNumber,
EpisodeNumbering = string.Format("{0}x{1:00}", e.SeasonNumber, e.EpisodeNumber),
EpisodeTitle = e.Title,
Overview = e.Overview,
SeriesTitle = e.Series.Title,
AirDate = e.AirDate.Value,
AirDate = e.AirDate.Value.ToString(),
AirDateString = e.AirDate.Value.ToBestDateString()
});

@ -9,11 +9,11 @@ namespace NzbDrone.Web.Models
public int SeriesId { get; set; }
public int EpisodeId { get; set; }
public string SeriesTitle { get; set; }
public int SeasonNumber { get; set; }
public int EpisodeNumber { get; set; }
public string EpisodeNumbering { get; set; }
public string EpisodeTitle { get; set; }
public DateTime AirDate { get; set; }
public string AirDate { get; set; }
public string AirDateString { get; set; }
public string Overview { get; set; }
public string Details { get; set; }
}
}

@ -53,9 +53,6 @@
<Private>True</Private>
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
<Reference Include="Mvc.JQuery.Datatables">
<HintPath>..\packages\Mvc.JQuery.Datatables.1.1.47\lib\net40\Mvc.JQuery.Datatables.dll</HintPath>
</Reference>
<Reference Include="MvcMiniProfiler, Version=1.9.0.0, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
<HintPath>..\packages\MiniProfiler.1.9\lib\net40\MvcMiniProfiler.dll</HintPath>
</Reference>
@ -273,7 +270,6 @@
<Compile Include="App_Start\EntityFramework.SqlServerCompact.cs" />
<Compile Include="App_Start\Logging.cs" />
<Compile Include="App_Start\MiniProfiler.cs" />
<Compile Include="App_Start\RegisterDatatablesModelBinder.cs" />
<Compile Include="Filters\JsonErrorFilter.cs" />
<Compile Include="Controllers\CommandController.cs" />
<Compile Include="Controllers\DirectoryController.cs" />
@ -301,7 +297,6 @@
<Compile Include="Helpers\DescriptionExtension.cs" />
<Compile Include="Helpers\HtmlPrefixScopeExtensions.cs" />
<Compile Include="Helpers\IsCurrentActionHelper.cs" />
<Compile Include="Models\HistoryGridModel.cs" />
<Compile Include="Models\UpcomingEpisodesModel.cs" />
<Compile Include="Models\SeasonModel.cs" />
<Compile Include="Models\SeriesDetailsModel.cs" />
@ -489,7 +484,6 @@
<Content Include="Scripts\jquery-1.7.1-vsdoc.js" />
<Content Include="Scripts\jquery-1.7.1.js" />
<Content Include="Scripts\jquery-1.7.1.min.js" />
<Content Include="Scripts\jquery.dataTables.columnFilter.js" />
<Content Include="Scripts\jquery.hotkeys.js" />
<Content Include="Scripts\jquery.livequery.js" />
<Content Include="Scripts\jquery.validate-vsdoc.js" />
@ -686,7 +680,6 @@
<None Include="Scripts\DataTables-1.9.0\extras\FixedColumns\media\js\FixedColumns.min.js.gz" />
<None Include="Scripts\DataTables-1.9.0\extras\Scroller\media\js\Scroller.min.js.gz" />
<None Include="Scripts\DataTables-1.9.0\extras\TableTools\media\js\TableTools.min.js.gz" />
<Content Include="Views\Shared\DataTable.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

@ -15,30 +15,30 @@
}
<div class="grid-container">
<table id="historyGrid" class="hidden-grid">
<thead>
<tr>
<th></th>
<th>Series Title</th>
<th>Episode</th>
<th>Episode Title</th>
<th>Quality</th>
<th>Grabbed On</th>
<table id="historyGrid" class="hidden-grid">
<thead>
<tr>
<th></th>
<th>Series Title</th>
<th>Episode</th>
<th>Episode Title</th>
<th>Quality</th>
<th>Grabbed On</th>
@*Commands Column*@
<th>Actions</th>
@*Commands Column*@
<th>Actions</th>
@*Details Column*@
<th style="display: none;">Details</th>
</tr>
</thead>
<tbody>
@*@foreach(var history in Model)
{
Html.RenderPartial("History", history);
}*@
</tbody>
</table>
@*Details Column*@
<th style="display: none;">Details</th>
</tr>
</thead>
<tbody>
@*@foreach(var history in Model)
{
Html.RenderPartial("History", history);
}*@
</tbody>
</table>
</div>
<script type="text/javascript">

@ -1,4 +1,4 @@
@model List<MissingEpisodeModel>
@model String
@using NzbDrone.Common
@using NzbDrone.Web.Helpers
@using NzbDrone.Web.Models;
@ -14,44 +14,73 @@
<li>@Ajax.ActionLink("Start Recent Backlog Search", "RecentBacklogSearch", "Command", null, null, new { title = "Backlog search for missing episodes that aired in the last 30 days only" })</li>
</ul>
}
@{Html.Telerik().Grid<MissingEpisodeModel>().Name("missing")
.TableHtmlAttributes(new { @class = "Grid" })
.Columns(columns =>
{
columns.Bound(c => c.SeriesTitle)
.ClientTemplate("<a href=" +
Url.Action("Details", "Series", new { seriesId = "<#= SeriesId #>" }) +
"><#= SeriesTitle #></a>")
.Title("Series Title");
columns.Bound(c => c.SeasonNumber).Title("Season #").Width(85);
columns.Bound(c => c.EpisodeNumber).Title("Episode #").Width(85);
columns.Bound(c => c.EpisodeTitle).Title("Episode Title");
columns.Bound(c => c.AirDate)
.ClientTemplate("<#= AirDateString #>")
.Title("Air Date")
.Width(90);
columns.Bound(c => c.EpisodeId)
.Title("Actions")
.ClientTemplate(Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for episode", @class = "searchImage" }, "Search", "Episode", new { EpisodeId = "<#= EpisodeId #>" }, null, null).ToString())
.Width("40");
})
.DetailView(detailView => detailView.ClientTemplate(
"<fieldset>" +
"<div><b>Overview: </b><#= Overview #></div>" +
"</fieldset>"
))
.DataBinding(data => data.Ajax().Select("_AjaxBinding", "Missing"))
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.AirDate).Descending()).Enabled(true))
.Filterable(filtering => filtering
.Filters(filters => filters
.Add(o => o.SeasonNumber).IsGreaterThan(0)))
.Pageable(
c =>
c.PageSize(20).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious))
.ClientEvents(clientEvents =>
<div class="grid-container">
<table id="historyGrid" class="hidden-grid">
<thead>
<tr>
<th>Series Title</th>
<th>Episode</th>
<th>Episode Title</th>
<th>AirDate</th>
@*Commands Column*@
<th>Actions</th>
@*Details Column*@
<th style="display: none;">Details</th>
</tr>
</thead>
<tbody>
@*@foreach(var history in Model)
{
if (EnviromentProvider.IsProduction)
clientEvents.OnError("grid_onError");
})
.Render();}
Html.RenderPartial("History", history);
}*@
</tbody>
</table>
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#historyGrid').removeClass('hidden-grid');
oTable = $('#historyGrid').dataTable({
//"sAjaxSource": "History/AjaxBinding",
//"bProcessing": true,
"bShowAll": false,
"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": "SeriesTitle" }, //Series Title
{ sWidth: '80px', "mDataProp": "EpisodeNumbering", "bSortable": false }, //EpisodeNumbering
{ sWidth: 'auto', "mDataProp": "EpisodeTitle", "bSortable": false }, //Episode Title
{ sWidth: '150px', "mDataProp": function (source, type, val) {
// 'display' and 'filter' use our fancy naming
if (type === 'display' || type === 'filter') {
return source["AirDateString"];
}
// 'sort' and 'type' both just use the raw data
return source["AirDate"];
}
}, //Grabbed On
{ sWidth: '40px', "mDataProp": "EpisodeId", "bSortable": false, "fnRender": function (row) {
return createImageAjaxLink('/Episode/Search?episodeId=' + row.aData["EpisodeId"], '../../Content/Images/Search.png', 'Search', 'Search for Episode', 'searchImage');
}
}, //Actions
{ sWidth: 'auto', "mDataProp": "Details", "bSortable": false, "bVisible": false, "fnRender": function (row) {
var result = "<b>Overview: </b>" + row.aData["Overview"] + "<br/>";
return result;
}
} //Details
],
"aaSorting": [[3, 'desc']]
});
});
</script>
Loading…
Cancel
Save