1
1
mirror of https://github.com/go-gitea/gitea synced 2025-08-06 01:28:20 +00: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:
wxiaoguang
2023-08-10 11:19:39 +08:00
committed by GitHub
parent 36eb3c433a
commit a370efc13f
54 changed files with 162 additions and 155 deletions

View File

@@ -4,7 +4,7 @@
{{template "base/alert" .}}
<div class="ui centered card">
<div class="image">
{{avatar $.Context .Organization 140}}
{{ctx.AvatarUtils.Avatar .Organization 140}}
</div>
<div class="content">
<div class="header">{{.locale.Tr "org.teams.invite.title" .Team.Name .Organization.Name | Str2html}}</div>

View File

@@ -26,7 +26,7 @@
{{range .Team.Members}}
<div class="flex-item flex-item-center">
<div class="flex-item-leading">
<a href="{{.HomeLink}}">{{avatar $.Context . 32}}</a>
<a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 32}}</a>
</div>
<div class="flex-item-main">
<div class="flex-item-title">

View File

@@ -32,7 +32,7 @@
</div>
<div class="ui attached segment members">
{{range .Members}}
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .}}
{{template "shared/user/avatarlink" dict "user" .}}
{{end}}
</div>
<div class="ui bottom attached header">