From af328c9e55eb6e099acc656eb011ad6275ac245c Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 15 Dec 2011 00:47:32 -0800 Subject: [PATCH] History, Series/Details and Missing use ImageLink when possible for actions. --- .../Indexers/{Nzbsorg.png => Nzbs.org.png} | Bin NzbDrone.Web/NzbDrone.Web.csproj | 3 +- NzbDrone.Web/Scripts/NzbDrone/LocalSearch.js | 41 ------------------ .../Scripts/NzbDrone/seriesDetails.js | 38 ---------------- NzbDrone.Web/Views/History/Index.cshtml | 26 +---------- NzbDrone.Web/Views/Missing/Index.cshtml | 2 +- NzbDrone.Web/Views/Series/Details.cshtml | 10 ++--- .../Views/Shared/_ReferenceLayout.cshtml | 1 - 8 files changed, 9 insertions(+), 112 deletions(-) rename NzbDrone.Web/Content/Images/Indexers/{Nzbsorg.png => Nzbs.org.png} (100%) delete mode 100644 NzbDrone.Web/Scripts/NzbDrone/LocalSearch.js diff --git a/NzbDrone.Web/Content/Images/Indexers/Nzbsorg.png b/NzbDrone.Web/Content/Images/Indexers/Nzbs.org.png similarity index 100% rename from NzbDrone.Web/Content/Images/Indexers/Nzbsorg.png rename to NzbDrone.Web/Content/Images/Indexers/Nzbs.org.png diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 28c065394..93d313e5e 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -146,7 +146,7 @@ - + @@ -385,7 +385,6 @@ - diff --git a/NzbDrone.Web/Scripts/NzbDrone/LocalSearch.js b/NzbDrone.Web/Scripts/NzbDrone/LocalSearch.js deleted file mode 100644 index 7fe27afbd..000000000 --- a/NzbDrone.Web/Scripts/NzbDrone/LocalSearch.js +++ /dev/null @@ -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 $("
  • ") - .data("item.autocomplete", item) - .append("" + item.Title + "
    " + "
    ") - .appendTo(ul); - }; - }); -}); \ No newline at end of file diff --git a/NzbDrone.Web/Scripts/NzbDrone/seriesDetails.js b/NzbDrone.Web/Scripts/NzbDrone/seriesDetails.js index c8320d783..7daf4619a 100644 --- a/NzbDrone.Web/Scripts/NzbDrone/seriesDetails.js +++ b/NzbDrone.Web/Scripts/NzbDrone/seriesDetails.js @@ -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 diff --git a/NzbDrone.Web/Views/History/Index.cshtml b/NzbDrone.Web/Views/History/Index.cshtml index 2ffd88e02..497acf2de 100644 --- a/NzbDrone.Web/Views/History/Index.cshtml +++ b/NzbDrone.Web/Views/History/Index.cshtml @@ -33,8 +33,8 @@ columns.Bound(c => c.Date).Title("Grabbed on"); columns.Bound(c => c.HistoryId) .Title("Actions") - .ClientTemplate("\" onclick=\"deleteHistoryRow(<#= HistoryId #>); return false;\">Delete" + - "&episodeId=<#= EpisodeId #>\" onclick=\"redownload(<#= HistoryId #>, <#= EpisodeId #>); return false;\">Redownload") + .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(); - } - }); - } diff --git a/NzbDrone.Web/Views/Missing/Index.cshtml b/NzbDrone.Web/Views/Missing/Index.cshtml index 32baec4ce..a0bf3ce6e 100644 --- a/NzbDrone.Web/Views/Missing/Index.cshtml +++ b/NzbDrone.Web/Views/Missing/Index.cshtml @@ -30,7 +30,7 @@ .Width(90); columns.Bound(c => c.EpisodeId) .Title("Actions") - .ClientTemplate("\" onClick=\"searchForEpisode(<#= EpisodeId #>); return false;\">Search") + .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( diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index db0687ffd..a67bb04f0 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -110,12 +110,12 @@ columns.Bound(c => c.Status).Sortable(false) .Title("" + "Status" + - "Search" + - "Rename") - .ClientTemplate("" + + 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("" + "<#= Status #>" + - "\" onclick=\"searchForEpisode('<#= EpisodeId #>'); return false;\">Search" + - "\" onclick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\">Rename") + 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("
    <#= Overview #>
    <#= Path #>
    ")) diff --git a/NzbDrone.Web/Views/Shared/_ReferenceLayout.cshtml b/NzbDrone.Web/Views/Shared/_ReferenceLayout.cshtml index 4be3281dc..19b97062a 100644 --- a/NzbDrone.Web/Views/Shared/_ReferenceLayout.cshtml +++ b/NzbDrone.Web/Views/Shared/_ReferenceLayout.cshtml @@ -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)