From 4f646889021f04b09c7e5b1c4fa2d324c35f1720 Mon Sep 17 00:00:00 2001 From: zeripath Date: Tue, 18 Feb 2020 07:51:39 +0000 Subject: [PATCH] Truncate long commit message header (#10301) (#10319) * Truncate long commit message header * Fix overflow in view commit table * Use @media less * Further improvements * Fix the commit message on small screens * adjust width of minimal table --- templates/repo/commit_page.tmpl | 2 +- templates/repo/view_list.tmpl | 2 +- web_src/less/_repository.less | 39 ++++++++++++++++++++++++++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 5b19523cf..52bedc75b 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -6,7 +6,7 @@ {{.i18n.Tr "repo.diff.browse_source"}} -

{{RenderCommitMessage .Commit.Message $.RepoLink $.Repository.ComposeMetas}}{{template "repo/commit_status" .CommitStatus}}

+

{{RenderCommitMessage .Commit.Message $.RepoLink $.Repository.ComposeMetas}}{{template "repo/commit_status" .CommitStatus}}

{{if IsMultilineCommitMessage .Commit.Message}}
{{RenderCommitBody .Commit.Message $.RepoLink $.Repository.ComposeMetas}}
{{end}} diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index 3ba0eeec8..32b1a0078 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -29,7 +29,7 @@ {{template "repo/commit_status" .LatestCommitStatus}} {{ $commitLink:= printf "%s/commit/%s" .RepoLink .LatestCommit.ID }} - {{RenderCommitMessageLinkSubject .LatestCommit.Message $.RepoLink $commitLink $.Repository.ComposeMetas}} + {{RenderCommitMessageLinkSubject .LatestCommit.Message $.RepoLink $commitLink $.Repository.ComposeMetas}} {{if IsMultilineCommitMessage .LatestCommit.Message}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index e03e45222..e75fb0fae 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -2351,7 +2351,7 @@ tbody.commit-list { vertical-align: baseline; } -.commit-list .message-wrapper { +.message-wrapper { overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 50px); @@ -2359,6 +2359,43 @@ tbody.commit-list { vertical-align: middle; } +@media only screen and (max-width: 767.98px) { + tr.commit-list { + width: 100%; + } + th .message-wrapper { + display: block; + max-width: calc(100vw - 70px); + } +} + +@media only screen and (min-width: 768px) and (max-width: 991.98px) { + tr.commit-list { + width: 723px; + } + th .message-wrapper { + max-width: 280px; + } +} + +@media only screen and (min-width: 992px) and (max-width: 1199.98px) { + tr.commit-list { + width: 933px; + } + th .message-wrapper { + max-width: 490px; + } +} + +@media only screen and (min-width: 1200px) { + tr.commit-list { + width: 1127px; + } + th .message-wrapper { + max-width: 680px; + } +} + .commit-list .commit-summary a { text-decoration: underline; text-decoration-style: dashed;