commit 2d41aa2205f3d8475bce287696049d9fab401226
parent 296f9232f0a02e4cd6b39477621c2189b388e7ba
Author: n0tr1v <n0tr1v@protonmail.com>
Date: Wed, 15 Nov 2023 15:12:43 -0500
Add reverse to the context
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/pkg/template/templates.go b/pkg/template/templates.go
@@ -61,6 +61,7 @@ type templateDataStruct struct {
WallpaperImg string
IsAprilFool2023 bool
GitURL string
+ Reverse func(string, ...any) string
}
// Render render a template
@@ -77,6 +78,7 @@ func (t *Templates) Render(w io.Writer, name string, data any, c echo.Context) e
if config.Development.IsTrue() {
d.VERSION += utils.FormatInt64(time.Now().Unix())
}
+ d.Reverse = c.Echo().Reverse // {{ call .Reverse "name" }} || {{ call .Reverse "name" "params" }}
d.Bundle = c.Get("bundle").(*i18n.Bundle)
//d.SHA = config.Global.Sha()
d.VersionHTML = template.HTML(fmt.Sprintf("<!-- VERSION: %s -->", config.Global.GetVersion().Original()))