Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add copy commit SHA1 button in commits list #17416

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,9 @@ commits.search.tooltip = You can prefix keywords with "author:", "committer:", "
commits.find = Search
commits.search_all = All Branches
commits.author = Author
commits.copy_sha_text = Copy
commits.copy_sha_success = SHA1 has been copied
commits.copy_sha_error = Use ⌘C or Ctrl-C to copy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use the more generic Commit ID instead of SHA or SHA1

commits.message = Message
commits.date = Date
commits.older = Older
Expand Down
10 changes: 10 additions & 0 deletions templates/repo/commits_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
<span class="{{$class}}">
{{end}}
<span class="shortsha">{{ShortSha .ID.String}}</span>
<span class="clipboard"
data-original="{{$.i18n.Tr "repo.commits.copy_sha_text"}}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data-original has no effect now and shouldn't be used.

data-success="{{$.i18n.Tr "repo.commits.copy_sha_success"}}"
data-error="{{$.i18n.Tr "repo.commits.copy_sha_error"}}"
data-content="{{$.i18n.Tr "repo.commits.copy_sha_text"}}"
data-variation="inverted tiny"
data-clipboard-text="{{.ID}}"
>
{{svg "octicon-paste"}}
</span>
{{if .Signature}}
{{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}
{{end}}
Expand Down