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 /templates/org | |
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 'templates/org')
-rw-r--r-- | templates/org/header.tmpl | 2 | ||||
-rw-r--r-- | templates/org/home.tmpl | 4 | ||||
-rw-r--r-- | templates/org/member/members.tmpl | 2 | ||||
-rw-r--r-- | templates/org/team/invite.tmpl | 2 | ||||
-rw-r--r-- | templates/org/team/members.tmpl | 2 | ||||
-rw-r--r-- | templates/org/team/teams.tmpl | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/templates/org/header.tmpl b/templates/org/header.tmpl index 6106fe5d2b..9348e14544 100644 --- a/templates/org/header.tmpl +++ b/templates/org/header.tmpl @@ -3,7 +3,7 @@ <div class="ui vertically grid head"> <div class="column"> <div class="ui header"> - {{avatar $.Context . 100}} + {{ctx.AvatarUtils.Avatar . 100}} <span class="text thin grey"><a href="{{.HomeLink}}">{{.DisplayName}}</a></span> <span class="org-visibility"> {{if .Visibility.IsLimited}}<div class="ui medium basic horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}} diff --git a/templates/org/home.tmpl b/templates/org/home.tmpl index 445df520a9..766dd5b7a6 100644 --- a/templates/org/home.tmpl +++ b/templates/org/home.tmpl @@ -1,7 +1,7 @@ {{template "base/head" .}} <div role="main" aria-label="{{.Title}}" class="page-content organization profile"> <div class="ui container gt-df"> - {{avatar $.Context .Org 140 "org-avatar"}} + {{ctx.AvatarUtils.Avatar .Org 140 "org-avatar"}} <div id="org-info"> <div class="ui header gt-df gt-fw"> {{.Org.DisplayName}} @@ -61,7 +61,7 @@ {{$isMember := .IsOrganizationMember}} {{range .Members}} {{if or $isMember (call $.IsPublicMember .ID)}} - <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}">{{avatar $.Context . 48}}</a> + <a href="{{.HomeLink}}" title="{{.Name}}{{if .FullName}} ({{.FullName}}){{end}}">{{ctx.AvatarUtils.Avatar . 48}}</a> {{end}} {{end}} </div> diff --git a/templates/org/member/members.tmpl b/templates/org/member/members.tmpl index 13b7d964f7..a15254d041 100644 --- a/templates/org/member/members.tmpl +++ b/templates/org/member/members.tmpl @@ -9,7 +9,7 @@ {{$isPublic := index $.MembersIsPublicMember .ID}} <div class="flex-item {{if $.PublicOnly}}flex-item-center{{end}}"> <div class="flex-item-leading"> - <a href="{{.HomeLink}}">{{avatar $.Context . 48}}</a> + <a href="{{.HomeLink}}">{{ctx.AvatarUtils.Avatar . 48}}</a> </div> <div class="flex-item-main"> <div class="flex-item-title"> diff --git a/templates/org/team/invite.tmpl b/templates/org/team/invite.tmpl index 55ecd049b3..60332a5f40 100644 --- a/templates/org/team/invite.tmpl +++ b/templates/org/team/invite.tmpl @@ -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> diff --git a/templates/org/team/members.tmpl b/templates/org/team/members.tmpl index a73eb7bbd3..13c60d3945 100644 --- a/templates/org/team/members.tmpl +++ b/templates/org/team/members.tmpl @@ -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"> diff --git a/templates/org/team/teams.tmpl b/templates/org/team/teams.tmpl index 9a7dae8f32..a96dd7d6be 100644 --- a/templates/org/team/teams.tmpl +++ b/templates/org/team/teams.tmpl @@ -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"> |