Skip to content

Commit ddf6137

Browse files
yardenshohamHesterGlunny
authored
Add wrapper to author to avoid long name ui problem (#23030) (#23098)
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. Co-authored-by: HesterG <[email protected]> Co-authored-by: Lunny Xiao <[email protected]>
1 parent b4ed3f0 commit ddf6137

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

templates/repo/view_list.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
{{if .LatestCommitUser}}
99
{{avatar $.Context .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 $.Context .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

+15-4
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@
237237
}
238238

239239
#repo-files-table {
240+
table-layout: fixed;
241+
240242
thead {
241243
th {
242244
padding-top: 8px;
@@ -2885,14 +2887,19 @@ tbody.commit-list {
28852887
vertical-align: baseline;
28862888
}
28872889

2888-
.message-wrapper {
2890+
.message-wrapper,
2891+
.author-wrapper {
28892892
overflow: hidden;
28902893
text-overflow: ellipsis;
28912894
max-width: calc(100% - 50px);
28922895
display: inline-block;
28932896
vertical-align: middle;
28942897
}
28952898

2899+
.author-wrapper {
2900+
max-width: 180px;
2901+
}
2902+
28962903
// in the commit list, messages can wrap so we can use inline
28972904
.commit-list .message-wrapper {
28982905
display: inline;
@@ -2912,6 +2919,10 @@ tbody.commit-list {
29122919
display: block;
29132920
max-width: calc(100vw - 70px);
29142921
}
2922+
2923+
.author-wrapper {
2924+
max-width: 80px;
2925+
}
29152926
}
29162927

29172928
@media @mediaMd {
@@ -2920,7 +2931,7 @@ tbody.commit-list {
29202931
}
29212932

29222933
th .message-wrapper {
2923-
max-width: 280px;
2934+
max-width: 120px;
29242935
}
29252936
}
29262937

@@ -2930,7 +2941,7 @@ tbody.commit-list {
29302941
}
29312942

29322943
th .message-wrapper {
2933-
max-width: 490px;
2944+
max-width: 350px;
29342945
}
29352946
}
29362947

@@ -2940,7 +2951,7 @@ tbody.commit-list {
29402951
}
29412952

29422953
th .message-wrapper {
2943-
max-width: 680px;
2954+
max-width: 525px;
29442955
}
29452956
}
29462957

0 commit comments

Comments
 (0)