EnvelopeGenerator/EnvelopeGenerator.Web/Views/Shared/_CookieConsentPartial.cshtml
Developer 02 cc01f57125 Refaktorisierung der Lokalisierung und DTO-Integration
- Ersetzung von ITranslateService durch IStringLocalizer<X> für verbesserte Lokalisierung.
- Aktualisierung der DTO-Klassen entsprechend der neuesten Core.DTO-Struktur.
- Integration der neuen Klassen Result und DataResult aus Core.DTO für standardisierte Serviceantworten.
2024-05-02 17:36:23 +02:00

24 lines
787 B
Plaintext

@using DigitalData.Core.DTO;
@using Microsoft.AspNetCore.Http.Features
@using Newtonsoft.Json.Serialization;
@using Newtonsoft.Json;
@inject CookieConsentSettings _cookieSettings
@{
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
var showBanner = !consentFeature?.CanTrack ?? false;
var cookieString = consentFeature?.CreateConsentCookie();
}
@if (showBanner)
{
<script>
@{
var serializerSettings = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
string serializedProps = JsonConvert.SerializeObject(_cookieSettings, serializerSettings);
}
var props = @Html.Raw(serializedProps);
var cookieSettings = new BootstrapCookieConsentSettings(props)
</script>
}