From c32346e6eae65f7a88a9da037d86422c1d82769f Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 3 Aug 2011 00:26:39 -0700 Subject: [PATCH] New series ignore editor on Series/Details. Styling works, backend saving not yet implemented. --- NzbDrone.Web/Content/Images/ignored.png | Bin 0 -> 3537 bytes NzbDrone.Web/Content/Images/notIgnored.png | Bin 0 -> 5898 bytes NzbDrone.Web/Controllers/SeriesController.cs | 5 +- NzbDrone.Web/Models/EpisodeModel.cs | 1 + NzbDrone.Web/NzbDrone.Web.csproj | 3 + NzbDrone.Web/Scripts/seriesDetails.js | 83 +++++++++++++++ NzbDrone.Web/Views/Series/Details.cshtml | 48 +++++++-- NzbDrone.Web/Views/Settings/Test.cshtml | 106 +++---------------- 8 files changed, 142 insertions(+), 104 deletions(-) create mode 100644 NzbDrone.Web/Content/Images/ignored.png create mode 100644 NzbDrone.Web/Content/Images/notIgnored.png create mode 100644 NzbDrone.Web/Scripts/seriesDetails.js diff --git a/NzbDrone.Web/Content/Images/ignored.png b/NzbDrone.Web/Content/Images/ignored.png new file mode 100644 index 0000000000000000000000000000000000000000..06b5934d61068f17b36cf16a9ea4032b6ff14036 GIT binary patch literal 3537 zcmV;?4KDJDP)KLZ*U+9)Gc>Uwq5=^`M4BQav zC@~mCR4i{s){CyJy!Z0*`{S%{?X&l}`|Q2XS{DG4r!SY621@~u$`kN|Je=tfkx_K) z0Du7=V1OwAOjbs^U$A=!5XsBUg`OdD0$&6H@OoIh0&vsNGk{J9|DU8;>3o6cm;e!* zvpE?o5f_L!B}hR1Px(02E1V7jRgKA~q2*i60W=BI4x$ z;7AEyaokrd;A9KLmvTu<&*5_u5(RV}mM-1Y+L}T4YB~8euXQVS(9J=A3hxi`{{&gM(L7aFFpTiSHgo&n% z%S#Zoo5$t~xM@5(m-nBV_z%PWq{X=wiPHEHP-BdM)O9LAe(eV+3K1aD`^8=Vqi??W zFd%+;;VP4hbN}x*{b#|Y;w6Kd@Hx&UD1^=u@-r9r#Lp6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${) zUY7s)LZ)5U!7i?2*QlxJqu**4GCumNh-iv9{&AtI50dT&^NP91k>dgbFA+b_t`#;<_1Zc{dV{{1cK^2Sf;!eEaL=SeBc*Hj#PbC5 zL~Be&Vn%QX;!Dqw?#pGzhKMbFN7vClR*13Qwi_=-5ACkn-Ev^!E^DHsdr;izu2b4| z%wg{l)(CbX;knJD$_tfg#pMS)%g2MNZy$4?8J5n}YI!|X9r#IdvExOij_&K~$spRy z!70D+BY|L-@nIS=Hr#Vbv6UXVZSRbdVIM# zZT~E1E@5**!XgiM%H%hqno2ix--Hp(?5qGFXgdIeo&5v>24?3&7GJgjd$P}oWW{^DuYKbV><9K6isAXV z6(yr>fGzm*ItmZrXzpi0At4I{o;M2%HF&%?FesjU3T*!7m1%_DIH`3F|I)cYk>!`hkA*=%{BzYPx5cLa0Qj zb}SBeu{gGWR?N+%$UkFu?T(FVb5CP}w>slgQ$6(!=L zeWuuj0IcTGx&sJu`zdaCz8G-e(4j41V(V#|>ArqrjU=?faWw4m6B0UVAD+}*hKl@h zyhZ|#$ClaaK;TI#T1{q)GE^hTG`t5dyZqe#EwcTF1HME>xN%;NpKk9&3#@U4p(V1Bre{frwhH@3zX8yz|E4_EC^A^-pY literal 0 HcmV?d00001 diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index c1d0835be..195fce36b 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -227,8 +227,6 @@ namespace NzbDrone.Web.Controllers var episodePath = String.Empty; var episodeQuality = String.Empty; - - if (e.EpisodeFile != null) { episodePath = e.EpisodeFile.Path; @@ -252,7 +250,8 @@ namespace NzbDrone.Web.Controllers Path = episodePath, EpisodeFileId = episodeFileId, Status = e.Status.ToString(), - Quality = episodeQuality + Quality = episodeQuality, + Ignored = e.Ignored }); } diff --git a/NzbDrone.Web/Models/EpisodeModel.cs b/NzbDrone.Web/Models/EpisodeModel.cs index 2384031d9..867066f99 100644 --- a/NzbDrone.Web/Models/EpisodeModel.cs +++ b/NzbDrone.Web/Models/EpisodeModel.cs @@ -15,5 +15,6 @@ namespace NzbDrone.Web.Models public String Status { get; set; } public string AirDate { get; set; } public String Quality { get; set; } + public bool Ignored { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index e158a9177..e204fe659 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -183,6 +183,8 @@ + + @@ -250,6 +252,7 @@ + diff --git a/NzbDrone.Web/Scripts/seriesDetails.js b/NzbDrone.Web/Scripts/seriesDetails.js new file mode 100644 index 000000000..cc18320cb --- /dev/null +++ b/NzbDrone.Web/Scripts/seriesDetails.js @@ -0,0 +1,83 @@ +var notIgnoredImage = '../../Content/Images/notIgnored.png'; +var ignoredImage = '../../Content/Images/ignored.png'; + +$(".ignoreEpisode").live("click", function () { + var toggle = $(this); + var ignored = toggle.hasClass('ignored'); + + if (ignored) { + toggle.removeClass('ignored'); + toggle.attr('src', notIgnoredImage); + } + + else { + toggle.addClass('ignored'); + toggle.attr('src', ignoredImage); + } + + if (toggle.hasClass('ignoredEpisodesMaster')) { + var seasonNumber = toggle.attr('id').replace('master_', ''); + + toggleChildren(seasonNumber, ignored); + } +}); + +function toggleChildren(seasonNumber, ignored) { + var ignoreEpisodes = $('.ignoreEpisode_' + seasonNumber); + + if (!ignored) { + ignoreEpisodes.each(function (index) { + $(this).addClass('ignored'); + $(this).attr('src', ignoredImage); + }); + } + + else { + ignoreEpisodes.each(function (index) { + $(this).removeClass('ignored'); + $(this).attr('src', notIgnoredImage); + }); + } +} + +function grid_rowBound(e) { + var dataItem = e.dataItem; + var ignored = dataItem.Ignored; + var episodeId = dataItem.EpisodeId; + + var ignoredIcon = $('#' + episodeId); + + if (ignored) { + ignoredIcon.attr('src', ignoredImage); + } + + else { + ignoredIcon.attr('src', notIgnoredImage); + ignoredIcon.removeClass('ignored'); + } +} + +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 = 0; + + ignoreEpisodes.each(function (index) { + if ($(this).hasClass('ignored')) { + ignoredCount++; + } + }); + + if (ignoredCount == count) { + master.attr('src', ignoredImage); + master.addClass('ignored'); + } + + else { + master.attr('src', notIgnoredImage); + master.removeClass('ignored'); + } +} \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index 76b412db7..21d1ae8aa 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -4,6 +4,26 @@ @section TitleContent{ @Model.Title } + + + + + @section ActionMenu{ @{Html.Telerik().Menu().Name("SeriesMenu").Items(items => { @@ -50,11 +70,11 @@ .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => { - columns.Bound(o => o.EpisodeId) + columns.Bound(o => o.Ignored) + .Title("") .ClientTemplate( - "") - .Title("") - .Width(1) + "") + .Width(20) .HtmlAttributes(new { style = "text-align:center" }); columns.Bound(c => c.EpisodeNumber).Width(0).Title("Episode"); @@ -68,7 +88,7 @@ "'); return false;\">Rename"); }) .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
<#= Path #>
")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false)) .Footer(true) .DataBinding( d => @@ -78,12 +98,16 @@ c => c.Custom().Text("Rename Season").Action("RenameSeason", "Series", new { seasonId = season }) .ButtonType(GridButtonType.Text)) + .ClientEvents(clientEvents => + { + clientEvents.OnRowDataBound("grid_rowBound"); + clientEvents.OnDataBound("grid_dataBound"); + }) .Render();} } @if (Model.Seasons.Any(s => s == 0)) { -

Specials

@@ -92,11 +116,11 @@ .TableHtmlAttributes(new { @class = "Grid" }) .Columns(columns => { - columns.Bound(o => o.EpisodeId) + columns.Bound(o => o.Ignored) + .Title("") .ClientTemplate( - "") - .Title("") - .Width(1) + "") + .Width(20) .HtmlAttributes(new { style = "text-align:center" }); columns.Bound(c => c.EpisodeNumber).Width(10).Title("Episode"); @@ -106,7 +130,7 @@ columns.Bound(c => c.Status).Width(10); }) .DetailView(detailView => detailView.ClientTemplate("
<#= Overview #>
<#= Path #>
")) - .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(true)) + .Sortable(rows => rows.OrderBy(epSort => epSort.Add(c => c.EpisodeNumber).Descending()).Enabled(false)) .Footer(true) .DataBinding( d => @@ -134,6 +158,8 @@ } }); } + + } diff --git a/NzbDrone.Web/Views/Settings/Test.cshtml b/NzbDrone.Web/Views/Settings/Test.cshtml index 27792a291..03660916e 100644 --- a/NzbDrone.Web/Views/Settings/Test.cshtml +++ b/NzbDrone.Web/Views/Settings/Test.cshtml @@ -1,94 +1,20 @@ - + - - - - - - - -
- - - \ No newline at end of file