feat(postcard): finished default layout with logo header, footer and site name
- default.htm ports WinterCMS's default layout: wrapper, header row with the Branding logo (or the site name), the inner-body card and a copyright footer; its text wrapper ends with the footer - built-in header and footer partials (logo/body/url, body) - layouts get siteName (Branding site name, else the display name of mail.from) and year; Brand.SiteName and migration 202611130002_mail_brand_site_name - cabana Branding form gets site_name (trimmed, max 255), mapped into the Branding preview draft; en/pl copy; img.logo brand CSS - 35-06 Task 1 (G-35-8)
This commit is contained in:
@@ -46,6 +46,8 @@ A bare name is one of the built-in partials; a plugin's partial is called by its
|
||||
| `panel` | `body` | A highlighted block; the body is Markdown. |
|
||||
| `table` | `body` | A Markdown table. |
|
||||
| `subcopy` | `body` | Small print under a rule; the body is Markdown. |
|
||||
| `header` | `logo` (an image URL), `body` (a name), `url` (optional link) | A table row for a layout's header: the logo, with the name as its alternative text, or the name when there is no logo. |
|
||||
| `footer` | `body` | A table row for a layout's footer; the body is Markdown. |
|
||||
|
||||
In a body, write the call on a line of its own with blank lines around it. Bodies are Markdown and raw HTML in them is still dropped; postcard inserts a partial's HTML after the Markdown conversion, through a random token that a variable's value cannot contain. Inside a partial's HTML section, `{{ markdown .body }}` renders a value as Markdown.
|
||||
|
||||
@@ -55,12 +57,14 @@ Three layouts are available to every plugin's templates without declaring an ali
|
||||
|
||||
| `layout` | Renders |
|
||||
|----------|---------|
|
||||
| `default` | The message in a plain page. Used when the template names no layout. |
|
||||
| `default` | WinterCMS's default layout: a header with the Branding logo (or the site name when no logo is set), the message on a white card, and a footer with the copyright year and the site name. Used when the template names no layout. |
|
||||
| `system` | WinterCMS's system layout: the message in a centred table, then a note that it was sent automatically. |
|
||||
| `minimal` | The message directly in the page body, with the style block only. |
|
||||
|
||||
A plugin's own alias wins over `system` and `minimal`; `default` cannot be redefined.
|
||||
|
||||
Every layout gets these values besides `{{ .Content }}`: `{{ .Subject }}`, the CSS slots `{{ .brandCss }}` and `{{ .css }}`, `{{ .logoUrl }}` (see [Branding](#branding)), `{{ .siteName }}`, the site name, and `{{ .year }}`, the current year. The default layout uses the `header` and `footer` partials with them; the footer reads `© <year> <site name>`, or `© <year>` when there is no name, and the header row is left out when there is neither a logo nor a name.
|
||||
|
||||
## Branding
|
||||
|
||||
A layout's style block has a brand slot, `{{ .brandCss }}`, before `{{ .css }}`. Until the branding settings are saved for the first time, the brand slot holds `mail.brandCss` from the configuration. From the first save on, it holds CSS that postcard compiles from the saved colours, and `mail.brandCss` is no longer used. `mail.css` is applied either way.
|
||||
@@ -73,6 +77,8 @@ The settings also hold a logo. A layout shows it where it uses `{{ .logoUrl }}`:
|
||||
{{ if .logoUrl }}<img src="{{ .logoUrl }}" alt="">{{ end }}
|
||||
```
|
||||
|
||||
The settings also hold a site name, given to layouts as `{{ .siteName }}`. The built-in layouts show it in the header (as the logo's alternative text when there is a logo) and in the footer. Left empty, the display name of `mail.from` is used (`Acme` for `Acme <no-reply@acme.test>`), so mail from an application that never saved Branding still carries a name.
|
||||
|
||||
A mail client needs an absolute address, so the logo's URL is built at send time from the configuration: `storage.uploads.public_url` when it is set, otherwise `app.url` with `storage.uploads.public_path_prefix`; see [Absolute URLs for mail](storage.md#absolute-urls-for-mail). Set one of them, or the logo is left out and a warning is logged.
|
||||
|
||||
## Sample values for previews
|
||||
|
||||
Reference in New Issue
Block a user