History, Series/Details and Missing use ImageLink when possible for actions.

This commit is contained in:
Mark McDowall 2011-12-15 00:47:32 -08:00
parent 9264dcdf88
commit af328c9e55
8 changed files with 9 additions and 112 deletions

View File

Before

Width:  |  Height:  |  Size: 198 B

After

Width:  |  Height:  |  Size: 198 B

View File

@ -146,7 +146,7 @@
<Content Include="Content\Images\green.png" />
<Content Include="Content\Images\header.jpg" />
<Content Include="Content\Images\Indexers\Newznab.png" />
<Content Include="Content\Images\Indexers\Nzbsorg.png" />
<Content Include="Content\Images\Indexers\Nzbs.org.png" />
<Content Include="Content\Images\red.png" />
<Content Include="Content\Images\yellow.png" />
<Content Include="Content\IndexerSettings.css" />
@ -385,7 +385,6 @@
<Content Include="Scripts\NzbDrone\addSeries.js" />
<Content Include="Scripts\NzbDrone\AutoComplete.js" />
<Content Include="Scripts\NzbDrone\episodeSearch.js" />
<Content Include="Scripts\NzbDrone\LocalSearch.js" />
<Content Include="Scripts\NzbDrone\Notification.js" />
<Content Include="Scripts\NzbDrone\seriesDetails.js" />
<Content Include="Scripts\NzbDrone\AutoBind.js" />

View File

@ -1,41 +0,0 @@
jQuery(document).ready(function () {
$.ajaxSetup({
cache: false
});
var selector = '#localSeriesLookup';
$(document).bind('keydown', 'ctrl+shift+f', function () {
$(selector).focus();
});
$(document).bind('keyup', 's', function () {
$(selector).focus();
});
$(selector).each(function (index, element) {
$(element).blur(function () {
$(element).val("");
});
$(element).watermark('Search...');
$(element).autocomplete({
source: "/Series/LocalSearch",
minLength: 1,
delay: 200,
autoFocus: true,
select: function (event, ui) {
window.location = "../Series/Details?seriesId=" + ui.item.Id;
}
})
.data("autocomplete")._renderItem = function (ul, item) {
return $("<li></li>")
.data("item.autocomplete", item)
.append("<a>" + item.Title + "<br>" + "</a>")
.appendTo(ul);
};
});
});

View File

