Skip to content

Commit 379a524

Browse files
silverwindlunny
andauthored
Fix overflow in commit graph (#17947)
* Fix overflow in commit graph Limit commit message to 50% width. This is rather crude but should work for common use cases with not too-long author names. Fixes: #17944 * Make it work with dynamic width * use span * use explicit none Co-authored-by: Lunny Xiao <[email protected]>
1 parent f550e35 commit 379a524

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

templates/repo/graph/commits.tmpl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,29 @@
2828
{{- end -}}
2929
</a>
3030
</span>
31-
<span class="message df ac mr-2">{{RenderCommitMessage $commit.Subject $.RepoLink $.Repository.ComposeMetas}}</span>
31+
<span class="message dib ellipsis mr-2">
32+
<span>{{RenderCommitMessage $commit.Subject $.RepoLink $.Repository.ComposeMetas}}</span>
33+
</span>
3234
<span class="tags df ac">
3335
{{range $commit.Refs}}
3436
{{$refGroup := .RefGroup}}
3537
{{if eq $refGroup "pull"}}
3638
{{if or (not $.HidePRRefs) (containGeneric $.SelectedBranches .Name)}}
3739
<!-- it's intended to use issues not pulls, if it's a pull you will get redirected -->
38-
<a class="ui labelled icon button basic tiny" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled $.UnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}">
40+
<a class="ui labelled icon button basic tiny mr-2" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled $.UnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}">
3941
{{svg "octicon-git-pull-request" 16 "mr-2"}}#{{.ShortName}}
4042
</a>
4143
{{end}}
4244
{{else if eq $refGroup "tags"}}
43-
<a class="ui labelled icon button basic tiny" href="{{$.RepoLink}}/src/tag/{{.ShortName|PathEscape}}">
45+
<a class="ui labelled icon button basic tiny mr-2" href="{{$.RepoLink}}/src/tag/{{.ShortName|PathEscape}}">
4446
{{svg "octicon-tag" 16 "mr-2"}}{{.ShortName}}
4547
</a>
4648
{{else if eq $refGroup "remotes"}}
47-
<a class="ui labelled icon button basic tiny" href="{{$.RepoLink}}/src/commit/{{$commit.Rev|PathEscape}}">
49+
<a class="ui labelled icon button basic tiny mr-2" href="{{$.RepoLink}}/src/commit/{{$commit.Rev|PathEscape}}">
4850
{{svg "octicon-cross-reference" 16 "mr-2"}}{{.ShortName}}
4951
</a>
5052
{{else if eq $refGroup "heads"}}
51-
<a class="ui labelled icon button basic tiny" href="{{$.RepoLink}}/src/branch/{{.ShortName|PathEscape}}">
53+
<a class="ui labelled icon button basic tiny mr-2" href="{{$.RepoLink}}/src/branch/{{.ShortName|PathEscape}}">
5254
{{svg "octicon-git-branch" 16 "mr-2"}}{{.ShortName}}
5355
</a>
5456
{{else}}

web_src/less/features/gitgraph.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
.author .ui.avatar.image {
138138
width: auto;
139139
height: 18px;
140+
max-width: none;
140141
}
141142
}
142143

web_src/less/helpers.less

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
word-wrap: break-word !important;
2929
}
3030

31+
.ellipsis {
32+
overflow: hidden !important;
33+
white-space: nowrap !important;
34+
text-overflow: ellipsis !important;
35+
}
36+
3137
.full-screen-width { width: 100vw !important; }
3238
.full-screen-height { height: 100vh !important; }
3339

0 commit comments

Comments
 (0)