Skip to content

Commit dd8ec12

Browse files
authored
Increase clickable area on files table links (#12553)
1 parent d2cee3e commit dd8ec12

File tree

3 files changed

+34
-35
lines changed

3 files changed

+34
-35
lines changed

integrations/repo_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ func TestViewRepoWithSymlinks(t *testing.T) {
148148
resp := session.MakeRequest(t, req, http.StatusOK)
149149

150150
htmlDoc := NewHTMLParser(t, resp.Body)
151-
files := htmlDoc.doc.Find("#repo-files-table > TBODY > TR > TD.name > SPAN")
151+
files := htmlDoc.doc.Find("#repo-files-table > TBODY > TR > TD.name")
152152
items := files.Map(func(i int, s *goquery.Selection) string {
153153
cls, _ := s.Find("SVG").Attr("class")
154154
file := strings.Trim(s.Find("A").Text(), " \t\n")

templates/repo/view_list.tmpl

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -45,41 +45,35 @@
4545
<tr>
4646
{{if $entry.IsSubModule}}
4747
<td>
48-
<span class="truncate">
49-
{{svg "octicon-file-submodule" 16}}
50-
{{$refURL := $commit.RefURL AppUrl $.Repository.FullName}}
51-
{{if $refURL}}
52-
<a href="{{$refURL}}">{{$entry.Name}}</a> @ <a href="{{$refURL}}/commit/{{$commit.RefID}}">{{ShortSha $commit.RefID}}</a>
53-
{{else}}
54-
{{$entry.Name}} @ {{ShortSha $commit.RefID}}
55-
{{end}}
56-
</span>
48+
{{svg "octicon-file-submodule" 16}}
49+
{{$refURL := $commit.RefURL AppUrl $.Repository.FullName}}
50+
{{if $refURL}}
51+
<a href="{{$refURL}}">{{$entry.Name}}</a> @ <a href="{{$refURL}}/commit/{{$commit.RefID}}">{{ShortSha $commit.RefID}}</a>
52+
{{else}}
53+
{{$entry.Name}} @ {{ShortSha $commit.RefID}}
54+
{{end}}
5755
</td>
5856
{{else}}
5957
<td class="name four wide">
60-
<span class="truncate">
61-
{{if $entry.IsDir}}
62-
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
63-
{{$subJumpablePath := SubJumpablePath $subJumpablePathName}}
64-
{{svg "octicon-file-directory" 16}}
65-
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $subJumpablePathName}}" title="{{$subJumpablePathName}}">
66-
{{if eq (len $subJumpablePath) 2}}
67-
<span class="jumpable-path">{{index $subJumpablePath 0}}</span>{{index $subJumpablePath 1}}
68-
{{else}}
69-
{{index $subJumpablePath 0}}
70-
{{end}}
71-
</a>
72-
{{else}}
73-
{{svg (printf "octicon-%s" (EntryIcon $entry)) 16}}
74-
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
75-
{{end}}
76-
</span>
58+
{{if $entry.IsDir}}
59+
{{$subJumpablePathName := $entry.GetSubJumpablePathName}}
60+
{{$subJumpablePath := SubJumpablePath $subJumpablePathName}}
61+
{{svg "octicon-file-directory" 16}}
62+
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $subJumpablePathName}}" title="{{$subJumpablePathName}}">
63+
{{if eq (len $subJumpablePath) 2}}
64+
<span class="jumpable-path">{{index $subJumpablePath 0}}</span>{{index $subJumpablePath 1}}
65+
{{else}}
66+
{{index $subJumpablePath 0}}
67+
{{end}}
68+
</a>
69+
{{else}}
70+
{{svg (printf "octicon-%s" (EntryIcon $entry)) 16}}
71+
<a href="{{EscapePound $.TreeLink}}/{{EscapePound $entry.Name}}" title="{{$entry.Name}}">{{$entry.Name}}</a>
72+
{{end}}
7773
</td>
7874
{{end}}
7975
<td class="message nine wide">
80-
<span class="truncate">
81-
<a href="{{$.RepoLink}}/commit/{{$commit.ID}}" title="{{$commit.Summary}}">{{$commit.Summary | RenderEmoji}}</a>
82-
</span>
76+
<a href="{{$.RepoLink}}/commit/{{$commit.ID}}" title="{{$commit.Summary}}">{{$commit.Summary | RenderEmoji}}</a>
8377
</td>
8478
<td class="text right age three wide">{{TimeSince $commit.Committer.When $.Lang}}</td>
8579
</tr>

web_src/less/_repository.less

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@
345345
}
346346

347347
td {
348-
padding-top: 8px;
349-
padding-bottom: 8px;
348+
padding-top: 0;
349+
padding-bottom: 0;
350350
overflow: initial;
351351

352352
&.name {
@@ -361,14 +361,19 @@
361361
width: 120px;
362362
}
363363

364-
.truncate {
364+
> a {
365+
width: calc(100% - 8px); /* prevent overflow into adjacant cell */
365366
display: inline-block;
366-
max-width: 100%;
367+
padding-top: 8px;
368+
padding-bottom: 8px;
367369
overflow: hidden;
368370
text-overflow: ellipsis;
369-
vertical-align: top;
370371
white-space: nowrap;
371372
}
373+
374+
> * {
375+
vertical-align: middle;
376+
}
372377
}
373378

374379
td.message .isSigned {

0 commit comments

Comments
 (0)