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

@@ -155,6 +155,17 @@ var Migrations = []*gormigrate.Migration{
return nil
},
},
{
// site_name is the name the built-in layouts show in their header
// and footer (Brand.SiteName); empty uses mail.from's display name.
ID: "202611130002_mail_brand_site_name",
Migrate: func(tx *gorm.DB) error {
return tx.Exec(`ALTER TABLE ` + BrandTable + ` ADD COLUMN site_name TEXT NOT NULL DEFAULT ''`).Error
},
Rollback: func(tx *gorm.DB) error {
return tx.Exec(`ALTER TABLE ` + BrandTable + ` DROP COLUMN IF EXISTS site_name`).Error
},
},
}
// OverrideSource supplies the database overrides one render needs.
@@ -322,9 +333,11 @@ func (s *dbSource) brand(tx *gorm.DB, out *Overrides) error {
ButtonNegativeBg string
PanelBg string
TableBorderColor string
SiteName string
}
err := tx.Raw(`SELECT logo_file_id, body_bg, content_bg, header_color, footer_color, heading_color, text_color,
link_color, button_text_color, button_primary_bg, button_positive_bg, button_negative_bg, panel_bg, table_border_color
link_color, button_text_color, button_primary_bg, button_positive_bg, button_negative_bg, panel_bg, table_border_color,
site_name
FROM ` + BrandTable + ` WHERE id = 1`).Scan(&rows).Error
if err != nil {
return err
@@ -337,7 +350,7 @@ FROM ` + BrandTable + ` WHERE id = 1`).Scan(&rows).Error
BodyBg: r.BodyBg, ContentBg: r.ContentBg, HeaderColor: r.HeaderColor, FooterColor: r.FooterColor,
HeadingColor: r.HeadingColor, TextColor: r.TextColor, LinkColor: r.LinkColor, ButtonTextColor: r.ButtonTextColor,
ButtonPrimaryBg: r.ButtonPrimaryBg, ButtonPositiveBg: r.ButtonPositiveBg, ButtonNegativeBg: r.ButtonNegativeBg,
PanelBg: r.PanelBg, TableBorderColor: r.TableBorderColor,
PanelBg: r.PanelBg, TableBorderColor: r.TableBorderColor, SiteName: r.SiteName,
}
if r.LogoFileID == nil {
return nil