From 5baf2e09c44edb06ee29d8353c340bcde09bc2d4 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 4 Jul 2013 21:52:20 -0700 Subject: [PATCH] Indexer settings overhaul, reviewed settings tooltips --- ...tRestrictedReleaseSpecificationFixture.cs} | 6 +-- NzbDrone.Core.Test/NzbDrone.Core.Test.csproj | 2 +- NzbDrone.Core/Configuration/ConfigService.cs | 6 +-- NzbDrone.Core/Configuration/IConfigService.cs | 2 +- ...s => NotRestrictedReleaseSpecification.cs} | 8 ++-- NzbDrone.Core/NzbDrone.Core.csproj | 2 +- NzbDrone.Core/Organizer/FileNameBuilder.cs | 1 - UI/Content/form.less | 2 +- .../DownloadClient/BlackholeViewTemplate.html | 2 +- .../DownloadClient/LayoutTemplate.html | 4 +- .../DownloadClient/NzbgetViewTemplate.html | 2 +- .../DownloadClient/PneumaticViewTemplate.html | 2 +- .../DownloadClient/SabViewTemplate.html | 2 +- UI/Settings/General/GeneralTemplate.html | 2 +- UI/Settings/Indexers/CollectionTemplate.html | 20 ++++++---- UI/Settings/Indexers/Layout.js | 28 +++++++++++++ UI/Settings/Indexers/LayoutTemplate.html | 5 +++ UI/Settings/Indexers/Options/View.js | 13 +++++++ .../Indexers/Options/ViewTemplate.html | 39 +++++++++++++++++++ UI/Settings/MediaManagement/Layout.js | 2 +- UI/Settings/Misc/MiscTemplate.html | 11 ------ UI/Settings/Quality/QualityLayout.js | 2 +- UI/Settings/SettingsLayout.js | 20 +++++----- UI/Settings/SettingsLayoutTemplate.html | 2 +- 24 files changed, 131 insertions(+), 54 deletions(-) rename NzbDrone.Core.Test/DecisionEngineTests/{NotRestrictedNzbSpecificationFixture.cs => NotRestrictedReleaseSpecificationFixture.cs} (81%) rename NzbDrone.Core/DecisionEngine/Specifications/{NotRestrictedNzbSpecification.cs => NotRestrictedReleaseSpecification.cs} (80%) create mode 100644 UI/Settings/Indexers/Layout.js create mode 100644 UI/Settings/Indexers/LayoutTemplate.html create mode 100644 UI/Settings/Indexers/Options/View.js create mode 100644 UI/Settings/Indexers/Options/ViewTemplate.html diff --git a/NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedNzbSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedReleaseSpecificationFixture.cs similarity index 81% rename from NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedNzbSpecificationFixture.cs rename to NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedReleaseSpecificationFixture.cs index 7c7946337..79d4170c3 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedNzbSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/NotRestrictedReleaseSpecificationFixture.cs @@ -8,7 +8,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - public class NotRestrictedNzbSpecificationFixture : CoreTest + public class NotRestrictedReleaseSpecificationFixture : CoreTest { private RemoteEpisode _parseResult; @@ -37,7 +37,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [TestCase("2HD\nkyr")] public void should_be_false_when_nzb_contains_a_restricted_term(string restrictions) { - Mocker.GetMock().SetupGet(c => c.NzbRestrictions).Returns(restrictions); + Mocker.GetMock().SetupGet(c => c.ReleaseRestrictions).Returns(restrictions); Subject.IsSatisfiedBy(_parseResult).Should().BeFalse(); } @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests [TestCase("Hello\nWorld")] public void should_be_true_when_nzb_does_not_contain_a_restricted_term(string restrictions) { - Mocker.GetMock().SetupGet(c => c.NzbRestrictions).Returns(restrictions); + Mocker.GetMock().SetupGet(c => c.ReleaseRestrictions).Returns(restrictions); Subject.IsSatisfiedBy(_parseResult).Should().BeTrue(); } } diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index ef4d2357b..6c98013cb 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -125,7 +125,7 @@ - + diff --git a/NzbDrone.Core/Configuration/ConfigService.cs b/NzbDrone.Core/Configuration/ConfigService.cs index 125b56f24..4124b0042 100644 --- a/NzbDrone.Core/Configuration/ConfigService.cs +++ b/NzbDrone.Core/Configuration/ConfigService.cs @@ -251,10 +251,10 @@ namespace NzbDrone.Core.Configuration set { SetValue("NzbgetRecentTvPriority", value); } } - public string NzbRestrictions + public string ReleaseRestrictions { - get { return GetValue("NzbRestrictions", String.Empty); } - set { SetValue("NzbRestrictions", value); } + get { return GetValue("ReleaseRestrictions", String.Empty); } + set { SetValue("ReleaseRestrictions", value); } } private string GetValue(string key) diff --git a/NzbDrone.Core/Configuration/IConfigService.cs b/NzbDrone.Core/Configuration/IConfigService.cs index 05521181b..83b28a061 100644 --- a/NzbDrone.Core/Configuration/IConfigService.cs +++ b/NzbDrone.Core/Configuration/IConfigService.cs @@ -39,7 +39,7 @@ namespace NzbDrone.Core.Configuration String NzbgetTvCategory { get; set; } Int32 NzbgetPriority { get; set; } PriorityType NzbgetRecentTvPriority { get; set; } - string NzbRestrictions { get; set; } + string ReleaseRestrictions { get; set; } string GetValue(string key, object defaultValue, bool persist = false); void SetValue(string key, string value); void SaveValues(Dictionary configValues); diff --git a/NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedNzbSpecification.cs b/NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedReleaseSpecification.cs similarity index 80% rename from NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedNzbSpecification.cs rename to NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedReleaseSpecification.cs index a024a30b8..aeeb65173 100644 --- a/NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedNzbSpecification.cs +++ b/NzbDrone.Core/DecisionEngine/Specifications/NotRestrictedReleaseSpecification.cs @@ -8,12 +8,12 @@ using NzbDrone.Core.Parser.Model; namespace NzbDrone.Core.DecisionEngine.Specifications { - public class NotRestrictedNzbSpecification : IDecisionEngineSpecification + public class NotRestrictedReleaseSpecification : IDecisionEngineSpecification { private readonly IConfigService _configService; private readonly Logger _logger; - public NotRestrictedNzbSpecification(IConfigService configService, Logger logger) + public NotRestrictedReleaseSpecification(IConfigService configService, Logger logger) { _configService = configService; _logger = logger; @@ -29,9 +29,9 @@ namespace NzbDrone.Core.DecisionEngine.Specifications public virtual bool IsSatisfiedBy(RemoteEpisode subject) { - _logger.Trace("Checking if Nzb contains any restrictions: {0}", subject); + _logger.Trace("Checking if release contains any restricted terms: {0}", subject); - var restrictionsString = _configService.NzbRestrictions; + var restrictionsString = _configService.ReleaseRestrictions; if (String.IsNullOrWhiteSpace(restrictionsString)) { diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index 90c748ea9..91dd4f5be 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -233,7 +233,7 @@ - + diff --git a/NzbDrone.Core/Organizer/FileNameBuilder.cs b/NzbDrone.Core/Organizer/FileNameBuilder.cs index 76c12b84d..06573f5d2 100644 --- a/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -31,7 +31,6 @@ namespace NzbDrone.Core.Organizer _repository = repository; } - public NamingConfig GetConfig() { var config = _repository.SingleOrDefault(); diff --git a/UI/Content/form.less b/UI/Content/form.less index d01b446c2..910d71a7d 100644 --- a/UI/Content/form.less +++ b/UI/Content/form.less @@ -29,6 +29,6 @@ font-size : 12px; } -textarea.nzb-restrictions { +textarea.release-restrictions { width : 260px; } diff --git a/UI/Settings/DownloadClient/BlackholeViewTemplate.html b/UI/Settings/DownloadClient/BlackholeViewTemplate.html index 4eb595199..05d9e78ce 100644 --- a/UI/Settings/DownloadClient/BlackholeViewTemplate.html +++ b/UI/Settings/DownloadClient/BlackholeViewTemplate.html @@ -6,7 +6,7 @@
- +
diff --git a/UI/Settings/DownloadClient/LayoutTemplate.html b/UI/Settings/DownloadClient/LayoutTemplate.html index 0980c0de5..d8579edca 100644 --- a/UI/Settings/DownloadClient/LayoutTemplate.html +++ b/UI/Settings/DownloadClient/LayoutTemplate.html @@ -19,8 +19,8 @@
- - + +
diff --git a/UI/Settings/DownloadClient/NzbgetViewTemplate.html b/UI/Settings/DownloadClient/NzbgetViewTemplate.html index 879f31e37..21b38dd3d 100644 --- a/UI/Settings/DownloadClient/NzbgetViewTemplate.html +++ b/UI/Settings/DownloadClient/NzbgetViewTemplate.html @@ -60,7 +60,7 @@ - + diff --git a/UI/Settings/DownloadClient/PneumaticViewTemplate.html b/UI/Settings/DownloadClient/PneumaticViewTemplate.html index 4f0fbd415..791b212ba 100644 --- a/UI/Settings/DownloadClient/PneumaticViewTemplate.html +++ b/UI/Settings/DownloadClient/PneumaticViewTemplate.html @@ -6,7 +6,7 @@
- +
diff --git a/UI/Settings/DownloadClient/SabViewTemplate.html b/UI/Settings/DownloadClient/SabViewTemplate.html index 31915fb0a..0601fdc50 100644 --- a/UI/Settings/DownloadClient/SabViewTemplate.html +++ b/UI/Settings/DownloadClient/SabViewTemplate.html @@ -75,7 +75,7 @@ - + diff --git a/UI/Settings/General/GeneralTemplate.html b/UI/Settings/General/GeneralTemplate.html index 315e458f7..a3f914b65 100644 --- a/UI/Settings/General/GeneralTemplate.html +++ b/UI/Settings/General/GeneralTemplate.html @@ -8,7 +8,7 @@
- +
diff --git a/UI/Settings/Indexers/CollectionTemplate.html b/UI/Settings/Indexers/CollectionTemplate.html index b539ad0f9..8f263291d 100644 --- a/UI/Settings/Indexers/CollectionTemplate.html +++ b/UI/Settings/Indexers/CollectionTemplate.html @@ -1,11 +1,15 @@ -
-
- +
+ Indexers + +
+
+ +
-
-
-
-
    +
    +
    +
      +
      -
      \ No newline at end of file + \ No newline at end of file diff --git a/UI/Settings/Indexers/Layout.js b/UI/Settings/Indexers/Layout.js new file mode 100644 index 000000000..6cbcd5352 --- /dev/null +++ b/UI/Settings/Indexers/Layout.js @@ -0,0 +1,28 @@ +"use strict"; + +define( + [ + 'marionette', + 'Settings/Indexers/CollectionView', + 'Settings/Indexers/Options/View' + ], function (Marionette, CollectionView, OptionsView) { + return Marionette.Layout.extend({ + template: 'Settings/Indexers/LayoutTemplate', + + regions: { + indexersRegion : '#indexers-collection', + indexerOptions : '#indexer-options' + }, + + initialize: function (options) { + this.settings = options.settings; + this.indexersCollection = options.indexersCollection; + }, + + onShow: function () { + this.indexersRegion.show(new CollectionView({ collection: this.indexersCollection })); + this.indexerOptions.show(new OptionsView({ model: this.settings })); + } + }); + }); + diff --git a/UI/Settings/Indexers/LayoutTemplate.html b/UI/Settings/Indexers/LayoutTemplate.html new file mode 100644 index 000000000..a0c6402a8 --- /dev/null +++ b/UI/Settings/Indexers/LayoutTemplate.html @@ -0,0 +1,5 @@ +
      + +
      +
      +
      diff --git a/UI/Settings/Indexers/Options/View.js b/UI/Settings/Indexers/Options/View.js new file mode 100644 index 000000000..ff1b67f51 --- /dev/null +++ b/UI/Settings/Indexers/Options/View.js @@ -0,0 +1,13 @@ +'use strict'; +define( + [ + 'marionette', + 'Mixins/AsModelBoundView' + ], function (Marionette, AsModelBoundView) { + + var view = Marionette.ItemView.extend({ + template: 'Settings/Indexers/Options/ViewTemplate' + }); + + return AsModelBoundView.call(view); + }); diff --git a/UI/Settings/Indexers/Options/ViewTemplate.html b/UI/Settings/Indexers/Options/ViewTemplate.html new file mode 100644 index 000000000..2e2fa6e66 --- /dev/null +++ b/UI/Settings/Indexers/Options/ViewTemplate.html @@ -0,0 +1,39 @@ +
      + Options + +
      + + +
      + +
      +
      + +
      + + +
      +
      + +
      + + +
      + + + + + Newline-delimited set of rules +
      +
      +
      diff --git a/UI/Settings/MediaManagement/Layout.js b/UI/Settings/MediaManagement/Layout.js index 9254a15f7..7b7a4e42c 100644 --- a/UI/Settings/MediaManagement/Layout.js +++ b/UI/Settings/MediaManagement/Layout.js @@ -21,7 +21,7 @@ define( this.namingSettings = options.namingSettings; }, - onRender: function () { + onShow: function () { this.episodeNaming.show(new NamingView({ model: this.namingSettings })); this.sorting.show(new SortingView({ model: this.settings })); this.fileManagement.show(new FileManagementView({ model: this.settings })); diff --git a/UI/Settings/Misc/MiscTemplate.html b/UI/Settings/Misc/MiscTemplate.html index f06033fe8..0533837be 100644 --- a/UI/Settings/Misc/MiscTemplate.html +++ b/UI/Settings/Misc/MiscTemplate.html @@ -1,14 +1,3 @@ 
      Misc -
      - - -
      - - - - - Newline-delimited set of rules -
      -
      diff --git a/UI/Settings/Quality/QualityLayout.js b/UI/Settings/Quality/QualityLayout.js index b5fbf72e2..e677036b4 100644 --- a/UI/Settings/Quality/QualityLayout.js +++ b/UI/Settings/Quality/QualityLayout.js @@ -23,7 +23,7 @@ define( this.qualitySizeCollection.fetch(); }, - onRender: function () { + onShow: function () { this.qualityProfile.show(new QualityProfileCollectionView({collection: QualityProfileCollection})); this.qualitySize.show(new QualitySizeCollectionView({collection: this.qualitySizeCollection})); } diff --git a/UI/Settings/SettingsLayout.js b/UI/Settings/SettingsLayout.js index 4dd02c2ff..eebc768fe 100644 --- a/UI/Settings/SettingsLayout.js +++ b/UI/Settings/SettingsLayout.js @@ -8,7 +8,7 @@ define( 'Settings/MediaManagement/Naming/Model', 'Settings/MediaManagement/Layout', 'Settings/Quality/QualityLayout', - 'Settings/Indexers/CollectionView', + 'Settings/Indexers/Layout', 'Settings/Indexers/Collection', 'Settings/DownloadClient/Layout', 'Settings/Notifications/CollectionView', @@ -23,7 +23,7 @@ define( NamingModel, MediaManagementLayout, QualityLayout, - IndexerCollectionView, + IndexerLayout, IndexerCollection, DownloadClientLayout, NotificationCollectionView, @@ -157,14 +157,14 @@ define( this.indexerSettings.fetch(), this.notificationSettings.fetch() ).done(function () { - self.loading.$el.hide(); - self.mediaManagement.show(new MediaManagementLayout({ settings: self.settings, namingSettings: self.namingSettings })); - self.quality.show(new QualityLayout({settings: self.settings})); - self.indexers.show(new IndexerCollectionView({collection: self.indexerSettings})); - self.downloadClient.show(new DownloadClientLayout({model: self.settings})); - self.notifications.show(new NotificationCollectionView({collection: self.notificationSettings})); - self.general.show(new GeneralView({model: self.generalSettings})); - self.misc.show(new MiscView({model: self.settings})); + self.loading.$el.hide(); + self.mediaManagement.show(new MediaManagementLayout({ settings: self.settings, namingSettings: self.namingSettings })); + self.quality.show(new QualityLayout({settings: self.settings})); + self.indexers.show(new IndexerLayout({ settings: self.settings, indexersCollection: self.indexerSettings })); + self.downloadClient.show(new DownloadClientLayout({model: self.settings})); + self.notifications.show(new NotificationCollectionView({collection: self.notificationSettings})); + self.general.show(new GeneralView({model: self.generalSettings})); + self.misc.show(new MiscView({model: self.settings})); }); }, diff --git a/UI/Settings/SettingsLayoutTemplate.html b/UI/Settings/SettingsLayoutTemplate.html index 14995d814..95be24b6d 100644 --- a/UI/Settings/SettingsLayoutTemplate.html +++ b/UI/Settings/SettingsLayoutTemplate.html @@ -12,7 +12,7 @@
      -
      +
      indexers...