24 lines
436 B
Go
24 lines
436 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
"text/template"
|
||
|
|
||
|
"git.agecem.com/bottin/agendas/ui"
|
||
|
"github.com/labstack/echo/v4"
|
||
|
)
|
||
|
|
||
|
type Renderer struct {
|
||
|
templates *template.Template
|
||
|
}
|
||
|
|
||
|
func (t *Renderer) Render(w io.Writer, name string, data any, c echo.Context) error {
|
||
|
return t.templates.ExecuteTemplate(w, name, data)
|
||
|
}
|
||
|
|
||
|
func NewRenderer() *Renderer {
|
||
|
return &Renderer{
|
||
|
templates: template.Must(template.ParseFS(ui.HTMLFS(), "*html")),
|
||
|
}
|
||
|
}
|