mirror of
https://github.com/knadh/listmonk.git
synced 2025-10-26 16:36:09 +08:00
Add sample visual campaign template on install and upgrade.
This commit is contained in:
parent
445d7e53a4
commit
ffbda019e4
4 changed files with 132 additions and 0 deletions
|
|
@ -221,6 +221,20 @@ func installTemplates(q *models.Queries) (int, int) {
|
|||
lo.Fatalf("error creating sample transactional template: %v", err)
|
||||
}
|
||||
|
||||
// Sample visual campaign template.
|
||||
visualTpl, err := fs.Get("/static/email-templates/default-visual.tpl")
|
||||
if err != nil {
|
||||
lo.Fatalf("error reading default visual template: %v", err)
|
||||
}
|
||||
visualSrc, err := fs.Get("/static/email-templates/default-visual.json")
|
||||
if err != nil {
|
||||
lo.Fatalf("error reading default visual template json: %v", err)
|
||||
}
|
||||
|
||||
if err := q.CreateTemplate.Get(&campTplID, "Sample visual template", models.TemplateTypeCampaignVisual, "", visualTpl.ReadBytes(), visualSrc.ReadBytes()); err != nil {
|
||||
lo.Fatalf("error creating default campaign template: %v", err)
|
||||
}
|
||||
|
||||
return campTplID, archiveTplID
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,5 +74,20 @@ func V5_0_0(db *sqlx.DB, fs stuffbin.FileSystem, ko *koanf.Koanf, lo *log.Logger
|
|||
return err
|
||||
}
|
||||
|
||||
// Insert visual campaign template.
|
||||
visualTpl, err := fs.Get("/static/email-templates/default-visual.tpl")
|
||||
if err != nil {
|
||||
lo.Fatalf("error reading default visual template: %v", err)
|
||||
}
|
||||
visualSrc, err := fs.Get("/static/email-templates/default-visual.json")
|
||||
if err != nil {
|
||||
lo.Fatalf("error reading default visual template json: %v", err)
|
||||
}
|
||||
|
||||
if _, err := db.Exec(`INSERT INTO templates (name, type, subject, body, body_source) VALUES($1, $2, $3, $4, $5)`,
|
||||
"Sample visual template", "campaign_visual", "", visualTpl.ReadBytes(), visualSrc.ReadBytes()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
66
static/email-templates/default-visual.json
Normal file
66
static/email-templates/default-visual.json
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
"root": {
|
||||
"type": "EmailLayout",
|
||||
"data": {
|
||||
"backdropColor": "#F5F5F5",
|
||||
"canvasColor": "#FFFFFF",
|
||||
"textColor": "#262626",
|
||||
"fontFamily": "MODERN_SANS",
|
||||
"childrenIds": [
|
||||
"block-1744970939431",
|
||||
"block-1744970976991",
|
||||
"block-1744971036169",
|
||||
"block-1744971054197"
|
||||
]
|
||||
}
|
||||
},
|
||||
"block-1744970939431": {
|
||||
"type": "Heading",
|
||||
"data": {
|
||||
"props": {
|
||||
"text": "Hello {{ .Subscriber.Name }}",
|
||||
"level": "h3"
|
||||
},
|
||||
"style": {
|
||||
"padding": { "top": 16, "bottom": 16, "right": 24, "left": 24 }
|
||||
}
|
||||
}
|
||||
},
|
||||
"block-1744970976991": {
|
||||
"type": "Text",
|
||||
"data": {
|
||||
"style": {
|
||||
"fontWeight": "normal",
|
||||
"padding": { "top": 16, "bottom": 16, "right": 24, "left": 24 }
|
||||
},
|
||||
"props": {
|
||||
"markdown": true,
|
||||
"text": "This is a test e-mail campaign. Your second name is {{ .Subscriber.LastName }} and this block of text is in Markdown.\n\nHere is a [tracked link](https://listmonk.app@TrackLink).\n\nUse the link icon in the editor toolbar or when writing raw HTML or Markdown, simply suffix @TrackLink to the end of a URL to turn it into a tracking link. Example:\n\n<a href=\"https://listmonk.app@TrackLink\"></a>\n\nFor help, refer to the [documentation](https://listmonk.app/docs)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"block-1744971036169": {
|
||||
"type": "Divider",
|
||||
"data": {
|
||||
"style": {
|
||||
"padding": { "top": 16,"right": 0, "bottom": 16, "left": 0 }
|
||||
},
|
||||
"props": {
|
||||
"lineColor": "#CCCCCC"
|
||||
}
|
||||
}
|
||||
},
|
||||
"block-1744971054197": {
|
||||
"type": "Button",
|
||||
"data": {
|
||||
"style": {
|
||||
"padding": { "top": 16, "bottom": 16, "right": 24, "left": 24 }
|
||||
},
|
||||
"props": {
|
||||
"buttonBackgroundColor": "#2563EB",
|
||||
"text": "This is a button",
|
||||
"url": "https://listmonk.app"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
static/email-templates/default-visual.tpl
Normal file
37
static/email-templates/default-visual.tpl
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<div style="background-color:#F5F5F5;color:#262626;font-family:"Helvetica Neue", "Arial Nova", "Nimbus Sans", Arial, sans-serif;font-size:16px;font-weight:400;letter-spacing:0.15008px;line-height:1.5;margin:0;padding:32px 0;min-height:100%;width:100%">
|
||||
<table align="center" width="100%" style="margin:0 auto;max-width:600px;background-color:#FFFFFF" role="presentation" cellSpacing="0" cellPadding="0" border="0">
|
||||
<tbody>
|
||||
<tr style="width:100%">
|
||||
<td>
|
||||
<h3 style="font-weight:bold;margin:0;font-size:20px;padding:16px 24px 16px 24px">Hello {{ .Subscriber.Name }}</h3>
|
||||
<div style="font-weight:normal;padding:16px 24px 16px 24px">
|
||||
<p>This is a test e-mail campaign. Your second name is {{ .Subscriber.LastName }} and this block of text is in Markdown.</p>
|
||||
<p>Here is a <a href="https://listmonk.app@TrackLink" target="_blank">tracked link</a>.</p>
|
||||
<p>Use the link icon in the editor toolbar or when writing raw HTML or Markdown, simply suffix @TrackLink to the end of a URL to turn it into a tracking link. Example:</p>
|
||||
<p><a href="https://listmonk.app@TrackLink"></a></p>
|
||||
<p>For help, refer to the <a href="https://listmonk.app/docs" target="_blank">documentation</a>.</p>
|
||||
</div>
|
||||
<div style="padding:16px 0px 16px 0px">
|
||||
<hr style="width:100%;border:none;border-top:1px solid #CCCCCC;margin:0"/>
|
||||
</div>
|
||||
<div style="padding:16px 24px 16px 24px">
|
||||
<a href="https://listmonk.app" style="color:#FFFFFF;font-size:16px;font-weight:bold;background-color:#0055d4;border-radius:4px;display:inline-block;padding:12px 20px;text-decoration:none" target="_blank">
|
||||
<span>
|
||||
<!--[if mso]><i style="letter-spacing: 20px;mso-font-width:-100%;mso-text-raise:30" hidden> </i><![endif]-->
|
||||
</span>
|
||||
<span>This is a button</span>
|
||||
<span>
|
||||
<!--[if mso]><i style="letter-spacing: 20px;mso-font-width:-100%" hidden> </i><![endif]-->
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Reference in a new issue