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:
@@ -1745,6 +1745,7 @@ func partialUsage(code, sections string) string {
|
||||
type MailBrandSetting struct {
|
||||
ID uint `gorm:"column:id;primaryKey"`
|
||||
LogoFileID *uint `gorm:"column:logo_file_id"`
|
||||
SiteName string `gorm:"column:site_name"`
|
||||
BodyBg string `gorm:"column:body_bg"`
|
||||
ContentBg string `gorm:"column:content_bg"`
|
||||
HeaderColor string `gorm:"column:header_color"`
|
||||
@@ -1766,7 +1767,7 @@ func (MailBrandSetting) TableName() string { return postcard.BrandTable }
|
||||
|
||||
func (MailBrandSetting) Fillable() []string {
|
||||
return []string{
|
||||
"logo_file_id", "body_bg", "content_bg", "header_color", "footer_color",
|
||||
"logo_file_id", "site_name", "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",
|
||||
@@ -1776,6 +1777,7 @@ func (MailBrandSetting) Fillable() []string {
|
||||
func (MailBrandSetting) Rules() map[string]string {
|
||||
return map[string]string{
|
||||
"logo_file_id": "nullable",
|
||||
"site_name": "nullable|max:255",
|
||||
"body_bg": "nullable",
|
||||
"content_bg": "nullable",
|
||||
"header_color": "nullable",
|
||||
@@ -1794,9 +1796,10 @@ func (MailBrandSetting) Rules() map[string]string {
|
||||
|
||||
var brandColourPattern = regexp.MustCompile(`^#[0-9a-f]{6}$`)
|
||||
|
||||
// BeforeValidate lower-cases colours, refuses anything but #rrggbb or empty,
|
||||
// and checks logo_file_id is null or a library image.
|
||||
// BeforeValidate trims the site name, lower-cases colours, refuses anything
|
||||
// but #rrggbb or empty, and checks logo_file_id is null or a library image.
|
||||
func (b *MailBrandSetting) BeforeValidate(tx *gorm.DB) error {
|
||||
b.SiteName = strings.TrimSpace(b.SiteName)
|
||||
details := map[string]any{}
|
||||
for _, col := range []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user