Skip to content

Commit 7a94ddf

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: Remove unnecessary template helper repoAvatar (go-gitea#26387)
2 parents 5b202b3 + 78b2a1c commit 7a94ddf

File tree

6 files changed

+16
-42
lines changed

6 files changed

+16
-42
lines changed

modules/templates/helper.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ func NewFuncMap() template.FuncMap {
5959
"avatarHTML": AvatarHTML,
6060
"avatarByAction": AvatarByAction,
6161
"avatarByEmail": AvatarByEmail,
62-
"repoAvatar": RepoAvatar,
6362
"EntryIcon": base.EntryIcon,
6463
"MigrationIcon": MigrationIcon,
6564
"ActionIcon": ActionIcon,

modules/templates/util_avatar.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,6 @@ func AvatarByAction(ctx context.Context, action *activities_model.Action, others
6060
return Avatar(ctx, action.ActUser, others...)
6161
}
6262

63-
// RepoAvatar renders repo avatars. args: repo, size(int), class (string)
64-
func RepoAvatar(repo *repo_model.Repository, others ...any) template.HTML {
65-
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, avatars.DefaultAvatarClass, others...)
66-
67-
src := repo.RelAvatarLink()
68-
if src != "" {
69-
return AvatarHTML(src, size, class, repo.FullName())
70-
}
71-
return template.HTML("")
72-
}
73-
7463
// AvatarByEmail renders avatars by email address. args: email, name, size (int), class (string)
7564
func AvatarByEmail(ctx context.Context, email, name string, others ...any) template.HTML {
7665
size, class := gitea_html.ParseSizeAndClass(avatars.DefaultAvatarPixelSize, avatars.DefaultAvatarClass, others...)

templates/explore/repo_list.tmpl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22
{{range .Repos}}
33
<div class="flex-item">
44
<div class="flex-item-leading">
5-
{{$avatar := (repoAvatar . 32)}}
6-
{{if $avatar}}
7-
{{$avatar}}
8-
{{else}}
9-
{{template "repo/icon" .}}
10-
{{end}}
5+
{{template "repo/icon" .}}
116
</div>
127
<div class="flex-item-main">
138
<div class="flex-item-header">

templates/org/team/repositories.tmpl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,7 @@
3030
{{range .Team.Repos}}
3131
<div class="flex-item flex-item-center">
3232
<div class="flex-item-leading">
33-
{{$avatar := (repoAvatar . 32)}}
34-
{{if $avatar}}
35-
{{$avatar}}
36-
{{else}}
37-
{{template "repo/icon" .}}
38-
{{end}}
33+
{{template "repo/icon" .}}
3934
</div>
4035
<div class="flex-item-main">
4136
<a class="flex-item-title text primary" href="{{$.Org.HomeLink}}/{{.Name | PathEscape}}">

templates/repo/header.tmpl

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,9 @@
44
<div class="repo-header">
55
<div class="repo-title-wrap gt-df gt-fc">
66
<div class="repo-title" role="heading" aria-level="1">
7-
{{$avatar := (repoAvatar . 32 "gt-mr-3")}}
8-
{{if $avatar}}
9-
{{$avatar}}
10-
{{else}}
11-
<div class="gt-mr-3">
12-
{{template "repo/icon" .}}
13-
</div>
14-
{{end}}
7+
<div class="gt-mr-3">
8+
{{template "repo/icon" .}}
9+
</div>
1510
<a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>
1611
<div class="gt-mx-2">/</div>
1712
<a href="{{$.RepoLink}}">{{.Name}}</a>

templates/repo/icon.tmpl

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
<div class="repo-icon">
2-
{{if $.IsTemplate}}
2+
{{$avatarLink := .RelAvatarLink}}
3+
{{if $avatarLink}}
4+
<img class="ui avatar gt-vm" src="{{$avatarLink}}" width="32" height="32" alt="{{.FullName}}">
5+
{{else if $.IsTemplate}}
36
{{svg "octicon-repo-template" 32}}
7+
{{else if $.IsPrivate}}
8+
{{svg "octicon-lock" 32}}
9+
{{else if $.IsMirror}}
10+
{{svg "octicon-mirror" 32}}
11+
{{else if $.IsFork}}
12+
{{svg "octicon-repo-forked" 32}}
413
{{else}}
5-
{{if $.IsPrivate}}
6-
{{svg "octicon-lock" 32}}
7-
{{else if $.IsMirror}}
8-
{{svg "octicon-mirror" 32}}
9-
{{else if $.IsFork}}
10-
{{svg "octicon-repo-forked" 32}}
11-
{{else}}
12-
{{svg "octicon-repo" 32}}
13-
{{end}}
14+
{{svg "octicon-repo" 32}}
1415
{{end}}
1516
</div>

0 commit comments

Comments
 (0)