mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-16 20:00:03 +02:00
Use template context function for avatar rendering (#26385)
Introduce `AvatarUtils`, no need to pass `$.Context` to every sub-template, and simplify the template helper functions.
This commit is contained in:
parent
36eb3c433a
commit
a370efc13f
54 changed files with 162 additions and 155 deletions
|
@ -141,6 +141,7 @@ func Contexter() func(next http.Handler) http.Handler {
|
|||
// TODO: "install.go" also shares the same logic, which should be refactored to a general function
|
||||
ctx.TemplateContext = NewTemplateContext(ctx)
|
||||
ctx.TemplateContext["Locale"] = ctx.Locale
|
||||
ctx.TemplateContext["AvatarUtils"] = templates.NewAvatarUtils(ctx)
|
||||
|
||||
ctx.Data.MergeFrom(middleware.CommonTemplateContextData())
|
||||
ctx.Data["Context"] = ctx // TODO: use "ctx" in template and remove this
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue