diff options
author | silverwind <me@silverwind.io> | 2024-11-21 05:03:17 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-21 04:03:17 +0000 |
commit | d11f8d24b0cd6b5a508df43c9e0912713cad9ce7 (patch) | |
tree | 64acd88adf8797d13ed8804c44bda198ea56d57b | |
parent | 07373f1d5dd315966bc2f6085a8dd8cca193ec5c (diff) | |
download | gitea-d11f8d24b0cd6b5a508df43c9e0912713cad9ce7.tar.gz gitea-d11f8d24b0cd6b5a508df43c9e0912713cad9ce7.zip |
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
-rw-r--r-- | options/locale/locale_en-US.ini | 1 | ||||
-rw-r--r-- | templates/repo/diff/box.tmpl | 2 | ||||
-rw-r--r-- | templates/repo/home.tmpl | 1 |
3 files changed, 3 insertions, 1 deletions
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index d75827be5c..b21c376002 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 2f9d4ecab6..26737f110e 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -130,7 +130,7 @@ </div> <span class="file tw-flex tw-items-center tw-font-mono tw-flex-1"><a class="muted file-link" title="{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}" href="#diff-{{$file.NameHash}}">{{if $file.IsRenamed}}{{$file.OldName}} → {{end}}{{$file.Name}}</a> {{if .IsLFSFile}} ({{ctx.Locale.Tr "repo.stored_lfs"}}){{end}} - <button class="btn interact-fg tw-p-2" data-clipboard-text="{{$file.Name}}">{{svg "octicon-copy" 14}}</button> + <button class="btn interact-fg tw-p-2" data-clipboard-text="{{$file.Name}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button> {{if $file.IsGenerated}} <span class="ui label">{{ctx.Locale.Tr "repo.diff.generated"}}</span> {{end}} diff --git a/templates/repo/home.tmpl b/templates/repo/home.tmpl index 7a6cbbc4e2..0a8391b553 100644 --- a/templates/repo/home.tmpl +++ b/templates/repo/home.tmpl @@ -106,6 +106,7 @@ <span class="breadcrumb-divider">/</span> {{- if eq $i $l -}} <span class="active section" title="{{$v}}">{{$v}}</span> + <button class="btn interact-fg tw-mx-1" data-clipboard-text="{{$.TreePath}}" data-tooltip-content="{{ctx.Locale.Tr "copy_path"}}">{{svg "octicon-copy" 14}}</button> {{- else -}} {{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{$v}}</a></span> {{- end -}} |