Skip to content

Commit a1f5c7b

Browse files
velengelasSqrwxiaoguanglunny
authored
Add copy Commit ID button in commits list (#17759)
* 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 <ryo.yossy@live.jp> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
1 parent b2daa7e commit a1f5c7b

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

templates/repo/commits_list.tmpl

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
{{$userName}}
2424
{{end}}
2525
</td>
26-
<td class="sha">
26+
<td class="sha df">
27+
<button class="ui button copy-commit-sha df ac" data-clipboard-text="{{.ID}}">{{svg "octicon-copy" 14}}</button>
2728
{{$class := "ui sha label"}}
2829
{{if .Signature}}
2930
{{$class = (printf "%s%s" $class " isSigned")}}

web_src/less/_base.less

+7
Original file line numberDiff line numberDiff line change
@@ -985,6 +985,13 @@ a.ui.card:hover,
985985
margin: 0 6px;
986986
}
987987

988+
.button.copy-commit-sha {
989+
border: 1px solid var(--color-light-border);
990+
margin-right: 3px;
991+
padding: 6px 6px 4px;
992+
background: var(--color-light);
993+
}
994+
988995
.button.truncate {
989996
display: inline-block;
990997
max-width: 100%;

web_src/less/_repository.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,7 @@
13641364
text-align: center;
13651365
}
13661366

1367-
width: 175px;
1367+
width: 200px;
13681368
}
13691369
}
13701370

0 commit comments

Comments
 (0)