110 lines
5.4 KiB
Plaintext
110 lines
5.4 KiB
Plaintext
@model List<HistoryModel>
|
|
@using NzbDrone.Web.Models
|
|
@using NzbDrone.Web.Helpers
|
|
@{ViewBag.Title = "History";}
|
|
@section ActionMenu{
|
|
<ul class="sub-menu">
|
|
<li>@Ajax.ActionLink("Trim History", "Trim", "History", new AjaxOptions { OnSuccess = "reloadHistoryGrid" })</li>
|
|
<li>@Ajax.ActionLink("Purge History", "Purge", "History", new AjaxOptions { OnSuccess = "reloadHistoryGrid" })</li>
|
|
</ul>
|
|
}
|
|
@section HeaderContent
|
|
{
|
|
@Html.IncludeCss("Grid.css")
|
|
|
|
<style>
|
|
.blacklist
|
|
{
|
|
width: 18px;
|
|
height: 18px;
|
|
padding: 1px;
|
|
margin: 2px;
|
|
}
|
|
|
|
.blacklist:hover
|
|
{
|
|
}
|
|
</style>
|
|
}
|
|
<div class="grid-container">
|
|
@{Html.Telerik().Grid<HistoryModel>().Name("history")
|
|
.TableHtmlAttributes(new { @class = "Grid" })
|
|
.Columns(columns =>
|
|
{
|
|
columns.Bound(c => c.Indexer)
|
|
.ClientTemplate("<center><img alt='<#= Indexer #>' src='" + Url.Content("~/Content/Images/Indexers/") + "<#= Indexer #>.png' /></center>")
|
|
.Title("")
|
|
.Width(20);
|
|
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(50);
|
|
columns.Bound(c => c.EpisodeNumber).Title("Episode #").Width(50);
|
|
columns.Bound(c => c.EpisodeTitle).Title("Episode Title");
|
|
columns.Bound(c => c.Quality).Title("Quality").Width(50);
|
|
columns.Bound(c => c.Date).Title("Grabbed on");
|
|
columns.Bound(c => c.HistoryId)
|
|
.Title("Actions")
|
|
.ClientTemplate("<img src='../../Content/Images/blacklist_<#= Blacklisted #>.png' class='blacklist blacklist_<#= Blacklisted #>' id='<#= HistoryId #>' title='Click to toggle blacklisting status' />" +
|
|
Ajax.ImageActionLink("../../Content/Images/X.png", new { Alt = "Delete", Title = "Delete from history", @class = "searchImage" }, "Delete", "History", new { HistoryId = "<#= HistoryId #>" }, new AjaxOptions { OnSuccess = "reloadHistoryGrid" }, null).ToString() +
|
|
Ajax.ImageActionLink("../../Content/Images/Downloading.png", new { Alt = "Redownload", Title = "Redownlod Episode", @class = "searchImage" }, "Redownload", "History", new { HistoryId = "<#= HistoryId #>", EpisodeId = "<#= EpisodeId #>" }, new AjaxOptions { OnSuccess = "reloadHistoryGrid" }, null).ToString())
|
|
.Width("40");
|
|
})
|
|
.DetailView(detailView => detailView.ClientTemplate(
|
|
"<fieldset>" +
|
|
"<div><b>Overview: </b><#= EpisodeOverview #></div>" +
|
|
"<div><b>NZB Title: </b><#= NzbTitle #></div>" +
|
|
"<div><b>Proper: </b><#= IsProper #></div>" +
|
|
"</fieldset>"
|
|
))
|
|
.DataBinding(data => data.Ajax().Select("_AjaxBinding", "History"))
|
|
.Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.Date).Descending()).Enabled(true))
|
|
.Pageable(
|
|
c =>
|
|
c.PageSize(20).Position(GridPagerPosition.Bottom).Style(GridPagerStyles.NextPrevious))
|
|
.Render();}
|
|
</div>
|
|
<script type="text/javascript">
|
|
deleteHistoryRowUrl = '../History/Delete';
|
|
redownloadUrl = '../History/Redownload';
|
|
var toggleBlacklistUrl = '../History/ToggleBlacklist';
|
|
var blacklistedTrueImage = '../../Content/Images/blacklist_true.png';
|
|
var blacklistedFalseImage = '../../Content/Images/blacklist_false.png';
|
|
|
|
function reloadHistoryGrid() {
|
|
var grid = $('#history').data('tGrid');
|
|
grid.ajaxRequest();
|
|
}
|
|
|
|
$(".blacklist").live("click", function () {
|
|
var toggle = $(this);
|
|
var result = toggle.hasClass('blacklist_true');
|
|
var id = toggle.attr('id');
|
|
|
|
toggle.toggleClass('blacklist_true blacklist_false');
|
|
|
|
if (result) {
|
|
toggle.attr('src', blacklistedFalseImage);
|
|
toggleBlacklist(id, false);
|
|
}
|
|
|
|
else {
|
|
toggle.attr('src', blacklistedTrueImage);
|
|
toggleBlacklist(id, true);
|
|
}
|
|
});
|
|
|
|
function toggleBlacklist(historyId, toggle) {
|
|
$.ajax({
|
|
type: "POST",
|
|
url: toggleBlacklistUrl,
|
|
data: jQuery.param({ historyId: historyId, toggle: toggle }),
|
|
error: function (req, status, error) {
|
|
alert("Sorry! We could not toggle blacklist for History: " + historyId + " " + error);
|
|
}
|
|
});
|
|
}
|
|
</script>
|