feat(pages): a footer section with contact links, and a thank-you text on landing forms

Landing pages gain a Footer section (1 to 4 columns of title and text, a legal
line under a divider) whose phone numbers, emails and web addresses show as
links. The Form block and a hero with a form may carry a thank-you text shown
after sign-up, with the same links. Full-width heroes get a lighter shade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
ngqileandClaude Opus 5.5 committed 2026-12-04 11:45:25 +08:00
1 parent 5a1aa447d5
commit 3446f261be
26 files changed
+551 -33

No files matched your search

@@ -12,7 +12,7 @@ import java.util.List;
* One landing-page block. Which fields apply depends on {@code type}:
* HERO (imageId, heading, text, button, optional eventUuid for a sign-up form beside the text, fullWidth, formHeading and formText, cards as title-only points), RICH_TEXT (html), IMAGE_TEXT (imageId, imagePosition, heading, html, button),
* FAQ (heading, items), FORM (heading, eventUuid), HTML (html), FEATURES (heading, text, cards), STEPS (heading, cards),
* TRUST (cards), CTA (heading, text, button). Any block may carry anchor and look.
* TRUST (cards), CTA (heading, text, button), FOOTER (cards as title-and-text columns, text as the legal line). Any block may carry anchor and look.
*/
@Getter
@Setter
@@ -40,4 +40,6 @@ public class CmsBlock {
/** add-hero-full-width: heading (80) and text (200) at the top of a HERO's form card; only with an event. */
private String formHeading;
private String formText;
/** add-landing-thanks-and-footer: text (200) under the thank-you after a sign-up; FORM, or HERO with an event. */
private String thanksText;
}
@@ -17,7 +17,7 @@ import java.util.regex.Pattern;
* Co-Lite changes: images are uploaded ids of the page's company, FORM points at an event of that company,
* buttons may also use mailto: and tel:, and rich-text HTML holding scripts is refused (the public page sanitises as well).
* The HTML block (custom HTML) is exempt from the script check: it is served only inside a sandboxed frame.
* add-page-sections adds FEATURES, STEPS, TRUST and CTA, a look on any block, and makes the HERO image optional.
* add-landing-thanks-and-footer adds FOOTER and the thank-you text. add-page-sections adds FEATURES, STEPS, TRUST and CTA, a look on any block, and makes the HERO image optional.
* Throws 422 on the first violation, with the reason "path|MessageCode".
*/
public final class CmsBlockValidator {
@@ -27,7 +27,7 @@ public final class CmsBlockValidator {
/** Section looks and feature icons (add-page-sections). */
private static final Set<String> LOOKS = Set.of("DEFAULT", "MUTED", "DARK", "ACCENT");
static final Set<String> ICONS = Set.of("wifi", "phone", "tv", "monitor", "lock", "shield-check", "cloud", "wrench", "headset", "users", "calendar", "star");
private static final Set<String> CARD_TYPES = Set.of("FEATURES", "STEPS", "TRUST", "HERO");
private static final Set<String> CARD_TYPES = Set.of("FEATURES", "STEPS", "TRUST", "HERO", "FOOTER");
private static final Pattern SCRIPT = Pattern.compile("(?i)<\\s*script|\\son[a-z]+\\s*=|javascript\\s*:");
private CmsBlockValidator() {
@@ -62,6 +62,10 @@ public final class CmsBlockValidator {
if (b.getCards() != null && !CARD_TYPES.contains(b.getType())) {
throw refuse(path + ".cards", "PagesUnusedField");
}
// add-landing-thanks-and-footer: a thank-you text belongs to a block with a sign-up form.
if (b.getThanksText() != null && !"FORM".equals(b.getType()) && !"HERO".equals(b.getType())) {
throw refuse(path + ".thanksText", "PagesUnusedField");
}
switch (b.getType()) {
case "HERO" -> {
if (b.getImageId() != null) {
@@ -77,7 +81,7 @@ public final class CmsBlockValidator {
}
// add-hero-full-width: up to 6 title-only points, and a form card heading and text only with a form.
if (b.getCards() != null) {
cards(b, path, 0, false, false);
cards(b, path, 0, 6, false, false);
}
max(b.getFormHeading(), path + ".formHeading", 80);
max(b.getFormText(), path + ".formText", 200);
@@ -87,6 +91,10 @@ public final class CmsBlockValidator {
if (b.getEventUuid() == null && b.getFormText() != null) {
throw refuse(path + ".formText", "PagesUnusedField");
}
max(b.getThanksText(), path + ".thanksText", 200);
if (b.getEventUuid() == null && b.getThanksText() != null) {
throw refuse(path + ".thanksText", "PagesUnusedField");
}
}
case "RICH_TEXT" -> html(b.getHtml(), path + ".html");
case "HTML" -> {
@@ -106,6 +114,7 @@ public final class CmsBlockValidator {
case "FAQ" -> faq(b, path);
case "FORM" -> {
max(b.getHeading(), path + ".heading", 120);
max(b.getThanksText(), path + ".thanksText", 200);
if (b.getEventUuid() == null || !ownEvent.test(b.getEventUuid())) {
throw refuse(path + ".eventUuid", "PagesBadEvent");
}
@@ -114,18 +123,25 @@ public final class CmsBlockValidator {
required(b.getHeading(), path + ".heading");
max(b.getHeading(), path + ".heading", 120);
max(b.getText(), path + ".text", 300);
cards(b, path, 2, true, true);
cards(b, path, 2, 6, true, true);
}
case "STEPS" -> {
required(b.getHeading(), path + ".heading");
max(b.getHeading(), path + ".heading", 120);
cards(b, path, 2, false, true);
cards(b, path, 2, 6, false, true);
}
case "TRUST" -> {
if (b.getHeading() != null) {
throw refuse(path + ".heading", "PagesUnusedField");
}
cards(b, path, 2, false, false);
cards(b, path, 2, 6, false, false);
}
case "FOOTER" -> {
if (b.getHeading() != null) {
throw refuse(path + ".heading", "PagesUnusedField");
}
cards(b, path, 1, 4, false, true);
max(b.getText(), path + ".text", 300);
}
case "CTA" -> {
required(b.getHeading(), path + ".heading");
@@ -185,10 +201,10 @@ public final class CmsBlockValidator {
}
}
/** min to 6 cards; an icon from the list where the type uses one, a title (80), a text (300) where used, nothing else. */
private static void cards(CmsBlock b, String path, int min, boolean icon, boolean text) {
/** min to max cards; an icon from the list where the type uses one, a title (80), a text (300) where used, nothing else. */
private static void cards(CmsBlock b, String path, int min, int max, boolean icon, boolean text) {
List<CmsCard> cards = b.getCards();
if (cards == null || cards.size() < min || cards.size() > 6) {
if (cards == null || cards.size() < min || cards.size() > max) {
throw refuse(path + ".cards", "PagesCardCount");
}
for (int i = 0; i < cards.size(); i++) {