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

Added copy commit SHA1 button in commits list #13852

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 @@ -898,6 +898,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 = Copy
commits.copy_sha_success = SHA1 has been copied
commits.copy_sha_error = Use ⌘C or Ctrl-C to copy
commits.message = Message
commits.date = Date
commits.older = Older
Expand Down
1 change: 1 addition & 0 deletions templates/repo/commits_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
{{else}}
</span>
{{end}}
<span style="cursor: pointer;vertical-align: middle;" class="clipboard" data-original="{{$.i18n.Tr "repo.commits.copy_sha"}}" 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"}}" data-variation="inverted tiny" data-clipboard-text="{{.ID}}">{{svg "octicon-clippy"}}</span>
Copy link
Member

Choose a reason for hiding this comment

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

Please refrain from adding additional inline CSS.

Copy link
Author

Choose a reason for hiding this comment

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

I made an improvement by removing the inline style and using the existing ones for better consistency.
Also, I added it inside the tag to get stacked better with the other icons.
Because it's inside the tag I had to add onclick="event.preventDefault()".
Is that ok to commit it like that?

Copy link
Member

Choose a reason for hiding this comment

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

No, inline scripts are also not appreciated. Make it an actual <button> and you won't need it while also being semantically correct.

Copy link
Author

Choose a reason for hiding this comment

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

Unfortunately, I can't just add a button outside the tag.
For example, If we have it as a button outside the link I must create new styles for that button to fit correctly
copy_button
If there is also the icon for a signed commit we have the below result with the three dots and also we have to create new styles for the content to fit correctly in the cell and rearrange the content with the proper order.
button_and_other
If we put it inside the link with the same styles that other icons have there, the icons are consistent but we have to prevent the redirection to commit details somehow.
copy_inside

Whatever it must be done I believe that the copy should be consistent with the other copy actions across the site.

</td>
<td class="message">
<span class="message-wrapper">
Expand Down