Refactor template previewing with better dummy data

This commit is contained in:
Kailash Nadh 2018-11-02 13:19:18 +05:30
parent 027bc02a83
commit c96de8d11f
1 changed files with 9 additions and 1 deletions

View File

@ -98,7 +98,15 @@ func handlePreviewTemplate(c echo.Context) error {
} }
// Compile the template. // 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 { if err := camp.CompileTemplate(app.Runner.TemplateFuncs(&camp)); err != nil {
return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Error compiling template: %v", err)) return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Error compiling template: %v", err))
} }