diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-08-10 11:19:39 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-10 11:19:39 +0800 |
commit | a370efc13f0e1ea309e324639832832bc14cb6dc (patch) | |
tree | 3c408cf225a4ffcc49f257fabf162831c92e23bf /modules/context | |
parent | 36eb3c433ae384f21beec63eb648141fb9dba676 (diff) | |
download | gitea-a370efc13f0e1ea309e324639832832bc14cb6dc.tar.gz gitea-a370efc13f0e1ea309e324639832832bc14cb6dc.zip |
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.
Diffstat (limited to 'modules/context')
-rw-r--r-- | modules/context/context.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/context/context.go b/modules/context/context.go index b75ba9ab67..98c1a9bdb6 100644 --- a/modules/context/context.go +++ b/modules/context/context.go @@ -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 |