From c345d81c6a6f071bab8f5e0c2a7be676564f1474 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 6 Mar 2013 10:41:13 -0800 Subject: [PATCH] Naming settings with css fixes. --- NzbDrone.Backbone/Content/form.css | 29 ++++++++++++++++--- .../Settings/Naming/NamingTemplate.html | 18 ++++++------ .../Settings/Naming/NamingView.js | 2 +- NzbDrone.Core/Configuration/ConfigService.cs | 13 +++++---- 4 files changed, 43 insertions(+), 19 deletions(-) diff --git a/NzbDrone.Backbone/Content/form.css b/NzbDrone.Backbone/Content/form.css index 01839425a..064a0368c 100644 --- a/NzbDrone.Backbone/Content/form.css +++ b/NzbDrone.Backbone/Content/form.css @@ -2,9 +2,30 @@ font-size: 25px; color: #3A87AD; cursor: default; - vertical-align: text-bottom; } -.help-checkbox { - margin-top: -20px; -} \ No newline at end of file +.help-inline-checkbox { + float: left; + padding-left: 7px; + padding-top: 3px; +} + +.switch { + float: left; +} + +/*.control-group {*/ + /*border: 1px solid red;*/ +/*}*/ + +/*.control-label {*/ + /*border: 1px solid yellow;*/ +/*}*/ + +/*.switch {*/ + /*border: 1px solid purple;*/ +/*}*/ + +/*.help-inline, .help-checkbox {*/ + /*border: 1px solid #2e8b57;*/ +/*}*/ \ No newline at end of file diff --git a/NzbDrone.Backbone/Settings/Naming/NamingTemplate.html b/NzbDrone.Backbone/Settings/Naming/NamingTemplate.html index 03aeaeea3..2bbd77592 100644 --- a/NzbDrone.Backbone/Settings/Naming/NamingTemplate.html +++ b/NzbDrone.Backbone/Settings/Naming/NamingTemplate.html @@ -7,7 +7,7 @@
- + @@ -19,7 +19,7 @@
- + @@ -31,7 +31,7 @@
- + @@ -43,7 +43,7 @@
- + @@ -55,7 +55,7 @@
- + @@ -68,7 +68,7 @@
- + @@ -139,7 +139,7 @@
- + @@ -149,9 +149,9 @@
- +
- +
diff --git a/NzbDrone.Backbone/Settings/Naming/NamingView.js b/NzbDrone.Backbone/Settings/Naming/NamingView.js index da1ce061e..85d0bd07a 100644 --- a/NzbDrone.Backbone/Settings/Naming/NamingView.js +++ b/NzbDrone.Backbone/Settings/Naming/NamingView.js @@ -11,7 +11,7 @@ define([ ui: { switch: '.switch', - tooltip: '.help-inline i' + tooltip: '[class^="help-inline"] i' }, onRender: function () { diff --git a/NzbDrone.Core/Configuration/ConfigService.cs b/NzbDrone.Core/Configuration/ConfigService.cs index ecf02ca9a..1d1e578ef 100644 --- a/NzbDrone.Core/Configuration/ConfigService.cs +++ b/NzbDrone.Core/Configuration/ConfigService.cs @@ -29,7 +29,7 @@ namespace NzbDrone.Core.Configuration public Dictionary AllWithDefaults() { - var dict = new Dictionary(); + var dict = new Dictionary(StringComparer.InvariantCultureIgnoreCase); var type = GetType(); var properties = type.GetProperties(); @@ -545,6 +545,7 @@ namespace NzbDrone.Core.Configuration { EnsureCache(); + key = key.ToLowerInvariant(); string dbValue; if (_cache.TryGetValue(key, out dbValue) && dbValue != null && !String.IsNullOrEmpty(dbValue)) @@ -571,6 +572,8 @@ namespace NzbDrone.Core.Configuration public void SetValue(string key, string value) { + key = key.ToLowerInvariant(); + if (String.IsNullOrEmpty(key)) throw new ArgumentOutOfRangeException("key"); if (value == null) @@ -595,17 +598,17 @@ namespace NzbDrone.Core.Configuration public void SaveValues(Dictionary configValues) { - //Todo: make this not suck - we need the pascal case of the key - //Todo: Can we batch save this without savig default values? Or do we care? - var allWithDefaults = AllWithDefaults(); foreach(var configValue in configValues) { object currentValue; allWithDefaults.TryGetValue(configValue.Key, out currentValue); + if (currentValue == null) continue; - if (!configValue.Equals(currentValue)) + var equal = configValue.Value.ToString().Equals(currentValue.ToString()); + + if (!equal) SetValue(configValue.Key, configValue.Value.ToString()); } }