From 9d7ed33d0d13a4c99efbe67dd1d020eb137d663d Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Fri, 24 Jun 2011 18:20:52 -0700 Subject: [PATCH] Updated series grid Added some parser tests --- NzbDrone.Core.Test/IndexerTests.cs | 13 +- NzbDrone.Core.Test/ParserTest.cs | 3 + NzbDrone.Web/Views/AddSeries/RootDir.cshtml | 2 +- NzbDrone.Web/Views/Series/Index.cshtml | 163 ++++++++------------ 4 files changed, 78 insertions(+), 103 deletions(-) diff --git a/NzbDrone.Core.Test/IndexerTests.cs b/NzbDrone.Core.Test/IndexerTests.cs index 6aceb5c0e..30aea11b5 100644 --- a/NzbDrone.Core.Test/IndexerTests.cs +++ b/NzbDrone.Core.Test/IndexerTests.cs @@ -179,8 +179,9 @@ namespace NzbDrone.Core.Test result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23)); } - [Test] - public void newzbin_search_returns_valid_results() + [TestCase("simpsons",21,23)] + [TestCase("Hawaii Five-0", 1, 5)] + public void newzbin_search_returns_valid_results(string title, int season, int episode) { var mocker = new AutoMoqer(); @@ -194,12 +195,12 @@ namespace NzbDrone.Core.Test mocker.Resolve(); - var result = mocker.Resolve().FetchEpisode("Simpsons", 21, 23); + var result = mocker.Resolve().FetchEpisode(title, season, episode); result.Should().NotBeEmpty(); - result.Should().OnlyContain(r => r.CleanTitle == "simpsons"); - result.Should().OnlyContain(r => r.SeasonNumber == 21); - result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(23)); + result.Should().OnlyContain(r => r.CleanTitle == title); + result.Should().OnlyContain(r => r.SeasonNumber == season); + result.Should().OnlyContain(r => r.EpisodeNumbers.Contains(episode)); } [Test] diff --git a/NzbDrone.Core.Test/ParserTest.cs b/NzbDrone.Core.Test/ParserTest.cs index 6a531f274..63f0118ed 100644 --- a/NzbDrone.Core.Test/ParserTest.cs +++ b/NzbDrone.Core.Test/ParserTest.cs @@ -41,6 +41,8 @@ namespace NzbDrone.Core.Test [TestCase(@"24-7 Penguins-Capitals- Road to the NHL Winter Classic - S01E03 - Episode 3.mkv", "24-7 Penguins-Capitals- Road to the NHL Winter Classic", 1, 3)] [TestCase("Adventure.Inc.S03E19.DVDRip.\"XviD\"-OSiTV", "Adventure.Inc", 3, 19)] [TestCase("C:/Test/TV/Chuck.4x05.HDTV.XviD-LOL", "Chuck", 4, 5)] + [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)] public void episode_parse(string postTitle, string title, int season, int episode) { var result = Parser.ParseEpisodeInfo(postTitle); @@ -202,6 +204,7 @@ namespace NzbDrone.Core.Test [TestCase("CaPitAl", "capital")] [TestCase("peri.od", "period")] [TestCase("this.^&%^**$%@#$!That", "thisthat")] + [TestCase("test/test", "testtest")] public void Normalize_Title(string dirty, string clean) { var result = Parser.NormalizeTitle(dirty); diff --git a/NzbDrone.Web/Views/AddSeries/RootDir.cshtml b/NzbDrone.Web/Views/AddSeries/RootDir.cshtml index 0925819b3..46643d55d 100644 --- a/NzbDrone.Web/Views/AddSeries/RootDir.cshtml +++ b/NzbDrone.Web/Views/AddSeries/RootDir.cshtml @@ -9,7 +9,7 @@ @{Html.Telerik().ComboBox() .Name("path_" + ViewData["guid"]) .BindTo(Model.SelectList) - .DataBinding(binding => binding.Ajax().Select("_autoCompletePath", "Directory").Delay(400).Cache(false)) + .DataBinding(binding => binding.Ajax().Select("_autoCompletePath", "Directory").Delay(400).Cache(true)) .Filterable(f => f.FilterMode(AutoCompleteFilterMode.StartsWith)) .HighlightFirstMatch(true) .HtmlAttributes(new { style = "width: 300px;" }) diff --git a/NzbDrone.Web/Views/Series/Index.cshtml b/NzbDrone.Web/Views/Series/Index.cshtml index 5a74b77d1..d2787190f 100644 --- a/NzbDrone.Web/Views/Series/Index.cshtml +++ b/NzbDrone.Web/Views/Series/Index.cshtml @@ -1,70 +1,49 @@ @using NzbDrone.Core.Repository; @using NzbDrone.Web.Models; @model IEnumerable - @section TitleContent{ - Series +Series } - - - - @section ActionMenu{ @{Html.RenderPartial("SubMenu");} } - @section MainContent{
@{Html.Telerik().Grid().Name("Grid") @@ -76,9 +55,15 @@ .Delete("_DeleteAjaxSeriesEditing", "Series")) .Columns(columns => { + columns.Command(commands => + { + commands.Edit().ButtonType(GridButtonType.Image); + commands.Delete().ButtonType(GridButtonType.Image); + }).Title("Actions").Width(80); + columns.Bound(o => o.Title) .ClientTemplate("<#= Title #>"); columns.Bound(o => o.SeasonsCount).Title("Seasons"); columns.Bound(o => o.QualityProfileName).Title("Quality"); @@ -86,33 +71,30 @@ columns.Bound(o => o.AirsDayOfWeek); columns.Bound(o => o.Episodes).Title("Episodes").Width(125) .ClientTemplate("
\" class=\"progressbar\">" + - "
" + + "
" + "
" + "" + "
" + "
"); - columns.Bound(o => o.Path); - columns.Command(commands => - { - commands.Edit().ButtonType(GridButtonType.Image); - commands.Delete().ButtonType(GridButtonType.Image); - }).Title("Actions").Width(80); - + }) .Editable(editor => editor.Mode(GridEditMode.PopUp)) .Sortable(sort => sort.OrderBy(order => order.Add(o => o.Title).Ascending()).Enabled(true)) .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
")) - .ClientEvents(clientEvents => { clientEvents.OnEdit("grid_edit"); - clientEvents.OnSave("grid_save"); - clientEvents.OnDataBinding("grid_bind"); - clientEvents.OnDataBound("grid_bound"); - clientEvents.OnRowDataBound("grid_rowBound"); - }) + .ClientEvents(clientEvents => + { + clientEvents.OnEdit("grid_edit"); + clientEvents.OnSave("grid_save"); + clientEvents.OnDataBinding("grid_bind"); + clientEvents.OnDataBound("grid_bound"); + clientEvents.OnRowDataBound("grid_rowBound"); + }) .Render();} - Loading Loading... + + Loading + Loading...
} - - \ No newline at end of file +