Added a signature legal agreement warning and integrated the resource file (resx) as a JavaScript object into the _Layout.cshtml file. This enables the agreement warning to support multiple languages.

This commit is contained in:
Developer 02
2024-05-31 09:39:31 +02:00
parent 21934928c2
commit c31f081208
7 changed files with 128 additions and 53 deletions

View File

@@ -3,6 +3,8 @@
}
@using DigitalData.Core.DTO;
@using EnvelopeGenerator.Application.DTOs;
@using Newtonsoft.Json
@using Newtonsoft.Json.Serialization
@model EnvelopeReceiverDto;
@{
ViewData["Title"] = _localizer[WebKey.SignDoc];
@@ -88,11 +90,11 @@
}
@if (ViewData["DocumentBytes"] is byte[] documentBytes)
{
var settings = new Newtonsoft.Json.JsonSerializerSettings
var settings = new JsonSerializerSettings
{
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
ContractResolver = new CamelCasePropertyNamesContractResolver()
};
var envelopeReceiverJson = Newtonsoft.Json.JsonConvert.SerializeObject(Model, settings);
var envelopeReceiverJson = JsonConvert.SerializeObject(Model, settings);
var documentBase64String = Convert.ToBase64String(documentBytes);
var envelopeKey = ViewData["EnvelopeKey"] as string;

View File

@@ -1,4 +1,9 @@
<!DOCTYPE html>
@using DigitalData.Core.API
@using Newtonsoft.Json
@{
var nonce = _accessor.HttpContext?.Items["csp-nonce"] as string;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
@@ -24,6 +29,13 @@
<script src="~/js/util.js" asp-append-version="true"></script>
<script src="~/js/api.js" asp-append-version="true"></script>
@await RenderSectionAsync("Scripts", required: false)
@{
var lStrsJson = JsonConvert.SerializeObject(_localizer.ToDictionary()).TrySanitize(_sanitizer);
}
<script nonce="@nonce">
var localized = @Html.Raw(lStrsJson)
</script>
<main role="main">
<partial name="_CookieConsentPartial" />
@RenderBody()