Update NODEDC admin content and modules

This commit is contained in:
dcconstructions
2026-06-27 11:01:11 +03:00
parent 69e2b05fc2
commit bc0da49506
24 changed files with 1320 additions and 1049 deletions
+27
View File
@@ -43,6 +43,31 @@ function isTruthy(value) {
return Boolean(value);
}
function cloneValue(value) {
return value == null ? value : JSON.parse(JSON.stringify(value));
}
function allBlocks(model) {
return (model.regions ?? []).flatMap((region) => region.blocks ?? []);
}
function applySharedDemoRequest(model) {
const blocks = allBlocks(model);
const source = blocks.find((block) => block.id === "hero-waitlist");
if (!source?.content) return;
for (const block of blocks) {
if (block.id === source.id || block.type !== "waitlistFiles") continue;
block.content ??= {};
block.content.accessCard = cloneValue(source.content.accessCard);
block.content.form = cloneValue(source.content.form);
block.content.legal ??= { enabled: true, html: "" };
block.content.legal.html = source.content.legalHtml ?? block.content.legal.html ?? "";
}
}
function escapeHtml(value) {
return String(value)
.replaceAll("&", "&")
@@ -206,6 +231,8 @@ async function renderSections() {
return output.join("");
}
applySharedDemoRequest(page);
let output = renderTemplate(shell, { id: page.slug, ...page });
if (output.includes(REGION_TOKEN.sections)) {