feat(CustomImages): Implementiert anstelle von Bildern, um mehrere Bilder über ein Wörterbuch zu konfigurieren
This commit is contained in:
parent
1e34042f77
commit
41b5b62f2c
6
EnvelopeGenerator.Web/Models/CustomImages.cs
Normal file
6
EnvelopeGenerator.Web/Models/CustomImages.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace EnvelopeGenerator.Web.Models;
|
||||
|
||||
public class CustomImages : Dictionary<string, Image>
|
||||
{
|
||||
public new Image this[string key] => TryGetValue(key, out var img) && img is not null ? img : new();
|
||||
}
|
||||
10
EnvelopeGenerator.Web/Models/Image.cs
Normal file
10
EnvelopeGenerator.Web/Models/Image.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace EnvelopeGenerator.Web.Models;
|
||||
|
||||
public class Image
|
||||
{
|
||||
public string Src { get; init; } = string.Empty;
|
||||
|
||||
public Dictionary<string, string> Classes { get; init; } = new();
|
||||
|
||||
public string GetClassIn(string page) => Classes.TryGetValue(page, out var cls) && cls is not null ? cls : string.Empty;
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
namespace EnvelopeGenerator.Web.Models
|
||||
{
|
||||
public class Img
|
||||
{
|
||||
public string Src { get; init; } = string.Empty;
|
||||
|
||||
public Dictionary<string, string> Classes { get; init; } = new();
|
||||
|
||||
public string ClassIn(string page) => Classes.TryGetValue(page, out var cls) && cls is not null ? cls : string.Empty;
|
||||
}
|
||||
}
|
||||
@ -161,7 +161,7 @@ try
|
||||
|
||||
builder.Services.AddMemoryCache();
|
||||
|
||||
builder.ConfigureBySection<Img>();
|
||||
builder.ConfigureBySection<CustomImages>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
@{
|
||||
//TODO: Create view model
|
||||
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
||||
var logo = _logoOpt.Value;
|
||||
var cImg = _cImgOpt.Value;
|
||||
ViewData["Title"] = _localizer[WebKey.DocProtected];
|
||||
var userCulture = ViewData["UserCulture"] as Culture;
|
||||
string codeType = ViewData["CodeType"] is string _codeType ? _codeType : "accessCode";
|
||||
@ -24,7 +24,7 @@
|
||||
<header class="text-center">
|
||||
<div class="header-1 alert alert-secondary" role="alert">
|
||||
<h3 class="text">@_localizer[WebKey.WelcomeToTheESignPortal]</h3>
|
||||
<img class="@logo.ClassIn("Locked")" src="@logo.Src" />
|
||||
<img class="@cImg["Company"].GetClassIn("Locked")" src="@cImg["Company"].Src" />
|
||||
</div>
|
||||
<div class="icon locked @(viaTFA ? "tfa" : "") mt-4 mb-1">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="72" height="72" fill="currentColor" class="bi bi-shield-lock" viewBox="0 0 16 16">
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
@{
|
||||
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
||||
var logo = _logoOpt.Value;
|
||||
var cImg = _cImgOpt.Value;
|
||||
ViewData["Title"] = _localizer["Home"];
|
||||
var userCulture = ViewData["UserCulture"] as Culture;
|
||||
}
|
||||
@ -8,7 +8,7 @@
|
||||
<header class="text-center">
|
||||
<div class="header-1 alert alert-secondary" role="alert">
|
||||
<h3 class="text">@_localizer[WebKey.WelcomeToTheESignPortal]</h3>
|
||||
<img class="@logo.ClassIn("Locked")" src="@logo.Src" />
|
||||
<img class="@cImg["Company"].GetClassIn("Locked")" src="@cImg["Company"].Src" />
|
||||
</div>
|
||||
<div class="icon mt-4 mb-1">
|
||||
<img src="~/img/sign_flow_min.svg">
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
@{
|
||||
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
|
||||
var logo = _logoOpt.Value;
|
||||
var cImg = _cImgOpt.Value;
|
||||
}
|
||||
@using DigitalData.Core.DTO;
|
||||
@using EnvelopeGenerator.Application.DTOs;
|
||||
@ -66,7 +66,7 @@
|
||||
</div>
|
||||
<div class="dd-card-info">
|
||||
<div class="logo">
|
||||
<img class="@logo.ClassIn("Show")" src="@logo.Src" alt="logo">
|
||||
<img class="@cImg["Company"].GetClassIn("Show")" src="@cImg["Company"].Src" alt="logo">
|
||||
</div>
|
||||
<h2>@($"{envelope?.Title}".TrySanitize(_sanitizer))</h2>
|
||||
@if (isReadOnly)
|
||||
|
||||
@ -11,5 +11,5 @@
|
||||
@inject HighlightHtmlSanitizer _hlSanitizer
|
||||
@inject Microsoft.AspNetCore.Http.IHttpContextAccessor _accessor
|
||||
@inject Cultures _cultures
|
||||
@inject IOptions<Img> _logoOpt
|
||||
@inject IOptions<CustomImages> _cImgOpt
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@ -103,12 +103,14 @@
|
||||
"Platforms": [ "javascript" ]
|
||||
}
|
||||
],
|
||||
"Img": {
|
||||
"CustomImages": {
|
||||
"Company": {
|
||||
"Src": "/img/digital_data.svg",
|
||||
"Classes": {
|
||||
"Show": "dd-show-logo",
|
||||
"Locked": "dd-locked-logo"
|
||||
}
|
||||
}
|
||||
},
|
||||
"DispatcherParams": {
|
||||
"SendingProfile": 1,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user