]> source.dussan.org Git - gitea.git/commitdiff
Add wrapper to author to avoid long name ui problem (#23030) (#23172)
authorHesterG <hestergong@gmail.com>
Mon, 27 Feb 2023 14:47:04 +0000 (22:47 +0800)
committerGitHub <noreply@github.com>
Mon, 27 Feb 2023 14:47:04 +0000 (22:47 +0800)
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:

<img width="1183" alt="2023-02-21 11 57 53"
src="https://user-images.githubusercontent.com/17645053/220244146-3d47c512-33b6-4ed8-938e-de0a8bc26ffb.png">

<img width="417" alt="2023-02-21 11 58 43"
src="https://user-images.githubusercontent.com/17645053/220244154-1ea0476b-9d1c-473a-9917-d3216860f9a9.png">

And `title` is added to the wrapper like it did in message wrapper. So
the full author name will show on hover.

templates/repo/view_list.tmpl
web_src/less/_repository.less

index b923a9e6c08b257c7493eb31c61caf72c0595947..8a1a398591b9edf3fafa7626b1b8c1d9bbfd71c0 100644 (file)
@@ -8,14 +8,14 @@
                                        {{if .LatestCommitUser}}
                                                {{avatar .LatestCommitUser 24}}
                                                {{if .LatestCommitUser.FullName}}
-                                                       <a class="muted" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
+                                                       <a class="muted author-wrapper" title="{{.LatestCommitUser.FullName}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
                                                {{else}}
-                                                       <a class="muted" href="{{.LatestCommitUser.HomeLink}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a>
+                                                       <a class="muted author-wrapper" title="{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a>
                                                {{end}}
                                        {{else}}
                                                {{if .LatestCommit.Author}}
                                                        {{avatarByEmail .LatestCommit.Author.Email .LatestCommit.Author.Name 24}}
-                                                       <strong>{{.LatestCommit.Author.Name}}</strong>
+                                                       <span class="author-wrapper" title="{{.LatestCommit.Author.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></span>
                                                {{end}}
                                        {{end}}
                                        <a rel="nofollow" class="ui sha label {{if .LatestCommit.Signature}} isSigned {{if .LatestCommitVerification.Verified}} isVerified{{if eq .LatestCommitVerification.TrustStatus "trusted"}}{{else if eq .LatestCommitVerification.TrustStatus "untrusted"}}Untrusted{{else}}Unmatched{{end}}{{else if .LatestCommitVerification.Warning}} isWarning{{end}}{{end}}" href="{{.RepoLink}}/commit/{{PathEscape .LatestCommit.ID.String}}">
index 09b8002a8986e43f68d528f5e840959a566aa3cb..7a1be4f19170aa100cba0a70493921dafef50823 100644 (file)
     }
 
     #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;
   }
 }