From f32276151add415f5c8084a1c1009c81c73d7af9 Mon Sep 17 00:00:00 2001 From: Matt McHughes Date: Thu, 6 Oct 2016 14:52:39 -0500 Subject: [PATCH 1/4] added properties to disable tv requests for specific episodes or seasons and wired up to admin settings --- .../SettingModels/PlexRequestSettings.cs | 2 ++ PlexRequests.UI/Views/Admin/Settings.cshtml | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/PlexRequests.Core/SettingModels/PlexRequestSettings.cs b/PlexRequests.Core/SettingModels/PlexRequestSettings.cs index 8def76efd..6c1d95595 100644 --- a/PlexRequests.Core/SettingModels/PlexRequestSettings.cs +++ b/PlexRequests.Core/SettingModels/PlexRequestSettings.cs @@ -56,6 +56,8 @@ namespace PlexRequests.Core.SettingModels public bool CollectAnalyticData { get; set; } public bool IgnoreNotifyForAutoApprovedRequests { get; set; } public bool Wizard { get; set; } + public bool DisableTvRequestsByEpisode { get; set; } + public bool DisableTvRequestsBySeason { get; set; } /// /// The CSS name of the theme we want diff --git a/PlexRequests.UI/Views/Admin/Settings.cshtml b/PlexRequests.UI/Views/Admin/Settings.cshtml index 79aa9eb47..e9c3c7241 100644 --- a/PlexRequests.UI/Views/Admin/Settings.cshtml +++ b/PlexRequests.UI/Views/Admin/Settings.cshtml @@ -193,6 +193,36 @@ } + +
+
+ + @if (Model.DisableTvRequestsByEpisode) + { + + + } + else + { + + } +
+
+ +
+
+ + @if (Model.DisableTvRequestsBySeason) + { + + + } + else + { + + } +
+
From 75599aed784b1d4c2c2ad7baeac2e79a968da6d6 Mon Sep 17 00:00:00 2001 From: Matt McHughes Date: Thu, 6 Oct 2016 15:02:13 -0500 Subject: [PATCH 2/4] WIP hide tv request options based on admin settings --- PlexRequests.UI/Content/search.js | 4 +++- PlexRequests.UI/Views/Search/Index.cshtml | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PlexRequests.UI/Content/search.js b/PlexRequests.UI/Content/search.js index cab9171e1..ea22b5ce5 100644 --- a/PlexRequests.UI/Content/search.js +++ b/PlexRequests.UI/Content/search.js @@ -468,7 +468,9 @@ $(function () { episodes: result.episodes, tvFullyAvailable: result.tvFullyAvailable, url: result.plexUrl, - tvPartialAvailable : result.tvPartialAvailable + tvPartialAvailable: result.tvPartialAvailable, + disableTvRequestsByEpisode: result.disableTvRequestsByEpisode, + disableTvRequestsBySeason: result.disableTvRequestsBySeason }; return context; } diff --git a/PlexRequests.UI/Views/Search/Index.cshtml b/PlexRequests.UI/Views/Search/Index.cshtml index f49dddf6a..5d29eb483 100644 --- a/PlexRequests.UI/Views/Search/Index.cshtml +++ b/PlexRequests.UI/Views/Search/Index.cshtml @@ -213,10 +213,14 @@
{{#if available}} From 88d7104defeb42809634403fab757344c4260ff5 Mon Sep 17 00:00:00 2001 From: Matt McHughes Date: Fri, 7 Oct 2016 11:23:53 -0500 Subject: [PATCH 3/4] finished wiring tv request settings to tv search --- PlexRequests.UI/Content/search.js | 1 + PlexRequests.UI/Models/SearchTvShowViewModel.cs | 2 ++ PlexRequests.UI/Modules/SearchModule.cs | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/PlexRequests.UI/Content/search.js b/PlexRequests.UI/Content/search.js index ea22b5ce5..e6772061f 100644 --- a/PlexRequests.UI/Content/search.js +++ b/PlexRequests.UI/Content/search.js @@ -472,6 +472,7 @@ $(function () { disableTvRequestsByEpisode: result.disableTvRequestsByEpisode, disableTvRequestsBySeason: result.disableTvRequestsBySeason }; + return context; } diff --git a/PlexRequests.UI/Models/SearchTvShowViewModel.cs b/PlexRequests.UI/Models/SearchTvShowViewModel.cs index e552873f7..45bd0c8fd 100644 --- a/PlexRequests.UI/Models/SearchTvShowViewModel.cs +++ b/PlexRequests.UI/Models/SearchTvShowViewModel.cs @@ -55,5 +55,7 @@ namespace PlexRequests.UI.Models public int SiteRating { get; set; } public List Episodes { get; set; } public bool TvFullyAvailable { get; set; } + public bool DisableTvRequestsByEpisode { get; set; } + public bool DisableTvRequestsBySeason { get; set; } } } \ No newline at end of file diff --git a/PlexRequests.UI/Modules/SearchModule.cs b/PlexRequests.UI/Modules/SearchModule.cs index ca728613c..d03339fa0 100644 --- a/PlexRequests.UI/Modules/SearchModule.cs +++ b/PlexRequests.UI/Modules/SearchModule.cs @@ -290,8 +290,10 @@ namespace PlexRequests.UI.Modules private async Task SearchTvShow(string searchTerm) { + Analytics.TrackEventAsync(Category.Search, Action.TvShow, searchTerm, Username, CookieHelper.GetAnalyticClientId(Cookies)); var plexSettings = await PlexService.GetSettingsAsync(); + var prSettings = await PrService.GetSettingsAsync(); var providerId = string.Empty; var apiTv = new List(); @@ -336,7 +338,9 @@ namespace PlexRequests.UI.Modules Runtime = t.show.runtime.ToString(), SeriesId = t.show.id, SeriesName = t.show.name, - Status = t.show.status + Status = t.show.status, + DisableTvRequestsByEpisode = prSettings.DisableTvRequestsByEpisode, + DisableTvRequestsBySeason = prSettings.DisableTvRequestsBySeason }; From f753766585f5f2a73dcc7271fc0f15652c10e5fa Mon Sep 17 00:00:00 2001 From: Matt McHughes Date: Fri, 7 Oct 2016 11:25:23 -0500 Subject: [PATCH 4/4] fixed case typo --- PlexRequests.UI/Views/Admin/Settings.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PlexRequests.UI/Views/Admin/Settings.cshtml b/PlexRequests.UI/Views/Admin/Settings.cshtml index e9c3c7241..2dfe5c861 100644 --- a/PlexRequests.UI/Views/Admin/Settings.cshtml +++ b/PlexRequests.UI/Views/Admin/Settings.cshtml @@ -219,7 +219,7 @@ } else { - + }