Skip to content

Commit 50dbed6

Browse files
authored
Fix author name alignment in commits table (#30396)
Fixes #30129 by introducing a wrapper div with flexbox that collapses any inter-tag whitespace within. View diff with whitespace hidden. Author names aligned: <img width="172" alt="Screenshot 2024-04-10 at 19 41 27" src="https://github.com/go-gitea/gitea/assets/115237/d761e8f2-0e67-4f84-8d37-9ed73850470a"> Vertically centered on expand: <img width="466" alt="Screenshot 2024-04-10 at 19 43 02" src="https://github.com/go-gitea/gitea/assets/115237/decd68b3-19b5-4cfa-a505-b358e4a0715b"> Ellipsis works: <img width="344" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/6f8624a2-f8b6-4f3e-ac98-c44dd0cdfca5">
1 parent e6d3f9f commit 50dbed6

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

templates/repo/commits_list.tmpl

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,19 @@
1313
{{$commitRepoLink := $.RepoLink}}{{if $.CommitRepoLink}}{{$commitRepoLink = $.CommitRepoLink}}{{end}}
1414
{{range .Commits}}
1515
<tr>
16-
<td class="author tw-flex">
17-
{{$userName := .Author.Name}}
18-
{{if .User}}
19-
{{if and .User.FullName DefaultShowFullName}}
20-
{{$userName = .User.FullName}}
16+
<td class="author">
17+
<div class="tw-flex">
18+
{{$userName := .Author.Name}}
19+
{{if .User}}
20+
{{if and .User.FullName DefaultShowFullName}}
21+
{{$userName = .User.FullName}}
22+
{{end}}
23+
{{ctx.AvatarUtils.Avatar .User 28 "tw-mr-2"}}<a class="muted author-wrapper" href="{{.User.HomeLink}}">{{$userName}}</a>
24+
{{else}}
25+
{{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 28 "tw-mr-2"}}
26+
<span class="author-wrapper">{{$userName}}</span>
2127
{{end}}
22-
{{ctx.AvatarUtils.Avatar .User 28 "tw-mr-2"}}<a class="muted author-wrapper" href="{{.User.HomeLink}}">{{$userName}}</a>
23-
{{else}}
24-
{{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 28 "tw-mr-2"}}
25-
<span class="author-wrapper">{{$userName}}</span>
26-
{{end}}
28+
</div>
2729
</td>
2830
<td class="sha">
2931
{{$class := "ui sha label"}}

0 commit comments

Comments
 (0)