From bdeecdf2daa61f8d9c6f100db262ba3769555219 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 10 Dec 2021 11:10:47 +0100 Subject: [PATCH 1/4] 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: https://github.com/go-gitea/gitea/issues/17944 --- templates/repo/graph/commits.tmpl | 2 +- web_src/less/features/gitgraph.less | 4 ++++ web_src/less/helpers.less | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl index d054462ebcedd..7a560214eca31 100644 --- a/templates/repo/graph/commits.tmpl +++ b/templates/repo/graph/commits.tmpl @@ -28,7 +28,7 @@ {{- end -}} - {{RenderCommitMessage $commit.Subject $.RepoLink $.Repository.ComposeMetas}} + {{RenderCommitMessage $commit.Subject $.RepoLink $.Repository.ComposeMetas}} {{range $commit.Refs}} {{$refGroup := .RefGroup}} diff --git a/web_src/less/features/gitgraph.less b/web_src/less/features/gitgraph.less index f664a31d570f4..d5afb45fc6204 100644 --- a/web_src/less/features/gitgraph.less +++ b/web_src/less/features/gitgraph.less @@ -138,6 +138,10 @@ width: auto; height: 18px; } + + .message { + max-width: 50%; + } } #graph-raw-list { diff --git a/web_src/less/helpers.less b/web_src/less/helpers.less index a4e8243cc7808..f35412fd0e220 100644 --- a/web_src/less/helpers.less +++ b/web_src/less/helpers.less @@ -28,6 +28,12 @@ word-wrap: break-word !important; } +.ellipsis { + overflow: hidden !important; + white-space: nowrap !important; + text-overflow: ellipsis !important; +} + .full-screen-width { width: 100vw !important; } .full-screen-height { height: 100vh !important; } From f545ebc350b7a82e55e8e0ea902b0655eb63a21a Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 10 Dec 2021 16:24:35 +0100 Subject: [PATCH 2/4] Make it work with dynamic width --- templates/repo/graph/commits.tmpl | 12 +++++++----- web_src/less/features/gitgraph.less | 5 +---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl index 7a560214eca31..671c3610d80d0 100644 --- a/templates/repo/graph/commits.tmpl +++ b/templates/repo/graph/commits.tmpl @@ -28,27 +28,29 @@ {{- end -}} - {{RenderCommitMessage $commit.Subject $.RepoLink $.Repository.ComposeMetas}} + +
{{RenderCommitMessage $commit.Subject $.RepoLink $.Repository.ComposeMetas}}
+
{{range $commit.Refs}} {{$refGroup := .RefGroup}} {{if eq $refGroup "pull"}} {{if or (not $.HidePRRefs) (containGeneric $.SelectedBranches .Name)}} - + {{svg "octicon-git-pull-request" 16 "mr-2"}}#{{.ShortName}} {{end}} {{else if eq $refGroup "tags"}} - + {{svg "octicon-tag" 16 "mr-2"}}{{.ShortName}} {{else if eq $refGroup "remotes"}} - + {{svg "octicon-cross-reference" 16 "mr-2"}}{{.ShortName}} {{else if eq $refGroup "heads"}} - + {{svg "octicon-git-branch" 16 "mr-2"}}{{.ShortName}} {{else}} diff --git a/web_src/less/features/gitgraph.less b/web_src/less/features/gitgraph.less index d5afb45fc6204..ea8efc98bd39b 100644 --- a/web_src/less/features/gitgraph.less +++ b/web_src/less/features/gitgraph.less @@ -137,10 +137,7 @@ .author .ui.avatar.image { width: auto; height: 18px; - } - - .message { - max-width: 50%; + max-width: initial; } } From 519e342a1aba06c7d1990595cc9b3f3eb284d5f2 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 10 Dec 2021 16:28:26 +0100 Subject: [PATCH 3/4] use span --- templates/repo/graph/commits.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/graph/commits.tmpl b/templates/repo/graph/commits.tmpl index 671c3610d80d0..d213c53e96336 100644 --- a/templates/repo/graph/commits.tmpl +++ b/templates/repo/graph/commits.tmpl @@ -29,7 +29,7 @@ -
{{RenderCommitMessage $commit.Subject $.RepoLink $.Repository.ComposeMetas}}
+ {{RenderCommitMessage $commit.Subject $.RepoLink $.Repository.ComposeMetas}}
{{range $commit.Refs}} From 737054aad8ab61ce4988ddf77ab761afc8078665 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 10 Dec 2021 16:32:22 +0100 Subject: [PATCH 4/4] use explicit none --- web_src/less/features/gitgraph.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/less/features/gitgraph.less b/web_src/less/features/gitgraph.less index ea8efc98bd39b..25dcc02159d71 100644 --- a/web_src/less/features/gitgraph.less +++ b/web_src/less/features/gitgraph.less @@ -137,7 +137,7 @@ .author .ui.avatar.image { width: auto; height: 18px; - max-width: initial; + max-width: none; } }