Skip to content

Commit

Permalink
Convert app version to a function in templates
Browse files Browse the repository at this point in the history
Signed-off-by: Jo Vandeginste <[email protected]>
  • Loading branch information
jovandeginste committed Apr 9, 2024
1 parent 1ae4c02 commit 7183d05
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion pkg/app/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func (a *App) getCurrentUser(c echo.Context) *database.User {

func (a *App) defaultData(c echo.Context) map[string]interface{} {
data := map[string]interface{}{}
data["version"] = a.Version
data["RegistrationDisabled"] = a.Config.RegistrationDisabled
data["SocialsDisabled"] = a.Config.SocialsDisabled

Expand Down
1 change: 1 addition & 0 deletions pkg/app/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func (a *App) viewTemplateFunctions() template.FuncMap {

return template.FuncMap{
"i18n": echoFunc,
"Version": func() *Version { return &a.Version },
"language": func() string { return BrowserLanguage },
"humanizer": func() *humanize.Humanizer { return h },
"CurrentUser": func() *database.User { return nil },
Expand Down
2 changes: 1 addition & 1 deletion views/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ define "footer" }}
<div class="footer">
<div>
Workout Tracker{{ with .version }},
Workout Tracker{{ with Version }},
<a
target="_blank"
title="Build time: {{ .BuildTime }}"
Expand Down

0 comments on commit 7183d05

Please sign in to comment.