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

Added copy commit SHA1 button in commits list #13852

wants to merge 1 commit into from

Conversation

macvag
Copy link

@macvag macvag commented Dec 4, 2020

Fixes #13816

Signed-off-by: Vangelis macvag@gmail.com

Fixes #13816

Signed-off-by: Vangelis <macvag@gmail.com>
Copy link
Member

@techknowlogick techknowlogick left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I've added a note about inline CSS.

@@ -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.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Dec 4, 2020
@techknowlogick techknowlogick added type/enhancement An improvement of existing functionality topic/ui Change the appearance of the Gitea UI labels Dec 4, 2020
@techknowlogick techknowlogick added this to the 1.14.0 milestone Dec 4, 2020
@codecov-io
Copy link

Codecov Report

Merging #13852 (0c1dc78) into master (118aedd) will increase coverage by 0.11%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #13852      +/-   ##
==========================================
+ Coverage   42.13%   42.24%   +0.11%     
==========================================
  Files         708      708              
  Lines       77167    77173       +6     
==========================================
+ Hits        32514    32605      +91     
+ Misses      39306    39201     -105     
- Partials     5347     5367      +20     
Impacted Files Coverage Δ
models/repo_mirror.go 2.38% <0.00%> (-11.91%) ⬇️
modules/cron/tasks_basic.go 87.35% <0.00%> (-3.45%) ⬇️
modules/log/event.go 59.90% <0.00%> (-1.89%) ⬇️
services/mirror/mirror.go 15.98% <0.00%> (-1.17%) ⬇️
models/repo_list.go 78.57% <0.00%> (-0.90%) ⬇️
services/pull/check.go 48.90% <0.00%> (-0.73%) ⬇️
routers/user/setting/profile.go 39.32% <0.00%> (-0.56%) ⬇️
services/pull/pull.go 40.68% <0.00%> (ø)
modules/markup/html.go 78.83% <0.00%> (+0.03%) ⬆️
models/error.go 38.66% <0.00%> (+0.48%) ⬆️
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 118aedd...0c1dc78. Read the comment docs.

@silverwind
Copy link
Member

Screenshot please.

@silverwind
Copy link
Member

silverwind commented Dec 5, 2020

I think we first need to rework those shaboxes (which can appear in like 15 different places) to use a shared go template and shared CSS. Maybe then we can add copy functionality that only shows on hover to not further complicate their already complex rendering.

Unfortunately this means that unless you're willing to do that rework, I see no future for this PR because doing it in only one place is too inconsistent.

@silverwind
Copy link
Member

Thought we may be able to make an exception and have the copy button on the commit list after all as there's space. Maye have a separated button in the same height as the shabox (will need some manual CSS).

@macvag
Copy link
Author

macvag commented Dec 7, 2020

Maybe today I will found some free time to try fixing that issue with new css

@silverwind
Copy link
Member

silverwind commented Dec 7, 2020

I think you can take the basic button from your first screenshot and downsize it via CSS to match the height of the shabox and it should be fine. Don't even need to color the background. Will likely need to increase the width of the column so it doesn't overflow on signed commits which are wider.

@a1012112796
Copy link
Member

status? @macvag @silverwind

@6543
Copy link
Member

6543 commented Feb 27, 2021

@macvag any time soon?

@macvag
Copy link
Author

macvag commented Mar 1, 2021

Sorry for my late reply. I didn't notice the first mention.
Unfortunately, I won't be able to continue my tries on this issue.

@6543 6543 modified the milestones: 1.14.0, 1.15.0 Mar 1, 2021
@zeripath
Copy link
Contributor

This is not ready and needs further work - therefore I'm moving it to 1.16 unless there is someone willing to take this up and fix it.

@zeripath zeripath modified the milestones: 1.15.0, 1.16.0 Jun 23, 2021
@stale
Copy link

stale bot commented Aug 22, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Aug 22, 2021
@lunny lunny removed this from the 1.16.0 milestone Nov 19, 2021
@stale stale bot removed the issue/stale label Nov 19, 2021
@wxiaoguang
Copy link
Contributor

We have a better implementation

@wxiaoguang wxiaoguang closed this Nov 22, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to copy commit id in repo commit page?
10 participants