]> source.dussan.org Git - gitea.git/commitdiff
Add 'Copy path' button to file view (#32584)
authorsilverwind <me@silverwind.io>
Thu, 21 Nov 2024 04:03:17 +0000 (05:03 +0100)
committerGitHub <noreply@github.com>
Thu, 21 Nov 2024 04:03:17 +0000 (04:03 +0000)
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
templates/repo/diff/box.tmpl
templates/repo/home.tmpl

index d75827be5c42f99664ea6152a561b287c2bd932e..b21c376002e5eb0cff8b67ebb1d0b11ed74f7b95 100644 (file)
@@ -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
index 2f9d4ecab6fa91b571a321ed99749ca090d969d9..26737f110e41e8b203a8ca3af56fb6dc39d63cf5 100644 (file)
                                                                </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}}
index 7a6cbbc4e25dcaeaf666c85686b0a262fae230b8..0a8391b55353b7bb62408ab5061a17cb14217983 100644 (file)
                                                        <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 -}}