Skip to content

Commit 527bbf6

Browse files
GiteaBotsilverwindlunnyKN4CK3R
authored
Fix 'View File' button in code search (#23478) (#23483)
Backport #23478 by @silverwind - Right-align 'View File' button - Add 'role' attribute to button link Before: <img width="1148" alt="Screenshot 2023-03-14 at 22 02 16" src="https://user-images.githubusercontent.com/115237/225135954-f06153ec-c222-441e-98ba-0177afff3a7a.png"> After: <img width="1150" alt="Screenshot 2023-03-14 at 22 02 33" src="https://user-images.githubusercontent.com/115237/225135966-323cb695-05ef-4b83-a8ef-05f2b1887090.png"> Co-authored-by: silverwind <[email protected]> Co-authored-by: Lunny Xiao <[email protected]> Co-authored-by: KN4CK3R <[email protected]>
1 parent 5feb31f commit 527bbf6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

templates/code/searchresults.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
{{range $result := .SearchResults}}
1212
{{$repo := (index $.RepoMaps .RepoID)}}
1313
<div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
14-
<h4 class="ui top attached normal header">
15-
<span class="file">
14+
<h4 class="ui top attached normal header gt-df gt-fw">
15+
<span class="file gt-f1">
1616
<a rel="nofollow" href="{{$repo.Link}}">{{$repo.FullName}}</a>
1717
{{if $repo.IsArchived}}
1818
<span class="ui basic label">{{$.locale.Tr "repo.desc.archived"}}</span>
1919
{{end}}
2020
- {{.Filename}}
2121
</span>
22-
<a class="ui basic tiny button" rel="nofollow" href="{{$repo.Link}}/src/commit/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{$.locale.Tr "repo.diff.view_file"}}</a>
22+
<a role="button" class="ui basic tiny button" rel="nofollow" href="{{$repo.Link}}/src/commit/{{$result.CommitID | PathEscape}}/{{.Filename | PathEscapeSegments}}">{{$.locale.Tr "repo.diff.view_file"}}</a>
2323
</h4>
2424
<div class="ui attached table segment">
2525
<div class="file-body file-code code-view">

templates/repo/search.tmpl

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
<div class="repository search">
4040
{{range $result := .SearchResults}}
4141
<div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
42-
<h4 class="ui top attached normal header">
43-
<span class="file">{{.Filename}}</span>
44-
<a class="ui basic tiny button" rel="nofollow" href="{{$.SourcePath}}/src/commit/{{PathEscape $result.CommitID}}/{{PathEscapeSegments .Filename}}">{{$.locale.Tr "repo.diff.view_file"}}</a>
42+
<h4 class="ui top attached normal header gt-df gt-fw">
43+
<span class="file gt-f1">{{.Filename}}</span>
44+
<a role="button" class="ui basic tiny button" rel="nofollow" href="{{$.SourcePath}}/src/commit/{{PathEscape $result.CommitID}}/{{PathEscapeSegments .Filename}}">{{$.locale.Tr "repo.diff.view_file"}}</a>
4545
</h4>
4646
<div class="ui attached table segment">
4747
<div class="file-body file-code code-view">

0 commit comments

Comments
 (0)