feat(postcard): mail partials, built-in layouts and layout and partial overrides
- pact.HasMailPartials: plugins declare <plugin>::mail.partials.<name>,
loaded from views/mail/partials/<name>.htm; HasMailTemplates is unchanged
- bodies and layouts call {{ partial "name" "key" value ... }}; a call in a
Markdown body leaves a per-render random token swapped after goldmark, so
raw HTML stays disabled for bodies
- built-in partials button, panel, table and subcopy, built-in layouts
system and minimal next to the unchanged default, reachable by alias
after a plugin's own aliases
- NewDBSource also reads customized and database-only layouts and
customized partials; a layout's CSS goes before mail.css
Plan 35-01, task 3.
This commit is contained in:
14
modules/postcard/assets/minimal.htm
Normal file
14
modules/postcard/assets/minimal.htm
Normal file
@@ -0,0 +1,14 @@
|
||||
name = "Minimal"
|
||||
==
|
||||
{{ .Content }}
|
||||
==
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<style type="text/css">{{ .brandCss }}{{ .css }}</style>
|
||||
</head>
|
||||
<body>
|
||||
{{ .Content }}
|
||||
</body>
|
||||
</html>
|
||||
17
modules/postcard/assets/partials/button.htm
Normal file
17
modules/postcard/assets/partials/button.htm
Normal file
@@ -0,0 +1,17 @@
|
||||
name = "Button"
|
||||
==
|
||||
{{ .body }}{{ with .url }} <{{ . }}>{{ end }}
|
||||
==
|
||||
<table class="action" align="center" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table border="0" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<a href="{{ .url }}" class="button button-{{ if .type }}{{ .type }}{{ else }}primary{{ end }}" target="_blank">{{ .body }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
17
modules/postcard/assets/partials/panel.htm
Normal file
17
modules/postcard/assets/partials/panel.htm
Normal file
@@ -0,0 +1,17 @@
|
||||
name = "Panel"
|
||||
==
|
||||
{{ .body }}
|
||||
==
|
||||
<table class="panel break-all" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="panel-content">
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="panel-item">
|
||||
{{ markdown .body }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
12
modules/postcard/assets/partials/subcopy.htm
Normal file
12
modules/postcard/assets/partials/subcopy.htm
Normal file
@@ -0,0 +1,12 @@
|
||||
name = "Subcopy"
|
||||
==
|
||||
-----
|
||||
{{ .body }}
|
||||
==
|
||||
<table class="subcopy" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
{{ markdown .body }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
7
modules/postcard/assets/partials/table.htm
Normal file
7
modules/postcard/assets/partials/table.htm
Normal file
@@ -0,0 +1,7 @@
|
||||
name = "Table"
|
||||
==
|
||||
{{ .body }}
|
||||
==
|
||||
<div class="table">
|
||||
{{ markdown .body }}
|
||||
</div>
|
||||
38
modules/postcard/assets/system.htm
Normal file
38
modules/postcard/assets/system.htm
Normal file
@@ -0,0 +1,38 @@
|
||||
name = "System layout"
|
||||
==
|
||||
{{ .Content }}
|
||||
|
||||
|
||||
---
|
||||
This is an automatic message. Please do not reply to it.
|
||||
==
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<style type="text/css">{{ .brandCss }}{{ .css }}</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="wrapper layout-system" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<table class="content" width="100%" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="body" width="100%" cellpadding="0" cellspacing="0">
|
||||
<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<td class="content-cell">
|
||||
{{ .Content }}
|
||||
{{ partial "subcopy" "body" "**This is an automatic message. Please do not reply to it.**" }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user