Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Refactor template previewing with better dummy data

Kailash Nadhc96de8d11fc1
diff --git a/templates.go b/templates.go
index c9b71e64..220c61d5 100644
--- a/templates.go
+++ b/templates.go
@@ -98,7 +98,15 @@ func handlePreviewTemplate(c echo.Context) error {
}
// Compile the template.
- camp := models.Campaign{TemplateBody: body, Body: dummyTpl}
+ camp := models.Campaign{
+ UUID: "00000000-0000-0000-0000-000000000000",
+ Name: "Dummy Campaign",
+ Subject: "Dummy Campaign Subject",
+ FromEmail: "[email protected]",
+ TemplateBody: body,
+ Body: dummyTpl,
+ }
+
if err := camp.CompileTemplate(app.Runner.TemplateFuncs(&camp)); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Error compiling template: %v", err))
}