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
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
54 changed files with 162 additions and 155 deletions

View file

@ -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

View file

@ -53,10 +53,7 @@ func NewFuncMap() template.FuncMap {
// -----------------------------------------------------------------
// svg / avatar / icon
"svg": svg.RenderHTML,
"avatar": Avatar,
"avatarHTML": AvatarHTML,
"avatarByAction": AvatarByAction,
"avatarByEmail": AvatarByEmail,
"EntryIcon": base.EntryIcon,
"MigrationIcon": MigrationIcon,
"ActionIcon": ActionIcon,

View file

@ -18,6 +18,14 @@ import (
"code.gitea.io/gitea/modules/setting"
)
type AvatarUtils struct {
ctx context.Context
}
func NewAvatarUtils(ctx context.Context) *AvatarUtils {
return &AvatarUtils{ctx: ctx}
}
// AvatarHTML creates the HTML for an avatar
func AvatarHTML(src string, size int, class, name string) template.HTML {
sizeStr := fmt.Sprintf(`%d`, size)
@ -30,44 +38,44 @@ func AvatarHTML(src string, size int, class, name string) template.HTML {
}
// Avatar renders user avatars. args: user, size (int), class (string)
func Avatar(ctx context.Context, item any, others ...any) template.HTML {
func (au *AvatarUtils) Avatar(item any, others ...any) template.HTML {
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, avatars.DefaultAvatarClass, others...)
switch t := item.(type) {
case *user_model.User:
src := t.AvatarLinkWithSize(ctx, size*setting.Avatar.RenderedSizeFactor)
src := t.AvatarLinkWithSize(au.ctx, size*setting.Avatar.RenderedSizeFactor)
if src != "" {
return AvatarHTML(src, size, class, t.DisplayName())
}
case *repo_model.Collaborator:
src := t.AvatarLinkWithSize(ctx, size*setting.Avatar.RenderedSizeFactor)
src := t.AvatarLinkWithSize(au.ctx, size*setting.Avatar.RenderedSizeFactor)
if src != "" {
return AvatarHTML(src, size, class, t.DisplayName())
}
case *organization.Organization:
src := t.AsUser().AvatarLinkWithSize(ctx, size*setting.Avatar.RenderedSizeFactor)
src := t.AsUser().AvatarLinkWithSize(au.ctx, size*setting.Avatar.RenderedSizeFactor)
if src != "" {
return AvatarHTML(src, size, class, t.AsUser().DisplayName())
}
}
return template.HTML("")
return ""
}
// AvatarByAction renders user avatars from action. args: action, size (int), class (string)
func AvatarByAction(ctx context.Context, action *activities_model.Action, others ...any) template.HTML {
action.LoadActUser(ctx)
return Avatar(ctx, action.ActUser, others...)
func (au *AvatarUtils) AvatarByAction(action *activities_model.Action, others ...any) template.HTML {
action.LoadActUser(au.ctx)
return au.Avatar(action.ActUser, others...)
}
// AvatarByEmail renders avatars by email address. args: email, name, size (int), class (string)
func AvatarByEmail(ctx context.Context, email, name string, others ...any) template.HTML {
func (au *AvatarUtils) AvatarByEmail(email, name string, others ...any) template.HTML {
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, avatars.DefaultAvatarClass, others...)
src := avatars.GenerateEmailAvatarFastLink(ctx, email, size*setting.Avatar.RenderedSizeFactor)
src := avatars.GenerateEmailAvatarFastLink(au.ctx, email, size*setting.Avatar.RenderedSizeFactor)
if src != "" {
return AvatarHTML(src, size, class, name)
}
return template.HTML("")
return ""
}

View file

@ -235,6 +235,7 @@ func renderBlame(ctx *context.Context, blameParts []git.BlamePart, commitNames m
var lexerName string
avatarUtils := templates.NewAvatarUtils(ctx)
i := 0
commitCnt := 0
for _, part := range blameParts {
@ -257,9 +258,9 @@ func renderBlame(ctx *context.Context, blameParts []git.BlamePart, commitNames m
var avatar string
if commit.User != nil {
avatar = string(templates.Avatar(ctx, commit.User, 18, "gt-mr-3"))
avatar = string(avatarUtils.Avatar(commit.User, 18, "gt-mr-3"))
} else {
avatar = string(templates.AvatarByEmail(ctx, commit.Author.Email, commit.Author.Name, 18, "gt-mr-3"))
avatar = string(avatarUtils.AvatarByEmail(commit.Author.Email, commit.Author.Name, 18, "gt-mr-3"))
}
br.Avatar = gotemplate.HTML(avatar)

View file

@ -57,7 +57,7 @@
{{if and .IsSigned .MustChangePassword}}
<div class="ui dropdown jump item" data-tooltip-content="{{.locale.Tr "user_profile_and_more"}}">
<span class="text gt-df gt-ac">
{{avatar $.Context .SignedUser 24 "gt-mr-2"}}
{{ctx.AvatarUtils.Avatar .SignedUser 24 "gt-mr-2"}}
<span class="mobile-only gt-ml-3">{{.SignedUser.Name}}</span>
<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
</span>
@ -143,7 +143,7 @@
<div class="ui dropdown jump item gt-mx-0 gt-pr-3" data-tooltip-content="{{.locale.Tr "user_profile_and_more"}}">
<span class="text gt-df gt-ac">
{{avatar $.Context .SignedUser 24 "gt-mr-2"}}
{{ctx.AvatarUtils.Avatar .SignedUser 24 "gt-mr-2"}}
<span class="mobile-only gt-ml-3">{{.SignedUser.Name}}</span>
<span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
</span>

View file

@ -8,7 +8,7 @@
{{range .Users}}
<div class="flex-item flex-item-center">
<div class="flex-item-leading">
{{avatar $.Context . 48}}
{{ctx.AvatarUtils.Avatar . 48}}
</div>
<div class="flex-item-main">
<div class="flex-item-title">

View file

@ -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}}

View file

@ -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>

View file

@ -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">

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">

View file

@ -234,7 +234,7 @@
{{end}}
<div class="right floated">
{{range .Assignees}}
<a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{avatar $.Context . 28 "mini gt-mr-3"}}</a>
<a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28 "mini gt-mr-3"}}</a>
{{end}}
</div>
</div>

View file

@ -33,7 +33,7 @@
</a>
{{range .Actors}}
<a class="item{{if eq .ID $.CurActor}} active{{end}}" href="{{$.Link}}?workflow={{$.CurWorkflow}}&actor={{.ID}}&status={{$.CurStatus}}">
{{avatar $.Context . 20}} {{.GetDisplayName}}
{{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}}
</a>
{{end}}
</div>

View file

@ -27,7 +27,7 @@
<button class="btn interact-fg gt-p-3" data-clipboard-text="{{.DefaultBranchBranch.DBBranch.Name}}">{{svg "octicon-copy" 14}}</button>
{{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DefaultBranchBranch.DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DefaultBranchBranch.DBBranch.CommitID)}}
</div>
<p class="info gt-df gt-ac gt-my-2">{{svg "octicon-git-commit" 16 "gt-mr-2"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DefaultBranchBranch.DBBranch.CommitMessage .RepoLink .Repository.ComposeMetas}}</span> · {{.locale.Tr "org.repo_updated"}} {{TimeSince .DefaultBranchBranch.DBBranch.CommitTime.AsTime .locale}}{{if .DefaultBranchBranch.DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "Context" $.Context "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p>
<p class="info gt-df gt-ac gt-my-2">{{svg "octicon-git-commit" 16 "gt-mr-2"}}<a href="{{.RepoLink}}/commit/{{PathEscape .DefaultBranchBranch.DBBranch.CommitID}}">{{ShortSha .DefaultBranchBranch.DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DefaultBranchBranch.DBBranch.CommitMessage .RepoLink .Repository.ComposeMetas}}</span> · {{.locale.Tr "org.repo_updated"}} {{TimeSince .DefaultBranchBranch.DBBranch.CommitTime.AsTime .locale}}{{if .DefaultBranchBranch.DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DefaultBranchBranch.DBBranch.Pusher}}{{template "shared/user/namelink" .DefaultBranchBranch.DBBranch.Pusher}}{{end}}</p>
</td>
<td class="right aligned middle aligned overflow-visible">
{{if and $.IsWriter (not $.Repository.IsArchived) (not .IsDeleted)}}
@ -94,7 +94,7 @@
<button class="btn interact-fg gt-p-3" data-clipboard-text="{{.DBBranch.Name}}">{{svg "octicon-copy" 14}}</button>
{{template "repo/commit_statuses" dict "Status" (index $.CommitStatus .DBBranch.CommitID) "Statuses" (index $.CommitStatuses .DBBranch.CommitID)}}
</div>
<p class="info gt-df gt-ac gt-my-2">{{svg "octicon-git-commit" 16 "gt-mr-2"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DBBranch.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.locale.Tr "org.repo_updated"}} {{TimeSince .DBBranch.CommitTime.AsTime $.locale}}{{if .DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "Context" $.Context "user" .DBBranch.Pusher}} &nbsp;{{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p>
<p class="info gt-df gt-ac gt-my-2">{{svg "octicon-git-commit" 16 "gt-mr-2"}}<a href="{{$.RepoLink}}/commit/{{PathEscape .DBBranch.CommitID}}">{{ShortSha .DBBranch.CommitID}}</a> · <span class="commit-message">{{RenderCommitMessage $.Context .DBBranch.CommitMessage $.RepoLink $.Repository.ComposeMetas}}</span> · {{$.locale.Tr "org.repo_updated"}} {{TimeSince .DBBranch.CommitTime.AsTime $.locale}}{{if .DBBranch.Pusher}} &nbsp;{{template "shared/user/avatarlink" dict "user" .DBBranch.Pusher}} &nbsp;{{template "shared/user/namelink" .DBBranch.Pusher}}{{end}}</p>
{{end}}
</td>
<td class="two wide ui">

View file

@ -142,24 +142,24 @@
<div class="ui attached segment gt-df gt-ac gt-sb gt-py-2 commit-header-row gt-fw {{$class}}">
<div class="gt-df gt-ac author">
{{if .Author}}
{{avatar $.Context .Author 28 "gt-mr-3"}}
{{ctx.AvatarUtils.Avatar .Author 28 "gt-mr-3"}}
{{if .Author.FullName}}
<a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
{{else}}
<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
{{end}}
{{else}}
{{avatarByEmail $.Context .Commit.Author.Email .Commit.Author.Email 28 "gt-mr-3"}}
{{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 28 "gt-mr-3"}}
<strong>{{.Commit.Author.Name}}</strong>
{{end}}
<span class="text grey gt-ml-3" id="authored-time">{{TimeSince .Commit.Author.When $.locale}}</span>
{{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
<span class="text grey gt-mx-3">{{.locale.Tr "repo.diff.committed_by"}}</span>
{{if ne .Verification.CommittingUser.ID 0}}
{{avatar $.Context .Verification.CommittingUser 28 "gt-mx-3"}}
{{ctx.AvatarUtils.Avatar .Verification.CommittingUser 28 "gt-mx-3"}}
<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
{{else}}
{{avatarByEmail $.Context .Commit.Committer.Email .Commit.Committer.Name 28 "gt-mr-3"}}
{{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 28 "gt-mr-3"}}
<strong>{{.Commit.Committer.Name}}</strong>
{{end}}
{{end}}
@ -196,12 +196,12 @@
{{else}}
<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}:</span>
{{end}}
{{avatar $.Context .Verification.SigningUser 28 "gt-mr-3"}}
{{ctx.AvatarUtils.Avatar .Verification.SigningUser 28 "gt-mr-3"}}
<a href="{{.Verification.SigningUser.HomeLink}}"><strong>{{.Verification.SigningUser.GetDisplayName}}</strong></a>
{{else}}
<span title="{{.locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog" 16 "gt-mr-3"}}</span>
<span class="ui text gt-mr-3">{{.locale.Tr "repo.commits.signed_by"}}:</span>
{{avatarByEmail $.Context .Verification.SigningEmail "" 28}}
{{ctx.AvatarUtils.AvatarByEmail .Verification.SigningEmail "" 28}}
<strong>{{.Verification.SigningUser.GetDisplayName}}</strong>
{{end}}
{{else}}

View file

@ -18,9 +18,9 @@
{{if .User.FullName}}
{{$userName = .User.FullName}}
{{end}}
{{avatar $.Context .User 28 "gt-mr-2"}}<a href="{{.User.HomeLink}}">{{$userName}}</a>
{{ctx.AvatarUtils.Avatar .User 28 "gt-mr-2"}}<a href="{{.User.HomeLink}}">{{$userName}}</a>
{{else}}
{{avatarByEmail $.Context .Author.Email .Author.Name 28 "gt-mr-2"}}
{{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 28 "gt-mr-2"}}
{{$userName}}
{{end}}
</td>

View file

@ -6,9 +6,9 @@
<div class="singular-commit" id="{{$tag}}">
<span class="badge badge-commit">{{svg "octicon-git-commit"}}</span>
{{if .User}}
<a class="avatar" href="{{.User.HomeLink}}">{{avatar $.root.Context .User}}</a>
<a class="avatar" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User}}</a>
{{else}}
{{avatarByEmail $.root.Context .Author.Email .Author.Name}}
{{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name}}
{{end}}
{{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}}

View file

@ -21,18 +21,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}">
{{avatar $.Context .SignedUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context . 28 "mini"}}
{{ctx.AvatarUtils.Avatar . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -5,7 +5,7 @@
{{if .OriginalAuthor}}
<span class="avatar"><img src="{{AppSubUrl}}/assets/img/avatar_default.png"></span>
{{else}}
{{template "shared/user/avatarlink" dict "Context" $.root.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
{{end}}
<div class="content comment-container">
<div class="ui top attached header comment-header gt-df gt-ac gt-sb">

View file

@ -1,5 +1,5 @@
<div class="commit-form-wrapper">
{{avatar $.Context .SignedUser 48 "commit-avatar"}}
{{ctx.AvatarUtils.Avatar .SignedUser 48 "commit-avatar"}}
<div class="commit-form">
<h3>{{- if .CanCommitToBranch.WillSign}}
<span title="{{.locale.Tr "repo.signing.will_sign" .CanCommitToBranch.SigningKey}}">{{svg "octicon-lock" 24}}</span>

View file

@ -7,7 +7,7 @@
</h2>
{{range .Forks}}
<div class="gt-df gt-ac gt-py-3">
<span class="gt-mr-2">{{avatar $.Context .Owner}}</span>
<span class="gt-mr-2">{{ctx.AvatarUtils.Avatar .Owner}}</span>
<a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a> / <a href="{{.Link}}">{{.Name}}</a>
</div>
{{end}}

View file

@ -64,10 +64,10 @@
{{if $commit.User.FullName}}
{{$userName = $commit.User.FullName}}
{{end}}
<span class="gt-mr-2">{{avatar $.Context $commit.User}}</span>
<span class="gt-mr-2">{{ctx.AvatarUtils.Avatar $commit.User}}</span>
<a href="{{$commit.User.HomeLink}}">{{$userName}}</a>
{{else}}
<span class="gt-mr-2">{{avatarByEmail $.Context $commit.Commit.Author.Email $userName}}</span>
<span class="gt-mr-2">{{ctx.AvatarUtils.AvatarByEmail $commit.Commit.Author.Email $userName}}</span>
{{$userName}}
{{end}}
</span>

View file

@ -146,7 +146,7 @@
<div class="divider"></div>
{{range .Assignees}}
<a class="{{if eq $.AssigneeID .ID}}active selected{{end}} item gt-df" href="{{$.Link}}?type={{$.ViewType}}&sort={{$.SortType}}&state={{$.State}}&labels={{$.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{.ID}}&poster={{$.PosterID}}">
{{avatar $.Context . 20}}{{template "repo/search_name" .}}
{{ctx.AvatarUtils.Avatar . 20}}{{template "repo/search_name" .}}
</a>
{{end}}
</div>

View file

@ -56,7 +56,7 @@
{{end}}
<div class="right floated">
{{range .Assignees}}
<a href="{{.HomeLink}}" data-tooltip-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{avatar $.Context . 28 "mini gt-mr-3"}}</a>
<a href="{{.HomeLink}}" data-tooltip-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28 "mini gt-mr-3"}}</a>
{{end}}
</div>
</div>
@ -208,7 +208,7 @@
</div>
{{range .Assignees}}
<div class="item issue-action" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/assignee">
{{avatar $.Context . 20}} {{.GetDisplayName}}
{{ctx.AvatarUtils.Avatar . 20}} {{.GetDisplayName}}
</div>
{{end}}
</div>

View file

@ -8,7 +8,7 @@
<div class="issue-content-left">
<div class="ui comments">
<div class="comment">
{{avatar $.Context .SignedUser 40}}
{{ctx.AvatarUtils.Avatar .SignedUser 40}}
<div class="ui segment content gt-my-0">
<div class="field">
<input name="title" id="issue_title" placeholder="{{.locale.Tr "repo.milestones.title"}}" value="{{if .TitleQuery}}{{.TitleQuery}}{{else if .IssueTemplateTitle}}{{.IssueTemplateTitle}}{{else}}{{.title}}{{end}}" tabindex="3" autofocus required maxlength="255" autocomplete="off">
@ -160,7 +160,7 @@
<a class="item muted" href="#" data-id="{{.ID}}" data-id-selector="#assignee_{{.ID}}">
<span class="octicon-check invisible">{{svg "octicon-check"}}</span>
<span class="text">
{{avatar $.Context . 28 "gt-mr-3"}}{{template "repo/search_name" .}}
{{ctx.AvatarUtils.Avatar . 28 "gt-mr-3"}}{{template "repo/search_name" .}}
</span>
</a>
{{end}}
@ -173,7 +173,7 @@
<div class="selected">
{{range .Assignees}}
<a class="item gt-p-2 muted gt-hidden" id="assignee_{{.ID}}" href="{{$.RepoLink}}/issues?assignee={{.ID}}">
{{avatar $.Context . 28 "gt-mr-3 gt-vm"}}{{.GetDisplayName}}
{{ctx.AvatarUtils.Avatar . 28 "gt-mr-3 gt-vm"}}{{.GetDisplayName}}
</a>
{{end}}
</div>

View file

@ -16,7 +16,7 @@
</span>
{{else}}
<a class="timeline-avatar" {{if gt .Issue.Poster.ID 0}}href="{{.Issue.Poster.HomeLink}}"{{end}}>
{{avatar $.Context .Issue.Poster 40}}
{{ctx.AvatarUtils.Avatar .Issue.Poster 40}}
</a>
{{end}}
<div class="content comment-container">
@ -35,7 +35,7 @@
</span>
{{else}}
<a class="inline-timeline-avatar" href="{{.Issue.Poster.HomeLink}}">
{{avatar $.Context .Issue.Poster 24}}
{{ctx.AvatarUtils.Avatar .Issue.Poster 24}}
</a>
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Issue.Poster}}
@ -93,7 +93,7 @@
{{if and (or .IsRepoAdmin .HasIssuesOrPullsWritePermission (not .Issue.IsLocked)) (not .Repository.IsArchived)}}
<div class="timeline-item comment form">
<a class="timeline-avatar" href="{{.SignedUser.HomeLink}}">
{{avatar $.Context .SignedUser 40}}
{{ctx.AvatarUtils.Avatar .SignedUser 40}}
</a>
<div class="content">
<form class="ui segment form form-fetch-action" id="comment-form" action="{{$.RepoLink}}/issues/{{.Issue.Index}}/comments" method="post">

