From 127af22fe99c514f6a723392057b3cc368155f95 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 5 Aug 2011 20:05:41 -0700 Subject: [PATCH 1/4] Fixed settings saving notifications, duplicate keys. --- .../Controllers/SettingsController.cs | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index f263828bf..4e05898ef 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -32,7 +32,6 @@ namespace NzbDrone.Web.Controllers private readonly DiskProvider _diskProvider; private readonly SeriesProvider _seriesProvider; private readonly ExternalNotificationProvider _externalNotificationProvider; - private readonly ProgressNotification _progressNotification; public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider, QualityProvider qualityProvider, RootDirProvider rootDirProvider, @@ -49,8 +48,6 @@ namespace NzbDrone.Web.Controllers _notificationProvider = notificationProvider; _diskProvider = diskProvider; _seriesProvider = seriesProvider; - - _progressNotification = new ProgressNotification("Settings"); } public ActionResult Test() @@ -273,7 +270,8 @@ namespace NzbDrone.Web.Controllers [HttpPost] public ActionResult SaveIndexers(IndexerSettingsModel data) { - _notificationProvider.Register(_progressNotification); + var progressNotification = new ProgressNotification("Settings"); + _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { @@ -305,20 +303,21 @@ namespace NzbDrone.Web.Controllers _configProvider.NewzbinUsername = data.NewzbinUsername; _configProvider.NewzbinPassword = data.NewzbinPassword; - _progressNotification.CurrentMessage = SETTINGS_SAVED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_SAVED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_SAVED); } - _progressNotification.CurrentMessage = SETTINGS_FAILED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_FAILED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_FAILED); } [HttpPost] public ActionResult SaveSabnzbd(SabnzbdSettingsModel data) { - _notificationProvider.Register(_progressNotification); + var progressNotification = new ProgressNotification("Settings"); + _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { @@ -331,20 +330,21 @@ namespace NzbDrone.Web.Controllers _configProvider.SabTvPriority = data.SabTvPriority; _configProvider.SabDropDirectory = data.SabDropDirectory; - _progressNotification.CurrentMessage = SETTINGS_SAVED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_SAVED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_SAVED); } - _progressNotification.CurrentMessage = SETTINGS_FAILED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_FAILED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_FAILED); } [HttpPost] public ActionResult SaveQuality(QualityModel data) { - _notificationProvider.Register(_progressNotification); + var progressNotification = new ProgressNotification("Settings"); + _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { @@ -377,20 +377,21 @@ namespace NzbDrone.Web.Controllers _qualityProvider.Update(profile); } - _progressNotification.CurrentMessage = SETTINGS_SAVED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_SAVED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_SAVED); } - _progressNotification.CurrentMessage = SETTINGS_FAILED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_FAILED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_FAILED); } [HttpPost] public ActionResult SaveNotifications(NotificationSettingsModel data) { - _notificationProvider.Register(_progressNotification); + var progressNotification = new ProgressNotification("Settings"); + _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { @@ -407,20 +408,21 @@ namespace NzbDrone.Web.Controllers _configProvider.XbmcUsername = data.XbmcUsername; _configProvider.XbmcPassword = data.XbmcPassword; - _progressNotification.CurrentMessage = SETTINGS_SAVED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_SAVED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_SAVED); } - _progressNotification.CurrentMessage = SETTINGS_FAILED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_FAILED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_FAILED); } [HttpPost] public ActionResult SaveEpisodeSorting(EpisodeSortingModel data) { - _notificationProvider.Register(_progressNotification); + var progressNotification = new ProgressNotification("Settings"); + _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { @@ -434,13 +436,13 @@ namespace NzbDrone.Web.Controllers _configProvider.SortingNumberStyle = data.NumberStyle; _configProvider.SortingMultiEpisodeStyle = data.MultiEpisodeStyle; - _progressNotification.CurrentMessage = SETTINGS_SAVED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_SAVED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_SAVED); } - _progressNotification.CurrentMessage = SETTINGS_FAILED; - _progressNotification.Status = ProgressNotificationStatus.Completed; + progressNotification.CurrentMessage = SETTINGS_FAILED; + progressNotification.Status = ProgressNotificationStatus.Completed; return Content(SETTINGS_FAILED); } } From f1f85a0eca886b051557674421fc5bec11b22aa0 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 5 Aug 2011 21:51:36 -0700 Subject: [PATCH 2/4] Fixed parsing issue when Episode Title starts with a number. Split out single and multi episode REGEX for standard naming conventions. --- NzbDrone.Core.Test/ParserTest.cs | 3 ++- NzbDrone.Core/Parser.cs | 31 +++++++++++++++++++++++-------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/NzbDrone.Core.Test/ParserTest.cs b/NzbDrone.Core.Test/ParserTest.cs index 12f82054f..6b82f4904 100644 --- a/NzbDrone.Core.Test/ParserTest.cs +++ b/NzbDrone.Core.Test/ParserTest.cs @@ -42,6 +42,7 @@ namespace NzbDrone.Core.Test [TestCase("Hawaii Five-0 (2010) - 1x05 - Nalowale (Forgotten/Missing)", "Hawaii Five-0 (2010)", 1, 5)] [TestCase("Hawaii Five-0 (2010) - 1x05 - Title", "Hawaii Five-0 (2010)", 1, 5)] [TestCase("House - S06E13 - 5 to 9 [DVD]", "House", 6, 13)] + [TestCase("The Mentalist - S02E21 - 18-5-4", "The Mentalist", 2, 21)] public void ParseTitle_single(string postTitle, string title, int seasonNumber, int episodeNumber) { var result = Parser.ParseTitle(postTitle); @@ -132,7 +133,7 @@ namespace NzbDrone.Core.Test [TestCase("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", "Two.and.a.Half.Men", 1, new[] { 3, 4 }, 2)] [TestCase("Weeds.S03E01.S03E02.720p.HDTV.X264-DIMENSION", "Weeds", 3, new[] { 1, 2 }, 2)] [TestCase("The Borgias S01e01 e02 ShoHD On Demand 1080i DD5 1 ALANiS", "The Borgias", 1, new[] { 1, 2 }, 2)] - //[TestCase("Big Time Rush 1x01 to 10 480i DD2 0 Sianto", "Big Time Rush", 1, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 10)] + [TestCase("Big Time Rush 1x01 to 10 480i DD2 0 Sianto", "Big Time Rush", 1, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 10)] [TestCase("White.Collar.2x04.2x05.720p.BluRay-FUTV", "White.Collar", 2, new[] { 4, 5 }, 2)] [TestCase("Desperate.Housewives.S07E22E23.720p.HDTV.X264-DIMENSION", "Desperate.Housewives", 7, new[] { 22, 23 }, 2)] [TestCase("S07E22 - 7x23 - And Lots of Security.. [HDTV].mkv", "", 7, new[] { 22, 23 }, 2)] diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index 21e5f736d..f41f5458c 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text.RegularExpressions; using NLog; using NzbDrone.Core.Model; @@ -19,11 +20,15 @@ namespace NzbDrone.Core RegexOptions.IgnoreCase | RegexOptions.Compiled), //Multi-Part episodes without a title (S01E05.S01E06) - new Regex(@"^(?:\W*S?(?\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s){1,2}(?\d{1,2}(?!\d+)))+){2,}\W?(?!\\)", + new Regex(@"^(?:\W*S?(?\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s){1,2}(?\d{1,2}(?!\d+)))+){2,}\W?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), - //Single episodes or multi-episode (S01E05E06, S01E05-06, etc) - new Regex(@"^(?.+?)(?:\W+S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s){1,2}(?<episode>\d{1,2}(?!\d+)))+)+\W?(?!\\)", + //Multi-episode (S01E05E06, S01E05-06, etc) + new Regex(@"^(?<title>.+?)(?:\W+S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s){1,2}(?<episode>\d{1,2}(?!\d+)))+){2,}\W?(?!\\)", + RegexOptions.IgnoreCase | RegexOptions.Compiled), + + //Single episodes (S01E05, 1x056, etc) + new Regex(@"^(?<title>.+?)(?:\W+S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s){1,2}(?<episode>\d{1,2}(?!\d+)))+)\W?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), //No Title - Single episodes or multi-episode (S01E05E06, S01E05-06, etc) @@ -35,7 +40,7 @@ namespace NzbDrone.Core RegexOptions.IgnoreCase | RegexOptions.Compiled), //Episodes over 99 (3-digits or more) - new Regex(@"^(?<title>.*?)(?:\W?S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|to)+(?<episode>\d+))+)+\W?(?!\\)", + new Regex(@"^(?<title>.*?)(?:\W?S?(?<season>\d{1,2}(?!\d+))(?:(?:\-|\.|[ex]|\s|\sto\s)+(?<episode>\d+))+)+\W?(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled), //Supports Season only releases @@ -87,8 +92,20 @@ namespace NzbDrone.Core if (airyear < 1) { - int season; - Int32.TryParse(match[0].Groups["season"].Value, out season); + var seasons = new List<int>(); + + foreach (Capture seasonCapture in match[0].Groups["season"].Captures) + { + int s; + if (Int32.TryParse(seasonCapture.Value, out s)) + seasons.Add(s); + } + + //If more than 1 season was parsed go to the next REGEX (A multi-season release is unlikely) + if (seasons.Distinct().Count() != 1) + continue; + + var season = seasons[0]; parsedEpisode = new EpisodeParseResult { @@ -303,8 +320,6 @@ namespace NzbDrone.Core return result; } - - public static LanguageType ParseLanguage(string title) { var lowerTitle = title.ToLower(); From bf17b63d2b25620a0a667c9055a7a684cb6036b2 Mon Sep 17 00:00:00 2001 From: Mark McDowall <markus.mcd5@gmail.com> Date: Mon, 8 Aug 2011 16:38:55 -0700 Subject: [PATCH 3/4] Shitty merge, manually fixed it. --- NzbDrone.Web/Controllers/SettingsController.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index 4ba6e5c0d..62fb37225 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -260,7 +260,6 @@ namespace NzbDrone.Web.Controllers [HttpPost] public JsonResult SaveIndexers(IndexerSettingsModel data) { - _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { var nzbsOrgSettings = _indexerProvider.GetSettings(typeof(NzbsOrg)); @@ -300,7 +299,6 @@ namespace NzbDrone.Web.Controllers [HttpPost] public JsonResult SaveSabnzbd(SabnzbdSettingsModel data) { - _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { _configProvider.SabHost = data.SabHost; @@ -325,7 +323,6 @@ namespace NzbDrone.Web.Controllers [HttpPost] public ActionResult SaveQuality(QualityModel data) { - _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { _configProvider.DefaultQualityProfile = data.DefaultQualityProfileId; @@ -366,7 +363,6 @@ namespace NzbDrone.Web.Controllers [HttpPost] public ActionResult SaveNotifications(NotificationSettingsModel data) { - _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { //XBMC Enabled @@ -391,7 +387,6 @@ namespace NzbDrone.Web.Controllers [HttpPost] public ActionResult SaveEpisodeSorting(EpisodeSortingModel data) { - _notificationProvider.Register(progressNotification); if (ModelState.IsValid) { _configProvider.SortingIncludeSeriesName = data.SeriesName; From 56da8302963f95d1fb4514efefcb55c3b860e06a Mon Sep 17 00:00:00 2001 From: Mark McDowall <markus.mcd5@gmail.com> Date: Fri, 19 Aug 2011 20:02:47 -0700 Subject: [PATCH 4/4] Added a second "master" toggle to ignoreSeason on Series/Details at the top of the page. --- NzbDrone.Web/Scripts/seriesDetails.js | 58 +++++----- NzbDrone.Web/Views/Series/Details.cshtml | 130 ++++++++++++++++------- NzbDrone.Web/Views/Settings/Test.cshtml | 10 +- 3 files changed, 136 insertions(+), 62 deletions(-) diff --git a/NzbDrone.Web/Scripts/seriesDetails.js b/NzbDrone.Web/Scripts/seriesDetails.js index 36544f364..28a13be6c 100644 --- a/NzbDrone.Web/Scripts/seriesDetails.js +++ b/NzbDrone.Web/Scripts/seriesDetails.js @@ -19,14 +19,16 @@ $(".ignoreEpisode").live("click", function () { } var seasonNumber = 0; - + //Flip the ignored to the new state (We want the new value moving forward) ignored = !ignored; if (toggle.hasClass('ignoredEpisodesMaster')) { - seasonNumber = toggle.attr('id').replace('master_', ''); + //seasonNumber = toggle.attr('id').replace('master_', ''); + seasonNumber = toggle.attr('class').split(/\s+/)[2].replace('ignoreSeason_', ''); toggleChildren(seasonNumber, ignored); + toggleMasters(seasonNumber, ignored); saveSeasonIgnore(seasonNumber, ignored); } @@ -60,16 +62,36 @@ function toggleChildren(seasonNumber, ignored) { function toggleMaster(seasonNumber) { var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber); var ignoredCount = ignoreEpisodes.filter('.ignored').length; - var master = $('#master_' + seasonNumber); - - if (ignoreEpisodes.length == ignoredCount) { - master.attr('src', ignoredImage); - master.addClass('ignored'); + var masters = $('.ignoreSeason_' + seasonNumber); + + masters.each(function (index) { + if (ignoreEpisodes.length == ignoredCount) { + $(this).attr('src', ignoredImage); + $(this).addClass('ignored'); + } + + else { + $(this).attr('src', notIgnoredImage); + $(this).removeClass('ignored'); + } + }); +} + +function toggleMasters(seasonNumber, ignored) { + var masters = $('.ignoreSeason_' + seasonNumber); + + if (ignored) { + masters.each(function (index) { + $(this).addClass('ignored'); + $(this).attr('src', ignoredImage); + }); } else { - master.attr('src', notIgnoredImage); - master.removeClass('ignored'); + masters.each(function (index) { + $(this).removeClass('ignored'); + $(this).attr('src', notIgnoredImage); + }); } } @@ -89,28 +111,16 @@ function grid_rowBound(e) { ignoredIcon.attr('src', notIgnoredImage); ignoredIcon.removeClass('ignored'); } - + if (seriesId == 0) - seriesId = dataItem.SeriesId + seriesId = dataItem.SeriesId; } function grid_dataBound(e) { var id = $(this).attr('id'); var seasonNumber = id.replace('seasons_', ''); - var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber); - var master = $('#master_' + seasonNumber); - var count = ignoreEpisodes.length; - var ignoredCount = ignoreEpisodes.filter('.ignored').length; - - if (ignoredCount == count) { - master.attr('src', ignoredImage); - master.addClass('ignored'); - } - else { - master.attr('src', notIgnoredImage); - master.removeClass('ignored'); - } + toggleMaster(seasonNumber); } function saveSeasonIgnore(seasonNumber, ignored) { diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index 4405cfd21..81dfa4e0c 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -22,6 +22,45 @@ padding-left: 18px; padding-right: -18px; } + + .seasonToggleTopGroup + { + overflow: hidden; + width: 50%; + } + + .seasonToggleTop + { + @*float: left; + border-width: 1px; + border-style: solid; + border-color: grey; + margin: 5px; + padding: 3px; + padding-top: 0px; + padding-bottom: 0px;*@ + + background-color: #F1EDED; + background-position: 5px center; + background-repeat: no-repeat; + display: inline-block; + font-size: 15px; + margin: 2px; + padding: 2px 5px; + width: 95px; + } + + .seasonToggleLabel + { + margin-left: 5px; + } + + .seasonToggleTop .ignoredEpisodesMaster + { + padding-left: 0px; + padding-right: 0px; + margin-bottom: -4px; + } </style> @section ActionMenu{ @@ -33,6 +72,18 @@ </ul> } @section MainContent{ + + <div class="seasonToggleTopGroup"> + @foreach (var season in Model.Seasons) + { + var ignoreSeason = "ignoreSeason_" + season; + <div class="seasonToggleTop"> + <img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode @ignoreSeason' /> + <span class="seasonToggleLabel">@(season == 0 ? "Specials" : "Season " + season)</span> + </div> + } + </div> + @foreach (var season in Model.Seasons.Where(s => s > 0).Reverse()) { <h3> @@ -42,24 +93,24 @@ Html.Telerik().Grid<EpisodeModel>().Name("seasons_" + season) .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => - { - columns.Bound(o => o.Ignored) - .Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode' id='master_" + season + "' />") - .ClientTemplate( - "<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' />") - .Width(20) - .HtmlAttributes(new { style = "text-align:center" }); + { + columns.Bound(o => o.Ignored) + .Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_" + season + "'/>") + .ClientTemplate( + "<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_" + season + " ignored' id='<#= EpisodeId #>' />") + .Width(20) + .HtmlAttributes(new { style = "text-align:center" }); - columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); - columns.Bound(c => c.Title).Title("Title"); - columns.Bound(c => c.AirDate).Width(0); - columns.Bound(c => c.Quality).Width(0); - columns.Bound(c => c.Status).Width(0); - columns.Bound(o => o.EpisodeId).Title("") - .ClientTemplate("<a href='#Search' onClick=\"searchForEpisode('<#= EpisodeId #>'); return false;\">Search</a>" - + " | " + - "<a href='#Rename' onClick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\">Rename</a>"); - }) + columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); + columns.Bound(c => c.Title).Title("Title"); + columns.Bound(c => c.AirDate).Width(0); + columns.Bound(c => c.Quality).Width(0); + columns.Bound(c => c.Status).Width(0); + columns.Bound(o => o.EpisodeId).Title("") + .ClientTemplate("<a href='#Search' onClick=\"searchForEpisode('<#= EpisodeId #>'); return false;\">Search</a>" + + " | " + + "<a href='#Rename' onClick=\"renameEpisode('<#= EpisodeFileId #>'); return false;\">Rename</a>"); + }) .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>")) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false)) .Footer(true) @@ -72,10 +123,10 @@ c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season }) .ButtonType(GridButtonType.Text)) .ClientEvents(clientEvents => - { - clientEvents.OnRowDataBound("grid_rowBound"); - clientEvents.OnDataBound("grid_dataBound"); - }) + { + clientEvents.OnRowDataBound("grid_rowBound"); + clientEvents.OnDataBound("grid_dataBound"); + }) .Render();} </div> } @@ -85,31 +136,36 @@ <h3> Specials</h3> <div class="grid-container"> - @{Html.Telerik().Grid<EpisodeModel>().Name("seasons_specials") + @{Html.Telerik().Grid<EpisodeModel>().Name("seasons_0") .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => - { - columns.Bound(o => o.Ignored) - .Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode' id='master_0' />") - .ClientTemplate( - "<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_0 ignored' id='<#= EpisodeId #>' />") - .Width(20) - .HtmlAttributes(new { style = "text-align:center" }); + { + columns.Bound(o => o.Ignored) + .Title("<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode ignoreSeason_0' />") + .ClientTemplate( + "<img src='../../Content/Images/ignoredNeutral.png' class='ignoreEpisode ignoreEpisode_0 ignored' id='<#= EpisodeId #>' />") + .Width(20) + .HtmlAttributes(new { style = "text-align:center" }); - columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); - columns.Bound(c => c.Title).Title("Title").Width(10000); - columns.Bound(c => c.AirDate).Width(10); - columns.Bound(c => c.Quality).Width(10); - columns.Bound(c => c.Status).Width(10); - }) + columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); + columns.Bound(c => c.Title).Title("Title").Width(10000); + columns.Bound(c => c.AirDate).Width(10); + columns.Bound(c => c.Quality).Width(10); + columns.Bound(c => c.Status).Width(10); + }) .DetailView(detailView => detailView.ClientTemplate("<div><#= Overview #> </br><#= Path #> </div>")) .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false)) .Footer(true) .DataBinding( d => d.Ajax().Select("_AjaxSeasonGrid", "Series", - new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", 0 } } - )).Render(); } + new RouteValueDictionary { { "seriesId", Model.SeriesId }, { "seasonNumber", 0 } })) + .ClientEvents(clientEvents => + { + clientEvents.OnRowDataBound("grid_rowBound"); + clientEvents.OnDataBound("grid_dataBound"); + }) + .Render(); } </div> } } diff --git a/NzbDrone.Web/Views/Settings/Test.cshtml b/NzbDrone.Web/Views/Settings/Test.cshtml index 5f282702b..6a68c3579 100644 --- a/NzbDrone.Web/Views/Settings/Test.cshtml +++ b/NzbDrone.Web/Views/Settings/Test.cshtml @@ -1 +1,9 @@ - \ No newline at end of file +<img src='../../Content/Images/ignoredNeutral.png' class='ignoredEpisodesMaster ignoreEpisode' id='master' value='10'/> + +<script> + $(".ignoreEpisode").live("click", function () { + var toggle = $(this); + var value = $(this).attr('value'); + var test = 0; + }); +</script> \ No newline at end of file