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 <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
This commit is contained in:
Giteabot 2023-03-15 05:34:05 -04:00 committed by GitHub
parent 5feb31f219
commit 527bbf67e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -11,15 +11,15 @@
{{range $result := .SearchResults}} {{range $result := .SearchResults}}
{{$repo := (index $.RepoMaps .RepoID)}} {{$repo := (index $.RepoMaps .RepoID)}}
<div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result"> <div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
<h4 class="ui top attached normal header"> <h4 class="ui top attached normal header gt-df gt-fw">
<span class="file"> <span class="file gt-f1">
<a rel="nofollow" href="{{$repo.Link}}">{{$repo.FullName}}</a> <a rel="nofollow" href="{{$repo.Link}}">{{$repo.FullName}}</a>
{{if $repo.IsArchived}} {{if $repo.IsArchived}}
<span class="ui basic label">{{$.locale.Tr "repo.desc.archived"}}</span> <span class="ui basic label">{{$.locale.Tr "repo.desc.archived"}}</span>
{{end}} {{end}}
- {{.Filename}} - {{.Filename}}
</span> </span>
<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> <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>
</h4> </h4>
<div class="ui attached table segment"> <div class="ui attached table segment">
<div class="file-body file-code code-view"> <div class="file-body file-code code-view">

View file

@ -39,9 +39,9 @@
<div class="repository search"> <div class="repository search">
{{range $result := .SearchResults}} {{range $result := .SearchResults}}
<div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result"> <div class="diff-file-box diff-box file-content non-diff-file-content repo-search-result">
<h4 class="ui top attached normal header"> <h4 class="ui top attached normal header gt-df gt-fw">
<span class="file">{{.Filename}}</span> <span class="file gt-f1">{{.Filename}}</span>
<a class="ui basic tiny button" rel="nofollow" href="{{$.SourcePath}}/src/commit/{{PathEscape $result.CommitID}}/{{PathEscapeSegments .Filename}}">{{$.locale.Tr "repo.diff.view_file"}}</a> <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>
</h4> </h4>
<div class="ui attached table segment"> <div class="ui attached table segment">
<div class="file-body file-code code-view"> <div class="file-body file-code code-view">