Update NODEDC admin content and modules
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user