feat(postcard): header, logo, footer and padding in the system and minimal layouts

- system.htm: the header partial (logo or site name) above the card and
  the copyright footer below it; its text wrapper ends with the footer
- brand CSS: the system layout's content cell keeps WinterCMS's 35px
  side padding (the 35px 0 override is gone)
- minimal.htm: the logo above the message when logoUrl is set
- TestMailPartialsSmoke/built_in_layouts covers the three layouts and the
  inlined brand colour on the button in each
- 35-06 Task 3 (G-35-8)
This commit is contained in:
Jakub Zych
2026-11-13 21:17:02 +01:00
parent d320733510
commit 09a5338d9a
6 changed files with 74 additions and 18 deletions

View File

@@ -176,8 +176,8 @@ Markdown drops raw HTML, so a call in a body does not insert the partial's HTML
| Layout alias | Full name | Renders |
|--------------|-----------|---------|
| `default` | `postcard::mail.layouts.default` | WinterCMS's default layout (`wrapper layout-default`): the `header` partial with the logo or the site name, the message in the `inner-body` card, and the `footer` partial with `© <year> <site name>`. Used when a template names no layout. |
| `system` | `postcard::mail.layouts.system` | WinterCMS's system layout: the message in a centred table, followed by a note that the message is automatic. |
| `minimal` | `postcard::mail.layouts.minimal` | The message directly in the page body. |
| `system` | `postcard::mail.layouts.system` | WinterCMS's system layout (`wrapper layout-system`): the same header and footer as `default`, the message in the padded card followed by a `subcopy` note that the message is automatic. Its text wrapper ends with that note and the footer's text section. |
| `minimal` | `postcard::mail.layouts.minimal` | The message directly in the page body, with the logo (`img.logo`, the site name as its alternative text) in a paragraph above it when `logoUrl` is set. |
A template selects one with `layout = "system"`. A plugin's own alias of the same name wins, except `default`, which plugins cannot redefine. Every built-in layout has the `{{ .brandCss }}{{ .css }}` style block.
@@ -193,7 +193,7 @@ A layout opts out with WinterCMS's option name, `disable_auto_inline_css`:
An opted-out layout keeps its style block as rendered. When the inliner fails on a message, the message is sent with its style block only and a warning keyed by the layout is logged at most once a minute.
Both wrappers of every layout get these keys: `Content`, `Subject`, `css`, `brandCss`, `logoUrl` (see [Branding](#branding)), `siteName` (the Branding's site name, else the display name of `mail.from`, else empty) and `year` (the current year). The default layout calls the header only when `logoUrl` or `siteName` is set, and builds the footer line from `year` and `siteName`, `© 2026 Acme`, or `© 2026` without a name. Its text wrapper is the message, a blank line and the footer's text section.
Both wrappers of every layout get these keys: `Content`, `Subject`, `css`, `brandCss`, `logoUrl` (see [Branding](#branding)), `siteName` (the Branding's site name, else the display name of `mail.from`, else empty) and `year` (the current year). The default and system layouts call the header only when `logoUrl` or `siteName` is set, and builds the footer line from `year` and `siteName`, `© 2026 Acme`, or `© 2026` without a name. Its text wrapper is the message, a blank line and the footer's text section.
| Partial | Arguments | Renders |
|---------|-----------|---------|
@@ -263,7 +263,7 @@ Layouts have two CSS slots, `{{ .brandCss }}` and `{{ .css }}`, a logo slot, `{{
`mail.css` fills `{{ .css }}` in both cases, after the brand CSS, with a layout's own CSS before it.
The compiled CSS styles the page, links, headings, paragraphs and tables, and the classes of the built-in layouts and partials (`button button-primary`, `panel`, `table`, `subcopy`, `layout-system` and others), so the colours also apply in a plugin's layout that has the style block and no brand classes of its own. A colour must be a six-digit hexadecimal colour such as `#2da7c7`; `postcard.CompileBrandCSS` refuses anything else with an error naming the column. If a stored colour is invalid at send time, a warning is logged and `mail.brandCss` is used.
The compiled CSS styles the page, links, headings, paragraphs and tables, and the classes of the built-in layouts and partials (`button button-primary`, `panel`, `table`, `subcopy`, `header`, `footer`, the `logo` image and others), so the colours also apply in a plugin's layout that has the style block and no brand classes of its own. A colour must be a six-digit hexadecimal colour such as `#2da7c7`; `postcard.CompileBrandCSS` refuses anything else with an error naming the column. If a stored colour is invalid at send time, a warning is logged and `mail.brandCss` is used.
| Column | `postcard.Brand` field | Default |
|--------|------------------------|---------|