From c96de8d11fc15e6e85fff150190e19de1589adef Mon Sep 17 00:00:00 2001 From: Kailash Nadh Date: Fri, 2 Nov 2018 13:19:18 +0530 Subject: [PATCH] Refactor template previewing with better dummy data --- templates.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/templates.go b/templates.go index c9b71e6..220c61d 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: "dummy-campaign@listmonk.app", + 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)) }