From d86beb06f7996d0d225e5a494d189ca96ac60878 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Thu, 3 May 2018 23:07:48 +0200 Subject: [PATCH] Added fancy unit indicator to fields. --- src/NzbDrone.Api/ClientSchema/Field.cs | 1 + src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs | 1 + .../Annotations/FieldDefinitionAttribute.cs | 3 ++- src/NzbDrone.Core/Indexers/SeedCriteriaSettings.cs | 4 ++-- src/UI/Content/form.less | 12 ++++++++++++ src/UI/Form/TextboxTemplate.hbs | 1 + 6 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Api/ClientSchema/Field.cs b/src/NzbDrone.Api/ClientSchema/Field.cs index 358669e70..ff9f6aebd 100644 --- a/src/NzbDrone.Api/ClientSchema/Field.cs +++ b/src/NzbDrone.Api/ClientSchema/Field.cs @@ -7,6 +7,7 @@ namespace NzbDrone.Api.ClientSchema public int Order { get; set; } public string Name { get; set; } public string Label { get; set; } + public string Unit { get; set; } public string HelpText { get; set; } public string HelpLink { get; set; } public object Value { get; set; } diff --git a/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs b/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs index 70f0ce1da..c2e4a4379 100644 --- a/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs +++ b/src/NzbDrone.Api/ClientSchema/SchemaBuilder.cs @@ -95,6 +95,7 @@ namespace NzbDrone.Api.ClientSchema { Name = prefix + propertyInfo.Name, Label = fieldAttribute.Label, + Unit = fieldAttribute.Unit, HelpText = fieldAttribute.HelpText, HelpLink = fieldAttribute.HelpLink, Order = fieldAttribute.Order, diff --git a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs index 85b9b044c..97927d442 100644 --- a/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs +++ b/src/NzbDrone.Core/Annotations/FieldDefinitionAttribute.cs @@ -12,6 +12,7 @@ namespace NzbDrone.Core.Annotations public int Order { get; private set; } public string Label { get; set; } + public string Unit { get; set; } public string HelpText { get; set; } public string HelpLink { get; set; } public FieldType Type { get; set; } @@ -33,4 +34,4 @@ namespace NzbDrone.Core.Annotations Url, Captcha } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/Indexers/SeedCriteriaSettings.cs b/src/NzbDrone.Core/Indexers/SeedCriteriaSettings.cs index 6b7d608a7..9c44a54b4 100644 --- a/src/NzbDrone.Core/Indexers/SeedCriteriaSettings.cs +++ b/src/NzbDrone.Core/Indexers/SeedCriteriaSettings.cs @@ -25,10 +25,10 @@ namespace NzbDrone.Core.Indexers [FieldDefinition(0, Type = FieldType.Textbox, Label = "Seed Ratio", HelpText = "The ratio a torrent should reach before stopping, empty is download client's default", Advanced = true)] public double? SeedRatio { get; set; } - [FieldDefinition(1, Type = FieldType.Textbox, Label = "Seed Time", HelpText = "The time a torrent should be seeded before stopping, empty is download client's default", Advanced = true)] + [FieldDefinition(1, Type = FieldType.Textbox, Label = "Seed Time", Unit = "minutes", HelpText = "The time a torrent should be seeded before stopping, empty is download client's default", Advanced = true)] public int? SeedTime { get; set; } - [FieldDefinition(2, Type = FieldType.Textbox, Label = "Season-Pack Seed Time", HelpText = "The time a torrent should be seeded before stopping, empty is download client's default", Advanced = true)] + [FieldDefinition(2, Type = FieldType.Textbox, Label = "Season-Pack Seed Time", Unit = "minutes", HelpText = "The time a torrent should be seeded before stopping, empty is download client's default", Advanced = true)] public int? SeasonPackSeedTime { get; set; } } } diff --git a/src/UI/Content/form.less b/src/UI/Content/form.less index 28474c962..a2743c8c3 100644 --- a/src/UI/Content/form.less +++ b/src/UI/Content/form.less @@ -48,6 +48,18 @@ margin-left: 0px; } } + + .unit-inline { + width: 75px; + margin-left: -100px; + margin-top: 7px; + color: lightgray; + float: left; + position: relative; + text-align: right; + user-select: none; + pointer-events: none; + } } .text-area-help { diff --git a/src/UI/Form/TextboxTemplate.hbs b/src/UI/Form/TextboxTemplate.hbs index e7054cfac..48d396ef8 100644 --- a/src/UI/Form/TextboxTemplate.hbs +++ b/src/UI/Form/TextboxTemplate.hbs @@ -4,5 +4,6 @@
+ {{#if unit}}{{unit}}{{/if}} {{> FormHelpPartial}}