Skip to content

Commit d4e5518

Browse files
committed
Add copy commit SHA1 button in commits list
1 parent 2a9aefd commit d4e5518

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

options/locale/locale_en-US.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,6 +1057,9 @@ commits.search.tooltip = You can prefix keywords with "author:", "committer:", "
10571057
commits.find = Search
10581058
commits.search_all = All Branches
10591059
commits.author = Author
1060+
commits.copy_sha_text = Copy
1061+
commits.copy_sha_success = SHA1 has been copied
1062+
commits.copy_sha_error = Use ⌘C or Ctrl-C to copy
10601063
commits.message = Message
10611064
commits.date = Date
10621065
commits.older = Older

templates/repo/commits_list.tmpl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@
4747
<span class="{{$class}}">
4848
{{end}}
4949
<span class="shortsha">{{ShortSha .ID.String}}</span>
50+
<span class="clipboard"
51+
data-original="{{$.i18n.Tr "repo.commits.copy_sha_text"}}"
52+
data-success="{{$.i18n.Tr "repo.commits.copy_sha_success"}}"
53+
data-error="{{$.i18n.Tr "repo.commits.copy_sha_error"}}"
54+
data-content="{{$.i18n.Tr "repo.commits.copy_sha_text"}}"
55+
data-variation="inverted tiny"
56+
data-clipboard-text="{{.ID}}"
57+
>
58+
{{svg "octicon-paste"}}
59+
</span>
5060
{{if .Signature}}
5161
{{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}
5262
{{end}}

0 commit comments

Comments
 (0)