SF-74: Models — CustomImagesOptions (Server, Options Pattern), CustomImagesDto (Client)
This commit is contained in:
@@ -1,6 +1,36 @@
|
||||
namespace EnvelopeGenerator.Server.Models;
|
||||
|
||||
public class CustomImages : Dictionary<string, Image>
|
||||
/// <summary>
|
||||
/// A single image asset entry — source path and optional per-context CSS classes.
|
||||
/// Height controls the rendered size in CSS units (e.g. "28px", "2rem").
|
||||
/// Change Src and Height in appsettings.json per deployment; no code change required.
|
||||
/// </summary>
|
||||
public sealed class CustomImageEntry
|
||||
{
|
||||
public new Image this[string key] => TryGetValue(key, out var img) && img is not null ? img : new();
|
||||
}
|
||||
public string Src { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// CSS height value, e.g. "28px" or "2rem".
|
||||
/// Allows different-sized logos across deployments without CSS changes.
|
||||
/// </summary>
|
||||
public string Height { get; set; } = "28px";
|
||||
|
||||
public Dictionary<string, string> Classes { get; set; } = new();
|
||||
|
||||
/// <summary>Returns the CSS class for the given context key, or empty string if absent.</summary>
|
||||
public string GetClass(string key) =>
|
||||
Classes.TryGetValue(key, out var cls) && cls is not null ? cls : string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bound from appsettings.json "CustomImages" section via Options Pattern.
|
||||
/// App = signFLOW application logo.
|
||||
/// Company = customer/company logo (Digital Data GmbH by default).
|
||||
/// </summary>
|
||||
public sealed class CustomImagesOptions
|
||||
{
|
||||
public const string SectionName = "CustomImages";
|
||||
|
||||
public CustomImageEntry App { get; set; } = new();
|
||||
public CustomImageEntry Company { get; set; } = new();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user