From: HesterG Date: Mon, 27 Feb 2023 14:47:04 +0000 (+0800) Subject: Add wrapper to author to avoid long name ui problem (#23030) (#23172) X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5a60e023af86fd54fc4950c7451526dee1f0c8d2;p=gitea.git Add wrapper to author to avoid long name ui problem (#23030) (#23172) Backport #23030 This PR is a possible solution for issue #22866. Main change is to add a `author-wrapper` class around author name, like the wrapper added to message. The `max-width` is set to 200px on PC, and 100px on mobile device for now. Which will work like below: 2023-02-21 11 57 53 2023-02-21 11 58 43 And `title` is added to the wrapper like it did in message wrapper. So the full author name will show on hover. --- diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index b923a9e6c0..8a1a398591 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -8,14 +8,14 @@ {{if .LatestCommitUser}} {{avatar .LatestCommitUser 24}} {{if .LatestCommitUser.FullName}} - {{.LatestCommitUser.FullName}} + {{.LatestCommitUser.FullName}} {{else}} - {{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}} + {{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}} {{end}} {{else}} {{if .LatestCommit.Author}} {{avatarByEmail .LatestCommit.Author.Email .LatestCommit.Author.Name 24}} - {{.LatestCommit.Author.Name}} + {{.LatestCommit.Author.Name}} {{end}} {{end}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 09b8002a89..7a1be4f191 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -271,6 +271,8 @@ } #repo-files-table { + table-layout: fixed; + thead { th { padding-top: 8px; @@ -2846,7 +2848,8 @@ tbody.commit-list { vertical-align: baseline; } -.message-wrapper { +.message-wrapper, +.author-wrapper { overflow: hidden; text-overflow: ellipsis; max-width: calc(100% - 50px); @@ -2854,6 +2857,10 @@ tbody.commit-list { vertical-align: middle; } +.author-wrapper { + max-width: 180px; +} + // in the commit list, messages can wrap so we can use inline .commit-list .message-wrapper { display: inline; @@ -2873,6 +2880,10 @@ tbody.commit-list { display: block; max-width: calc(100vw - 70px); } + + .author-wrapper { + max-width: 80px; + } } @media @mediaMd { @@ -2881,7 +2892,7 @@ tbody.commit-list { } th .message-wrapper { - max-width: 280px; + max-width: 120px; } } @@ -2891,7 +2902,7 @@ tbody.commit-list { } th .message-wrapper { - max-width: 490px; + max-width: 350px; } } @@ -2901,7 +2912,7 @@ tbody.commit-list { } th .message-wrapper { - max-width: 680px; + max-width: 525px; } }