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:
Jakub Zych
2026-11-13 20:52:52 +01:00
parent fdc2094ffc
commit 093529d45c
24 changed files with 266 additions and 30 deletions

View File

@@ -3,9 +3,11 @@ package postcard
import (
"context"
"io/fs"
"strconv"
"strings"
"testing"
"testing/fstest"
"time"
"git.golem15.com/golem15/summercms/modules/backpack"
"git.golem15.com/golem15/summercms/modules/pact"
@@ -49,6 +51,9 @@ var (
_ pact.HasMailTemplates = templatesOnly{}
)
// copyright is the footer line of the built-in layouts without a site name.
func copyright() string { return "© " + strconv.Itoa(time.Now().Year()) }
// fakeOverrides is an OverrideSource with a fixed answer.
type fakeOverrides struct{ ov Overrides }
@@ -224,7 +229,7 @@ func TestMailPartialsSmoke(t *testing.T) {
if strings.Contains(msg.HTML, "MAILPARTIAL") || strings.Contains(msg.Text, "MAILPARTIAL") {
t.Errorf("a token was left in the message:\n%s\n%s", msg.HTML, msg.Text)
}
if msg.Text != "Hi Ada\n\nGo <https://example.com/go?a=1&b=2>\n\nBye" {
if msg.Text != "Hi Ada\n\nGo <https://example.com/go?a=1&b=2>\n\nBye\n\n-------------------\n"+copyright() {
t.Errorf("text = %q", msg.Text)
}