From 6be6c19daf93c720718ce65c71fcf288d6e070e3 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Mon, 6 Mar 2023 22:11:55 -0500 Subject: [PATCH] Fix PR view misalignment caused by long name file (#23321) (#23335) Backport #23321 Close #23248 The UI after this PR: https://user-images.githubusercontent.com/17645053/223009758-7f0c9f12-d346-4cb2-a605-729fddce732f.mov Co-authored-by: Hester Gong Co-authored-by: Lunny Xiao --- templates/repo/diff/box.tmpl | 4 ++-- web_src/less/_repository.less | 19 +++++++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 4e6879650d..afd471368f 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 a8106c5bf8..74079170a1 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1663,8 +1663,14 @@ align-items: center; .file { - flex: 1; - word-break: break-all; + min-width: 0; + .file-link { + max-width: fit-content; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + } } .button { @@ -3276,6 +3282,15 @@ td.blob-excerpt { position: static; } } + + .diff-file-header-actions { + flex-shrink: 0; + } + + .diff-file-name { + flex: auto; + min-width: 100px; + } } .diff-file-body {