From dd8ec121880fda03691cf9f4b17be88e1d4be030 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 23 Aug 2020 21:05:17 +0200 Subject: [PATCH] Increase clickable area on files table links (#12553) --- integrations/repo_test.go | 2 +- templates/repo/view_list.tmpl | 52 ++++++++++++++++------------------- web_src/less/_repository.less | 15 ++++++---- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/integrations/repo_test.go b/integrations/repo_test.go index c2a0368b0a..3121b5135f 100644 --- a/integrations/repo_test.go +++ b/integrations/repo_test.go @@ -148,7 +148,7 @@ func TestViewRepoWithSymlinks(t *testing.T) { resp := session.MakeRequest(t, req, http.StatusOK) htmlDoc := NewHTMLParser(t, resp.Body) - files := htmlDoc.doc.Find("#repo-files-table > TBODY > TR > TD.name > SPAN") + files := htmlDoc.doc.Find("#repo-files-table > TBODY > TR > TD.name") items := files.Map(func(i int, s *goquery.Selection) string { cls, _ := s.Find("SVG").Attr("class") file := strings.Trim(s.Find("A").Text(), " \t\n") diff --git a/templates/repo/view_list.tmpl b/templates/repo/view_list.tmpl index de7d5b1ea9..db810890f5 100644 --- a/templates/repo/view_list.tmpl +++ b/templates/repo/view_list.tmpl @@ -45,41 +45,35 @@ {{if $entry.IsSubModule}} - - {{svg "octicon-file-submodule" 16}} - {{$refURL := $commit.RefURL AppUrl $.Repository.FullName}} - {{if $refURL}} - {{$entry.Name}} @ {{ShortSha $commit.RefID}} - {{else}} - {{$entry.Name}} @ {{ShortSha $commit.RefID}} - {{end}} - + {{svg "octicon-file-submodule" 16}} + {{$refURL := $commit.RefURL AppUrl $.Repository.FullName}} + {{if $refURL}} + {{$entry.Name}} @ {{ShortSha $commit.RefID}} + {{else}} + {{$entry.Name}} @ {{ShortSha $commit.RefID}} + {{end}} {{else}} - - {{if $entry.IsDir}} - {{$subJumpablePathName := $entry.GetSubJumpablePathName}} - {{$subJumpablePath := SubJumpablePath $subJumpablePathName}} - {{svg "octicon-file-directory" 16}} - - {{if eq (len $subJumpablePath) 2}} - {{index $subJumpablePath 0}}{{index $subJumpablePath 1}} - {{else}} - {{index $subJumpablePath 0}} - {{end}} - - {{else}} - {{svg (printf "octicon-%s" (EntryIcon $entry)) 16}} - {{$entry.Name}} - {{end}} - + {{if $entry.IsDir}} + {{$subJumpablePathName := $entry.GetSubJumpablePathName}} + {{$subJumpablePath := SubJumpablePath $subJumpablePathName}} + {{svg "octicon-file-directory" 16}} + + {{if eq (len $subJumpablePath) 2}} + {{index $subJumpablePath 0}}{{index $subJumpablePath 1}} + {{else}} + {{index $subJumpablePath 0}} + {{end}} + + {{else}} + {{svg (printf "octicon-%s" (EntryIcon $entry)) 16}} + {{$entry.Name}} + {{end}} {{end}} - - {{$commit.Summary | RenderEmoji}} - + {{$commit.Summary | RenderEmoji}} {{TimeSince $commit.Committer.When $.Lang}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index becc2e216a..eb316ee71e 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -345,8 +345,8 @@ } td { - padding-top: 8px; - padding-bottom: 8px; + padding-top: 0; + padding-bottom: 0; overflow: initial; &.name { @@ -361,14 +361,19 @@ width: 120px; } - .truncate { + > a { + width: calc(100% - 8px); /* prevent overflow into adjacant cell */ display: inline-block; - max-width: 100%; + padding-top: 8px; + padding-bottom: 8px; overflow: hidden; text-overflow: ellipsis; - vertical-align: top; white-space: nowrap; } + + > * { + vertical-align: middle; + } } td.message .isSigned {