Fix view commit link (#30297)

Fix #30098
This commit is contained in:
wxiaoguang 2024-04-06 02:03:07 +08:00 committed by GitHub
parent 556099fa72
commit b2b49c9bde
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 86 additions and 87 deletions

View File

@ -78,15 +78,14 @@
{{end}} {{end}}
<td class="text right aligned tw-py-0"> <td class="text right aligned tw-py-0">
<button class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button> <button class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
<a {{if not $.PageIsWiki}}{{/* at the moment, wiki doesn't support "view at history point*/}}
class="btn interact-bg tw-p-2" {{$viewCommitLink := printf "%s/src/commit/%s" $commitRepoLink (PathEscape .ID.String)}}
data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" {{if $.FileName}}{{$viewCommitLink = printf "%s/%s" $viewCommitLink (PathEscapeSegments $.FileName)}}{{end}}
href="{{if $.FileName}}{{printf "%s/src/commit/%s/%s" $commitRepoLink (PathEscape .ID.String) (PathEscapeSegments $.FileName)}}{{else}}{{printf "%s/src/commit/%s" $commitRepoLink (PathEscape .ID.String)}}{{end}}"> <a class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{$viewCommitLink}}">{{svg "octicon-file-code"}}</a>
{{svg "octicon-file-code"}} {{end}}
</a>
</td> </td>
</tr> </tr>
{{end}} {{end}}
</tbody> </tbody>
</table> </table>
</div> </div>