mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +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:
@@ -9,7 +9,7 @@
|
||||
{{range .Collaborators}}
|
||||
<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">
|
||||
|
@@ -31,7 +31,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<a href="{{$.Owner.HomeLink}}">
|
||||
{{avatar $.Context $.Owner}}
|
||||
{{ctx.AvatarUtils.Avatar $.Owner}}
|
||||
{{$.Owner.DisplayName}}
|
||||
</a>
|
||||
</td>
|
||||
|
@@ -55,7 +55,7 @@
|
||||
<div class="menu">
|
||||
{{range .Users}}
|
||||
<div class="item" data-value="{{.ID}}">
|
||||
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
|
||||
{{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
@@ -116,7 +116,7 @@
|
||||
<div class="menu">
|
||||
{{range .Users}}
|
||||
<div class="item" data-value="{{.ID}}">
|
||||
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
|
||||
{{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
@@ -206,7 +206,7 @@
|
||||
<div class="menu">
|
||||
{{range .Users}}
|
||||
<div class="item" data-value="{{.ID}}">
|
||||
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
|
||||
{{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
|
@@ -32,7 +32,7 @@
|
||||
<div class="menu">
|
||||
{{range .Users}}
|
||||
<div class="item" data-value="{{.ID}}">
|
||||
{{avatar $.Context . 28 "mini"}}{{template "repo/search_name" .}}
|
||||
{{ctx.AvatarUtils.Avatar . 28 "mini"}}{{template "repo/search_name" .}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
@@ -89,7 +89,7 @@
|
||||
{{$userIDs := .AllowlistUserIDs}}
|
||||
{{range $.Users}}
|
||||
{{if SliceUtils.Contains $userIDs .ID}}
|
||||
<a class="ui basic label" href="{{.HomeLink}}">{{avatar $.Context . 26}} {{.GetDisplayName}}</a>
|
||||
<a class="ui basic label" href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 26}} {{.GetDisplayName}}</a>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{if $.Owner.IsOrganization}}
|
||||
|
Reference in New Issue
Block a user