View file

@ -20,7 +20,7 @@
</span>
{{else}}
<a class="timeline-avatar"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
{{avatar $.Context .Poster 40}}
{{ctx.AvatarUtils.Avatar .Poster 40}}
</a>
{{end}}
<div class="content comment-container">
@ -40,7 +40,7 @@
{{else}}
{{if gt .Poster.ID 0}}
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
{{avatar $.Context .Poster 24}}
{{ctx.AvatarUtils.Avatar .Poster 24}}
</a>
{{end}}
<span class="text grey muted-links">
@ -94,7 +94,7 @@
{{else if eq .Type 1}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge gt-bg-green gt-text-white">{{svg "octicon-dot-fill"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if .Issue.IsPull}}
@ -107,7 +107,7 @@
{{else if eq .Type 2}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge gt-bg-red gt-text-white">{{svg "octicon-circle-slash"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if .Issue.IsPull}}
@ -120,7 +120,7 @@
{{else if eq .Type 28}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge gt-bg-purple gt-text-white">{{svg "octicon-git-merge"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$link := printf "%s/commit/%s" $.Repository.Link ($.Issue.PullRequest.MergedCommitID|PathEscape)}}
@ -147,7 +147,7 @@
{{$createdStr:= TimeSinceUnix .CreatedUnix $.locale}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-bookmark"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
{{if eq .RefAction 3}}<del>{{end}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
@ -162,7 +162,7 @@
{{else if eq .Type 4}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-bookmark"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.commit_ref_at" .EventTag $createdStr | Safe}}
@ -176,7 +176,7 @@
{{if or .AddedLabels .RemovedLabels}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-tag"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if and .AddedLabels (not .RemovedLabels)}}
@ -192,7 +192,7 @@
{{else if eq .Type 8}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-milestone"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if gt .OldMilestoneID 0}}{{if gt .MilestoneID 0}}{{$.locale.Tr "repo.issues.change_milestone_at" (.OldMilestone.Name|Escape) (.Milestone.Name|Escape) $createdStr | Safe}}{{else}}{{$.locale.Tr "repo.issues.remove_milestone_at" (.OldMilestone.Name|Escape) $createdStr | Safe}}{{end}}{{else if gt .MilestoneID 0}}{{$.locale.Tr "repo.issues.add_milestone_at" (.Milestone.Name|Escape) $createdStr | Safe}}{{end}}
@ -203,7 +203,7 @@
<span class="badge">{{svg "octicon-person"}}</span>
{{if gt .AssigneeID 0}}
{{if .RemovedAssignee}}
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Assignee}}
{{template "shared/user/avatarlink" dict "user" .Assignee}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Assignee}}
{{if eq .Poster.ID .Assignee.ID}}
@ -213,7 +213,7 @@
{{end}}
</span>
{{else}}
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Assignee}}
{{template "shared/user/avatarlink" dict "user" .Assignee}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Assignee}}
{{if eq .Poster.ID .AssigneeID}}
@ -228,7 +228,7 @@
{{else if eq .Type 10}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-pencil"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.change_title_at" (.OldTitle|RenderEmoji $.Context) (.NewTitle|RenderEmoji $.Context) $createdStr | Safe}}
@ -237,7 +237,7 @@
{{else if eq .Type 11}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-git-branch"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.delete_branch_at" (.OldRef|Escape) $createdStr | Safe}}
@ -246,7 +246,7 @@
{{else if eq .Type 12}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.start_tracking_history" $createdStr | Safe}}
@ -255,7 +255,7 @@
{{else if eq .Type 13}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.stop_tracking_history" $createdStr | Safe}}
@ -274,7 +274,7 @@
{{else if eq .Type 14}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.add_time_history" $createdStr | Safe}}
@ -293,7 +293,7 @@
{{else if eq .Type 15}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.cancel_tracking_history" $createdStr | Safe}}
@ -302,7 +302,7 @@
{{else if eq .Type 16}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.due_date_added" (DateTime "long" .Content) $createdStr | Safe}}
@ -311,7 +311,7 @@
{{else if eq .Type 17}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$parsedDeadline := StringUtils.Split .Content "|"}}
@ -325,7 +325,7 @@
{{else if eq .Type 18}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.due_date_remove" (DateTime "long" .Content) $createdStr | Safe}}
@ -334,7 +334,7 @@
{{else if eq .Type 19}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-package-dependents"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.dependency.added_dependency" $createdStr | Safe}}
@ -357,7 +357,7 @@
{{else if eq .Type 20}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-package-dependents"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.dependency.removed_dependency" $createdStr | Safe}}
@ -386,7 +386,7 @@
bubble. The condition depends on review type and for positive reviews whether
there is a comment element or not */}}
<a class="timeline-avatar{{if or (and (eq .Review.Type 1) (or .Content .Attachments)) (and (eq .Review.Type 2) (or .Content .Attachments)) (eq .Review.Type 3)}} timeline-avatar-offset{{end}}"{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>
{{avatar $.Context .Poster 40}}
{{ctx.AvatarUtils.Avatar .Poster 40}}
</a>
{{end}}
<span class="badge{{if eq .Review.Type 1}} gt-bg-green gt-text-white{{else if eq .Review.Type 3}} gt-bg-red gt-text-white{{end}}">{{svg (printf "octicon-%s" .Review.Type.Icon)}}</span>
@ -423,7 +423,7 @@
<div class="comment-header-left gt-df gt-ac">
{{if gt .Poster.ID 0}}
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
{{avatar $.Context .Poster 24}}
{{ctx.AvatarUtils.Avatar .Poster 24}}
</a>
{{end}}
<span class="text grey muted-links">
@ -549,7 +549,7 @@
<div class="comment-header-left gt-df gt-ac">
{{if not .OriginalAuthor}}
<a class="avatar">
{{avatar $.Context .Poster 20}}
{{ctx.AvatarUtils.Avatar .Poster 20}}
</a>
{{end}}
<span class="text grey muted-links">
@ -644,7 +644,7 @@
{{else if eq .Type 23}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-lock"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
{{if .Content}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
@ -660,7 +660,7 @@
{{else if eq .Type 24}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-key"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$.locale.Tr "repo.issues.unlock_comment" $createdStr | Safe}}
@ -669,7 +669,7 @@
{{else if eq .Type 25}}
<div class="timeline-item event">
<span class="badge">{{svg "octicon-git-branch"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
<a{{if gt .Poster.ID 0}} href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.Name}}</a>
{{$.locale.Tr "repo.pulls.change_target_branch_at" (.OldRef|Escape) (.NewRef|Escape) $createdStr | Safe}}
@ -678,7 +678,7 @@
{{else if eq .Type 26}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-clock"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
@ -697,7 +697,7 @@
{{else if eq .Type 27}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-eye"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if (gt .AssigneeID 0)}}
@ -752,7 +752,7 @@
{{if not $.UnitProjectsGlobalDisabled}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-project"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{$oldProjectDisplayHtml := "Unknown Project"}}
@ -799,7 +799,7 @@
<div class="ui top attached header comment-header-left gt-df gt-ac arrow-top">
{{if gt .Poster.ID 0}}
<a class="inline-timeline-avatar" href="{{.Poster.HomeLink}}">
{{avatar $.Context .Poster 24}}
{{ctx.AvatarUtils.Avatar .Poster 24}}
</a>
{{end}}
<span class="text grey muted-links">
@ -822,7 +822,7 @@
{{else if eq .Type 33}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-git-branch"}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if and .OldRef .NewRef}}
@ -846,7 +846,7 @@
{{else if or (eq .Type 36) (eq .Type 37)}}
<div class="timeline-item event" id="{{.HashTag}}">
<span class="badge">{{svg "octicon-pin" 16}}</span>
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/avatarlink" dict "user" .Poster}}
<span class="text grey muted-links">
{{template "shared/user/authorlink" .Poster}}
{{if eq .Type 36}}{{$.locale.Tr "repo.issues.pin_comment" $createdStr | Safe}}

View file

@ -22,7 +22,7 @@
<a class="{{if not .CanChange}}ui{{end}} item {{if .Checked}}checked{{end}} {{if not .CanChange}}ban-change{{end}}" href="#" data-id="{{.ItemID}}" data-id-selector="#review_request_{{.ItemID}}" {{if not .CanChange}} data-tooltip-content="{{$.locale.Tr "repo.issues.remove_request_review_block"}}"{{end}}>
<span class="octicon-check {{if not .Checked}}invisible{{end}}">{{svg "octicon-check"}}</span>
<span class="text">
{{avatar $.Context .User 28 "gt-mr-3"}}{{template "repo/search_name" .User}}
{{ctx.AvatarUtils.Avatar .User 28 "gt-mr-3"}}{{template "repo/search_name" .User}}
</span>
</a>
{{end}}
@ -51,7 +51,7 @@
<div class="item gt-df gt-ac gt-py-3">
<div class="gt-df gt-ac gt-f1">
{{if .User}}
<a class="muted sidebar-item-link" href="{{.User.HomeLink}}">{{avatar $.Context .User 20 "gt-mr-3"}}{{.User.GetDisplayName}}</a>
<a class="muted sidebar-item-link" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20 "gt-mr-3"}}{{.User.GetDisplayName}}</a>
{{else if .Team}}
<span class="text">{{svg "octicon-people" 20 "gt-mr-3"}}{{$.Issue.Repo.OwnerName}}/{{.Team.Name}}</span>
{{end}}
@ -231,7 +231,7 @@
{{end}}
<span class="octicon-check {{if not $checked}}invisible{{end}}">{{svg "octicon-check"}}</span>
<span class="text">
{{avatar $.Context . 20 "gt-mr-3"}}{{template "repo/search_name" .}}
{{ctx.AvatarUtils.Avatar . 20 "gt-mr-3"}}{{template "repo/search_name" .}}
</span>
</a>
{{end}}
@ -243,7 +243,7 @@
{{range .Issue.Assignees}}
<div class="item">
<a class="muted sidebar-item-link" href="{{$.RepoLink}}/{{if $.Issue.IsPull}}pulls{{else}}issues{{end}}?assignee={{.ID}}">
{{avatar $.Context . 28 "gt-mr-3"}}
{{ctx.AvatarUtils.Avatar . 28 "gt-mr-3"}}
{{.GetDisplayName}}
</a>
</div>
@ -258,7 +258,7 @@
<div class="ui list gt-df gt-fw">
{{range .Participants}}
<a {{if gt .ID 0}}href="{{.HomeLink}}"{{end}} data-tooltip-content="{{.GetDisplayName}}">
{{avatar $.Context . 28 "gt-my-1 gt-mr-2"}}
{{ctx.AvatarUtils.Avatar . 28 "gt-my-1 gt-mr-2"}}
</a>
{{end}}
</div>
@ -347,7 +347,7 @@
{{range $user, $trackedtime := .WorkingUsers}}
<div class="comment gt-mt-3">
<a class="avatar">
{{avatar $.Context $user}}
{{ctx.AvatarUtils.Avatar $user}}
</a>
<div class="content">
{{template "shared/user/authorlink" $user}}

View file

@ -62,18 +62,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
{{avatar $.Context .SignedUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context . 28 "mini"}}
{{ctx.AvatarUtils.Avatar . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -36,18 +36,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser}}
{{ctx.AvatarUtils.Avatar .ContextUser}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
{{avatar $.Context .SignedUser}}
{{ctx.AvatarUtils.Avatar .SignedUser}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context .}}
{{ctx.AvatarUtils.Avatar .}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -78,18 +78,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
{{avatar $.Context .SignedUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context . 28 "mini"}}
{{ctx.AvatarUtils.Avatar . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -74,18 +74,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser}}
{{ctx.AvatarUtils.Avatar .ContextUser}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
{{avatar $.Context .SignedUser}}
{{ctx.AvatarUtils.Avatar .SignedUser}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context .}}
{{ctx.AvatarUtils.Avatar .}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -76,18 +76,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
{{avatar $.Context .SignedUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context . 28 "mini"}}
{{ctx.AvatarUtils.Avatar . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -73,18 +73,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
{{avatar $.Context .SignedUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context . 28 "mini"}}
{{ctx.AvatarUtils.Avatar . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -76,18 +76,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser}}
{{ctx.AvatarUtils.Avatar .ContextUser}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
{{avatar $.Context .SignedUser}}
{{ctx.AvatarUtils.Avatar .SignedUser}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context .}}
{{ctx.AvatarUtils.Avatar .}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -62,18 +62,18 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu" title="{{.SignedUser.Name}}">
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}">
{{avatar $.Context .SignedUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context . 28 "mini"}}
{{ctx.AvatarUtils.Avatar . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -243,7 +243,7 @@
{{end}}
<div class="right floated">
{{range .Assignees}}
<a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{avatar $.Context . 28 "mini gt-mr-3"}}</a>
<a target="_blank" href="{{.HomeLink}}" data-tooltip-content="{{$.locale.Tr "repo.projects.column.assigned_to"}} {{.Name}}">{{ctx.AvatarUtils.Avatar . 28 "mini gt-mr-3"}}</a>
{{end}}
</div>
</div>

View file

@ -14,20 +14,20 @@
<div class="ui selection owner dropdown">
<input type="hidden" id="uid" name="uid" value="{{.ContextUser.ID}}" required>
<span class="text truncated-item-container" title="{{.ContextUser.Name}}">
{{avatar $.Context .ContextUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .ContextUser 28 "mini"}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
{{if .CanForkToUser}}
<div class="item truncated-item-container" data-value="{{.SignedUser.ID}}" title="{{.SignedUser.Name}}">
{{avatar $.Context .SignedUser 28 "mini"}}
{{ctx.AvatarUtils.Avatar .SignedUser 28 "mini"}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
</div>
{{end}}
{{range .Orgs}}
<div class="item truncated-item-container" data-value="{{.ID}}" title="{{.Name}}">
{{avatar $.Context . 28 "mini"}}
{{ctx.AvatarUtils.Avatar . 28 "mini"}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
</div>
{{end}}

View file

@ -38,7 +38,7 @@
<p class="text grey">
{{if gt .Publisher.ID 0}}
<span class="author">
{{avatar $.Context .Publisher 20}}
{{ctx.AvatarUtils.Avatar .Publisher 20}}
<a href="{{.Publisher.HomeLink}}">{{.Publisher.Name}}</a>
</span>
<span class="released">
@ -57,7 +57,7 @@
{{if .OriginalAuthor}}
{{svg "octicon-mark-github" 16 "gt-mr-2"}}{{.OriginalAuthor}}
{{else if .Publisher}}
{{avatar $.Context .Publisher 20}}
{{ctx.AvatarUtils.Avatar .Publisher 20}}
<a href="{{.Publisher.HomeLink}}">{{.Publisher.GetDisplayName}}</a>
{{else}}
Ghost

View file

@ -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">

View file

@ -31,7 +31,7 @@
</td>
<td>
<a href="{{$.Owner.HomeLink}}">
{{avatar $.Context $.Owner}}
{{ctx.AvatarUtils.Avatar $.Owner}}
{{$.Owner.DisplayName}}
</a>
</td>

View file

@ -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>

View file

@ -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}}

View file

@ -3,10 +3,10 @@
<div title="{{if eq .verification.TrustStatus "trusted"}}{{else if eq .verification.TrustStatus "untrusted"}}{{$.root.locale.Tr "repo.commits.signed_by_untrusted_user"}}: {{else}}{{$.root.locale.Tr "repo.commits.signed_by_untrusted_user_unmatched"}}: {{end}}{{.verification.Reason}}">
{{if ne .verification.SigningUser.ID 0}}
{{svg "gitea-lock"}}
{{avatar $.root.Context .verification.SigningUser 28 "signature"}}
{{ctx.AvatarUtils.Avatar .verification.SigningUser 28 "signature"}}
{{else}}
<span title="{{$.root.locale.Tr "gpg.default_key"}}">{{svg "gitea-lock-cog"}}</span>
{{avatarByEmail $.root.Context .verification.SigningEmail "" 28 "signature"}}
{{ctx.AvatarUtils.AvatarByEmail .verification.SigningEmail "" 28 "signature"}}
{{end}}
</div>
{{else}}

View file

@ -8,7 +8,7 @@
{{range .Cards}}
<li class="item ui segment">
<a href="{{.HomeLink}}">
{{avatar $.Context .}}
{{ctx.AvatarUtils.Avatar .}}
</a>
<h3 class="name"><a href="{{.HomeLink}}">{{.DisplayName}}</a></h3>

View file

@ -6,7 +6,7 @@
<div class="ui active tiny slow centered inline">…</div>
{{else}}
{{if .LatestCommitUser}}
{{avatar $.Context .LatestCommitUser 24}}
{{ctx.AvatarUtils.Avatar .LatestCommitUser 24}}
{{if .LatestCommitUser.FullName}}
<a class="muted author-wrapper" title="{{.LatestCommitUser.FullName}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
{{else}}
@ -14,7 +14,7 @@
{{end}}
{{else}}
{{if .LatestCommit.Author}}
{{avatarByEmail $.Context .LatestCommit.Author.Email .LatestCommit.Author.Name 24}}
{{ctx.AvatarUtils.AvatarByEmail .LatestCommit.Author.Email .LatestCommit.Author.Name 24}}
<span class="author-wrapper" title="{{.LatestCommit.Author.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></span>
{{end}}
{{end}}

View file

@ -37,7 +37,7 @@
<div class="text grey">
{{range .Assignees}}
<a class="ui assignee gt-no-underline" href="{{.HomeLink}}" data-tooltip-content="{{.GetDisplayName}}">
{{avatar $.Context . 20}}
{{ctx.AvatarUtils.Avatar . 20}}
</a>
{{end}}
</div>

View file

@ -1 +1 @@
<a class="avatar"{{if gt .user.ID 0}} href="{{.user.HomeLink}}"{{end}}>{{avatar $.Context .user}}</a>
<a class="avatar"{{if gt .user.ID 0}} href="{{.user.HomeLink}}"{{end}}>{{ctx.AvatarUtils.Avatar .user}}</a>

View file

@ -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}}

View file

@ -3,11 +3,11 @@
{{if eq .SignedUserID .ContextUser.ID}}
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{.locale.Tr "user.change_avatar"}}">
{{/* the size doesn't take affect (and no need to take affect), image size(width) should be controlled by the parent container since this is not a flex layout*/}}
{{avatar $.Context .ContextUser 256}}
{{ctx.AvatarUtils.Avatar .ContextUser 256}}
</a>
{{else}}
<span class="image">
{{avatar $.Context .ContextUser 256}}
{{ctx.AvatarUtils.Avatar .ContextUser 256}}
</span>
{{end}}
</div>
@ -86,7 +86,7 @@
{{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}}
<li>
<a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}">
{{avatar $.Context .}}
{{ctx.AvatarUtils.Avatar .}}
</a>
</li>
{{end}}

View file

@ -2,7 +2,7 @@
{{range .Feeds}}
<div class="flex-item">
<div class="flex-item-leading">
{{avatarByAction $.Context .}}
{{ctx.AvatarUtils.AvatarByAction .}}
</div>
<div class="flex-item-main gt-gap-3">
<div>

View file

@ -3,7 +3,7 @@
<div class="item">
<div class="ui floating dropdown jump">
<span class="text truncated-item-container">
{{avatar $.Context .ContextUser}}
{{ctx.AvatarUtils.Avatar .ContextUser}}
<span class="truncated-item-name">{{.ContextUser.ShortName 40}}</span>
<span class="org-visibility">
{{if .ContextUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
@ -17,7 +17,7 @@
</div>
<div class="scrolling menu items">
<a class="{{if eq .ContextUser.ID .SignedUser.ID}}active selected{{end}} item truncated-item-container" href="{{AppSubUrl}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{else if .PageIsMilestonesDashboard}}milestones{{end}}">
{{avatar $.Context .SignedUser}}
{{ctx.AvatarUtils.Avatar .SignedUser}}
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
<span class="org-visibility">
{{if .SignedUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
@ -26,7 +26,7 @@
</a>
{{range .Orgs}}
<a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item truncated-item-container" title="{{.Name}}" href="{{.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}">
{{avatar $.Context .}}
{{ctx.AvatarUtils.Avatar .}}
<span class="truncated-item-name">{{.ShortName 40}}</span>
<span class="org-visibility">
{{if .Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}

View file

@ -14,7 +14,7 @@
{{range .Orgs}}
<div class="flex-item">
<div class="flex-item-leading">
{{avatar $.Context . 28 "mini"}}
{{ctx.AvatarUtils.Avatar . 28 "mini"}}
</div>
<div class="flex-item-main">
<div class="flex-item-title">{{template "shared/user/name" .}}</div>