Skip to content

Commit

Permalink
Add copy Commit ID button in commits list (go-gitea#17759)
Browse files Browse the repository at this point in the history
* fix: implement commit id copy to clipboard

* fix: remove abundant attributes / consider edge-case

* fix: locale_en fixed

* fix: use ui button

* tune copy button

* fix: button size

* Fix merge

Co-authored-by: Ysmr-Ry <[email protected]>
Co-authored-by: wxiaoguang <[email protected]>
Co-authored-by: Lunny Xiao <[email protected]>
  • Loading branch information
4 people authored and Stelios Malathouras committed Mar 28, 2022
1 parent 3c869d8 commit dd6d4b3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion templates/repo/commits_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
{{$userName}}
{{end}}
</td>
<td class="sha">
<td class="sha df">
<button class="ui button copy-commit-sha df ac" data-clipboard-text="{{.ID}}">{{svg "octicon-copy" 14}}</button>
{{$class := "ui sha label"}}
{{if .Signature}}
{{$class = (printf "%s%s" $class " isSigned")}}
Expand Down
7 changes: 7 additions & 0 deletions web_src/less/_base.less
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,13 @@ a.ui.card:hover,
margin: 0 6px;
}

.button.copy-commit-sha {
border: 1px solid var(--color-light-border);
margin-right: 3px;
padding: 6px 6px 4px;
background: var(--color-light);
}

.button.truncate {
display: inline-block;
max-width: 100%;
Expand Down
2 changes: 1 addition & 1 deletion web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@
text-align: center;
}

width: 175px;
width: 200px;
}
}

Expand Down

0 comments on commit dd6d4b3

Please sign in to comment.