feat(Hintergrund): Erstellen, um den Hintergrund von Anmerkungen mit der Eigenschaft MarginRatio zu konfigurieren.
- verschiebt Anmerkungen nach
This commit is contained in:
parent
13a87f29d9
commit
ea6ee11a4e
@ -1,4 +1,4 @@
|
|||||||
using EnvelopeGenerator.Web.Models;
|
using EnvelopeGenerator.Web.Models.Annotation;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Models;
|
namespace EnvelopeGenerator.Web.Models.Annotation;
|
||||||
|
|
||||||
public record Annotation
|
public record Annotation
|
||||||
{
|
{
|
||||||
@ -1,13 +1,20 @@
|
|||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace EnvelopeGenerator.Web.Models;
|
namespace EnvelopeGenerator.Web.Models.Annotation;
|
||||||
|
|
||||||
public class AnnotationParams
|
public class AnnotationParams
|
||||||
{
|
{
|
||||||
|
public AnnotationParams()
|
||||||
|
{
|
||||||
|
_annotationDictionaryInitor = new(() => _annots.ToDictionary(a => a.Name.ToLower(), a => a));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Background? Background { get; init; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public Annotation? DefaultAnnotation { get; init; }
|
public Annotation? DefaultAnnotation { get; init; }
|
||||||
|
|
||||||
private readonly IEnumerable<Annotation> _annots = new List<Annotation>();
|
private readonly List<Annotation> _annots = new List<Annotation>();
|
||||||
|
|
||||||
public Annotation this[string name] => _annots.First(a => a.Name == name);
|
public Annotation this[string name] => _annots.First(a => a.Name == name);
|
||||||
|
|
||||||
@ -24,7 +31,7 @@ public class AnnotationParams
|
|||||||
get => _annots;
|
get => _annots;
|
||||||
init
|
init
|
||||||
{
|
{
|
||||||
_annots = value;
|
_annots = value.ToList();
|
||||||
|
|
||||||
if (DefaultAnnotation is not null)
|
if (DefaultAnnotation is not null)
|
||||||
foreach (var annot in _annots)
|
foreach (var annot in _annots)
|
||||||
@ -48,10 +55,10 @@ public class AnnotationParams
|
|||||||
throw new InvalidOperationException($"{verBoundAnnotName} added as bound anotation. However, it is not defined.");
|
throw new InvalidOperationException($"{verBoundAnnotName} added as bound anotation. However, it is not defined.");
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
AnnotationDictionary = _annots.ToDictionary(a => a.Name.ToLower(), a => a);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<string, Annotation> AnnotationDictionary { get; private init; } = new();
|
private readonly Lazy<Dictionary<string, Annotation>> _annotationDictionaryInitor;
|
||||||
|
|
||||||
|
public Dictionary<string, Annotation> AnnotationDictionary => _annotationDictionaryInitor.Value;
|
||||||
}
|
}
|
||||||
6
EnvelopeGenerator.Web/Models/Annotation/Background.cs
Normal file
6
EnvelopeGenerator.Web/Models/Annotation/Background.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace EnvelopeGenerator.Web.Models.Annotation;
|
||||||
|
|
||||||
|
public class Background
|
||||||
|
{
|
||||||
|
public int Margin { get; init; }
|
||||||
|
}
|
||||||
@ -15,6 +15,7 @@ using DigitalData.EmailProfilerDispatcher;
|
|||||||
using EnvelopeGenerator.Infrastructure;
|
using EnvelopeGenerator.Infrastructure;
|
||||||
using EnvelopeGenerator.Web.Sanitizers;
|
using EnvelopeGenerator.Web.Sanitizers;
|
||||||
using EnvelopeGenerator.Application.Contracts.Services;
|
using EnvelopeGenerator.Application.Contracts.Services;
|
||||||
|
using EnvelopeGenerator.Web.Models.Annotation;
|
||||||
|
|
||||||
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
var logger = LogManager.Setup().LoadConfigurationFromAppSettings().GetCurrentClassLogger();
|
||||||
logger.Info("Logging initialized!");
|
logger.Info("Logging initialized!");
|
||||||
|
|||||||
@ -151,6 +151,9 @@
|
|||||||
},
|
},
|
||||||
"MainPageTitle": null,
|
"MainPageTitle": null,
|
||||||
"AnnotationParams": {
|
"AnnotationParams": {
|
||||||
|
"Background": {
|
||||||
|
"Margin": 0.20
|
||||||
|
},
|
||||||
"DefaultAnnotation": {
|
"DefaultAnnotation": {
|
||||||
"Width": 1,
|
"Width": 1,
|
||||||
"Height": 0.5,
|
"Height": 0.5,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user