Skip to content

Commit 5a60e02

Browse files
authored
Add wrapper to author to avoid long name ui problem (#23030) (#23172)
Backport #23030 This PR is a possible solution for issue #22866. Main change is to add a `author-wrapper` class around author name, like the wrapper added to message. The `max-width` is set to 200px on PC, and 100px on mobile device for now. Which will work like below: <img width="1183" alt="2023-02-21 11 57 53" src="https://user-images.githubusercontent.com/17645053/220244146-3d47c512-33b6-4ed8-938e-de0a8bc26ffb.png"> <img width="417" alt="2023-02-21 11 58 43" src="https://user-images.githubusercontent.com/17645053/220244154-1ea0476b-9d1c-473a-9917-d3216860f9a9.png"> And `title` is added to the wrapper like it did in message wrapper. So the full author name will show on hover.
1 parent 1170e06 commit 5a60e02

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

templates/repo/view_list.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
{{if .LatestCommitUser}}
99
{{avatar .LatestCommitUser 24}}
1010
{{if .LatestCommitUser.FullName}}
11-
<a class="muted" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
11+
<a class="muted author-wrapper" title="{{.LatestCommitUser.FullName}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
1212
{{else}}
13-
<a class="muted" href="{{.LatestCommitUser.HomeLink}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a>
13+
<a class="muted author-wrapper" title="{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a>
1414
{{end}}
1515
{{else}}
1616
{{if .LatestCommit.Author}}
1717
{{avatarByEmail .LatestCommit.Author.Email .LatestCommit.Author.Name 24}}
18-
<strong>{{.LatestCommit.Author.Name}}</strong>
18+
<span class="author-wrapper" title="{{.LatestCommit.Author.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></span>
1919
{{end}}
2020
{{end}}
2121
<a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified}} isVerified{{if eq .LatestCommitVerification.TrustStatus "trusted"}}{{else if eq .LatestCommitVerification.TrustStatus "untrusted"}}Untrusted{{else}}Unmatched{{end}}{{else if .LatestCommitVerification.Warning}} isWarning{{end}}{{end}}" href="{{.RepoLink}}/commit/{{PathEscape .LatestCommit.ID.String}}">

web_src/less/_repository.less

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,8 @@
271271
}
272272

273273
#repo-files-table {
274+
table-layout: fixed;
275+
274276
thead {
275277
th {
276278
padding-top: 8px;
@@ -2846,14 +2848,19 @@ tbody.commit-list {
28462848
vertical-align: baseline;
28472849
}
28482850

2849-
.message-wrapper {
2851+
.message-wrapper,
2852+
.author-wrapper {
28502853
overflow: hidden;
28512854
text-overflow: ellipsis;
28522855
max-width: calc(100% - 50px);
28532856
display: inline-block;
28542857
vertical-align: middle;
28552858
}
28562859

2860+
.author-wrapper {
2861+
max-width: 180px;
2862+
}
2863+
28572864
// in the commit list, messages can wrap so we can use inline
28582865
.commit-list .message-wrapper {
28592866
display: inline;
@@ -2873,6 +2880,10 @@ tbody.commit-list {
28732880
display: block;
28742881
max-width: calc(100vw - 70px);
28752882
}
2883+
2884+
.author-wrapper {
2885+
max-width: 80px;
2886+
}
28762887
}
28772888

28782889
@media @mediaMd {
@@ -2881,7 +2892,7 @@ tbody.commit-list {
28812892
}
28822893

28832894
th .message-wrapper {
2884-
max-width: 280px;
2895+
max-width: 120px;
28852896
}
28862897
}
28872898

@@ -2891,7 +2902,7 @@ tbody.commit-list {
28912902
}
28922903

28932904
th .message-wrapper {
2894-
max-width: 490px;
2905+
max-width: 350px;
28952906
}
28962907
}
28972908

@@ -2901,7 +2912,7 @@ tbody.commit-list {
29012912
}
29022913

29032914
th .message-wrapper {
2904-
max-width: 680px;
2915+
max-width: 525px;
29052916
}
29062917
}
29072918

0 commit comments

Comments
 (0)