From e6ef5a6ad563a6148767580e48e3acac09f2cd96 Mon Sep 17 00:00:00 2001 From: HesterG Date: Fri, 3 Mar 2023 15:07:18 +0800 Subject: [PATCH 1/2] fix misalignment in PR view --- templates/repo/diff/box.tmpl | 4 ++-- web_src/less/_repository.less | 23 +++++++++++++++++++++-- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 4e6879650ddcc..afd471368fa89 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -79,7 +79,7 @@ {{$isExpandable := or (gt $file.Addition 0) (gt $file.Deletion 0) $file.IsBin}}

-
+ - {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}} + {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}{{if .IsLFSFile}} ({{$.locale.Tr "repo.stored_lfs"}}){{end}} {{if $file.IsGenerated}} {{$.locale.Tr "repo.diff.generated"}} {{end}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index abbacfb53246e..8800f0d0d0783 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1674,8 +1674,18 @@ align-items: center; .file { - flex: 1; - word-break: break-all; + // flex: 1; + // word-break: break-all; + display: inline-flex; + max-width: 100%; + min-width: 0; + .file-link { + max-width: fit-content; + min-width: 1ch; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } } .button { @@ -3287,6 +3297,15 @@ td.blob-excerpt { position: static; } } + + .diff-file-header-actions { + flex-shrink: 0; + } + + .diff-file-name { + flex: auto; + min-width: 0; + } } .diff-file-body { From 80b2afe6ec1f937aaee534a54585fd417f2cd8bd Mon Sep 17 00:00:00 2001 From: HesterG Date: Mon, 6 Mar 2023 09:43:59 +0800 Subject: [PATCH 2/2] use webkit-line-clamp --- web_src/less/_repository.less | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 5eabb088158c6..3b93a76a16ebc 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1670,17 +1670,13 @@ align-items: center; .file { - // flex: 1; - // word-break: break-all; - display: inline-flex; - max-width: 100%; min-width: 0; .file-link { max-width: fit-content; - min-width: 1ch; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; } } @@ -3300,7 +3296,7 @@ td.blob-excerpt { .diff-file-name { flex: auto; - min-width: 0; + min-width: 100px; } }