@ -7,9 +7,6 @@ var downloadingImage = '../../Content/Images/Downloading.png';
var seriesId = 0;
var saveSeasonIgnoreUrl = '../Series/SaveSeasonIgnore';
var saveEpisodeIgnoreUrl = '../Series/SaveEpisodeIgnore';
var renameEpisodeUrl = '../Episode/Rename';
var renameSeasonUrl = '../Episode/RenameSeason';
var searchSeasonUrl = '../Episode/SearchSeason';
//Episode Ignore Functions
$(".ignoreEpisode").live("click", function () {
@ -158,41 +155,6 @@ function saveEpisodeIgnore(episodeId, ignored) {
});
}
//Episode Renaming
function renameEpisode(id) {
$.ajax({
type: "POST",
url: renameEpisodeUrl,
data: jQuery.param({ episodeFileId: id }),
error: function (req, status, error) {
alert("Sorry! We could rename " + id + " at this time. " + error);
}
});
}
function renameSeason(seriesId, seasonNumber) {
$.ajax({
type: "POST",
url: renameSeasonUrl,
data: jQuery.param({ seriesId: seriesId, seasonNumber: seasonNumber }),
error: function (req, status, error) {
alert("Sorry! We could rename series: " + seriesId + " season: " + seasonNumber + " at this time. " + error);
}
});
}
//Season Search
function searchSeason(seriesId, seasonNumber) {
$.ajax({
type: "POST",
url: searchSeasonUrl,
data: jQuery.param({ seriesId: seriesId, seasonNumber: seasonNumber }),
error: function (req, status, error) {
alert("Sorry! We could search for series: " + seriesId + " season: " + seasonNumber + " at this time. " + error);
}
});
}
//Set master status to match children
function setMasterStatus(grid) {
//Get children of this grid

View File

@ -33,8 +33,8 @@
columns.Bound(c => c.Date).Title("Grabbed on");
columns.Bound(c => c.HistoryId)
.Title("Actions")
.ClientTemplate("<a href=\"../History/Delete?historyId=<#= HistoryId #>\" onclick=\"deleteHistoryRow(<#= HistoryId #>); return false;\"><img src='../../Content/Images/X.png' alt='Delete' title='Delete from History' class='searchImage' /></a>" +
"<a href=\"../History/Redownload?historyId=<#= HistoryId #>&episodeId=<#= EpisodeId #>\" onclick=\"redownload(<#= HistoryId #>, <#= EpisodeId #>); return false;\"><img src='../../Content/Images/Downloading.png' alt='Redownload' title='Redownload Episode' class='searchImage' /></a>")
.ClientTemplate(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(
@ -59,26 +59,4 @@
var grid = $('#history').data('tGrid');
grid.ajaxRequest();
}
function deleteHistoryRow(historyId) {
$.ajax({
type: "POST",
url: deleteHistoryRowUrl,
data: jQuery.param({ historyId: historyId }),
success: function () {
reloadHistoryGrid();
}
});
}
function redownload(historyId, episodeId) {
$.ajax({
type: "POST",
url: redownloadUrl,
data: jQuery.param({ historyId: historyId, episodeId: episodeId }),
success: function () {
reloadHistoryGrid();
}
});
}
</script>

View File

@ -30,7 +30,7 @@
.Width(90);
columns.Bound(c => c.EpisodeId)
.Title("Actions")
.ClientTemplate("<a href=\"../Episode/Season?episodeId=<#= EpisodeId #>\" onClick=\"searchForEpisode(<#= EpisodeId #>); return false;\"><img src='../../Content/Images/Search.png' alt='Search' title='Search for Episode' class='searchImage' /></a>")
.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(

View File

@ -110,12 +110,12 @@
columns.Bound(c => c.Status).Sortable(false)
.Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_" + season + "' title='Click to toggle season ignore status' />" +
"<img src='../../Content/Images/Missing.png' alt='Status' title='Season Status' class='statusImage statusImageMaster' />" +
"<a href=\"../Episode/SearchSeason?seriesId=" + @seriesId + "&seasonNumber=" + @season + "\" onclick=\"searchSeason(" + @seriesId + ", " + @season + "); return false;\"><img src='../../Content/Images/Search.png' alt='Search' title='Search for all episodes in this season' class='searchImage searchImageMaster' /></a>" +
"<a href=\"../Episode/RenameSeason?seriesId=" + @seriesId + "&seasonNumber=" + @season + "\" onclick=\"renameSeason(" + @seriesId + ", " + @season + "); return false;\"><img src='../../Content/Images/Rename.png' alt='Rename' title='Rename all episodes in this season' class=renameImage renameImageMaster' /></a>")
.ClientTemplate("<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' title='Click to toggle episode ignore status' />" +
Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for all episodes in this season", @class = "searchImage searchImageMaster" }, "SearchSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null) +
Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename all episodes in this season", @class = "renameImage renameImageMaster" }, "RenameSeason", "Episode", new { SeriesId = seriesId, SeasonNumber = season }, null, null))
.ClientTemplate("<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' title='Click to toggle episode ignore status' />" +
"<img src='../../Content/Images/<#= Status #>.png' alt='<#= Status #>' title='<#= Status #>' class='statusImage status-<#= Status #>' />" +
"<a href=\"../Episode/Season?episodeId=<#= EpisodeId #>\" onclick=\"searchForEpisode('<#= EpisodeId #>'); return false;\"><img src='../../Content/Images/Search.png' alt='Search' title='Search for episode' class='searchImage' /></a>" +
"<a href=\"../Episode/Rename?episodeFileId=<#= EpisodeId #>\" onclick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\"><img src='../../Content/Images/Rename.png' alt='Rename' title='Rename episode' class='renameImage' />")
Ajax.ImageActionLink("../../Content/Images/Search.png", new { Alt = "Search", Title = "Search for episode", @class = "searchImage" }, "Search", "Episode", new { EpisodeId = "<#= EpisodeId #>" }, null, null) +
Ajax.ImageActionLink("../../Content/Images/Rename.png", new { Alt = "Rename", Title = "Rename episode", @class = "renameImage" }, "Rename", "Episode", new { EpisodeId = "<#= EpisodeId #>" }, null, null))
.Width(80);
})
.DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>"))

View File

@ -32,7 +32,6 @@
@Html.IncludeScript("doTimeout.js")
@Html.IncludeScript("NzbDrone/episodeSearch.js")
@Html.IncludeScript("NzbDrone/AutoComplete.js")
@Html.IncludeScript("NzbDrone/LocalSearch.js")
@Html.IncludeScript("NzbDrone/Notification.js")
@Html.IncludeScript("NzbDrone/AutoBind.js")
@RenderSection("Scripts", required: false)