From d11f8d24b0cd6b5a508df43c9e0912713cad9ce7 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 21 Nov 2024 05:03:17 +0100 Subject: [PATCH] Add 'Copy path' button to file view (#32584) Also adds a tooltip which is replicated to the same button in the diff box. Fixes: https://github.com/go-gitea/gitea/issues/32583 --- options/locale/locale_en-US.ini | 1 + templates/repo/diff/box.tmpl | 2 +- templates/repo/home.tmpl | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d75827be5c42f..b21c376002e5e 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -104,6 +104,7 @@ copy_url = Copy URL copy_hash = Copy hash copy_content = Copy content copy_branch = Copy branch name +copy_path = Copy path copy_success = Copied! copy_error = Copy failed copy_type_unsupported = This file type cannot be copied diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 2f9d4ecab6fa9..26737f110e41e 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -130,7 +130,7 @@ {{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}} {{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}} - + {{if $file.IsGenerated}} {{ctx.Locale.Tr "repo.diff.generated"}} {{end}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 7a6cbbc4e25dc..0a8391b55353b 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -106,6 +106,7 @@ / {{- if eq $i $l -}} {{$v}} + {{- else -}} {{$p := index $.Paths $i}}{{$v}} {{- end -}}