From b164cf9a578f584f1d3ad4cdddaac5ae2aaa96ee Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Mon, 22 Nov 2021 21:49:56 +0900 Subject: [PATCH 1/7] fix: implement commit id copy to clipboard --- options/locale/locale_en-US.ini | 3 +++ templates/repo/commits_list.tmpl | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 2d522acb982f4..c93d9e0fd6dd4 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1052,6 +1052,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 = Commit ID has been copied +commits.copy_sha_error = Use ⌘C or Ctrl-C to copy commits.message = Message commits.date = Date commits.older = Older diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 5282430ec796f..746fcf0b69e50 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -55,6 +55,17 @@ {{else}} {{end}} + {{$commitID := .ID.String}} + + {{svg "octicon-paste"}} + From 42f7ffd4a477931ba74ba0cdcc66e274637984b3 Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 23 Nov 2021 00:06:24 +0900 Subject: [PATCH 2/7] fix: remove abundant attributes / consider edge-case --- templates/repo/commits_list.tmpl | 44 +++++++++++++++++--------------- web_src/less/_repository.less | 12 ++++++++- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 746fcf0b69e50..3025439e9ee76 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -24,9 +24,12 @@ {{end}} + {{$class_wrapper := "ui"}} {{$class := "ui sha label"}} + {{$clipboard := "clipboard"}} {{if .Signature}} {{$class = (printf "%s%s" $class " isSigned")}} + {{$clipboard = (printf "%s%s" $clipboard " isSigned")}} {{if .Verification.Verified}} {{if eq .Verification.TrustStatus "trusted"}} {{$class = (printf "%s%s" $class " isVerified")}} @@ -40,31 +43,32 @@ {{end}} {{end}} {{if $.PageIsWiki}} - + {{else if $.Reponame}} - + {{else}} - + {{end}} - {{ShortSha .ID.String}} - {{if .Signature}} - {{template "repo/shabox_badge" dict "root" $ "verification" .Verification}} + {{if $.PageIsWiki}} + + {{else if $.Reponame}} + {{end}} - {{if $.Reponame}} + {{ShortSha .ID.String}} + {{if .Signature}} + {{template "repo/shabox_badge" dict "root" $ "verification" .Verification}} + {{end}} + {{if $.PageIsWiki}} + + {{else if $.Reponame}} + + {{end}} + {{$commitID := .ID.String}} + + {{svg "octicon-copy"}} - {{else}} - - {{end}} - {{$commitID := .ID.String}} - - {{svg "octicon-paste"}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 1e572ffa7ed7d..3dd9d3f032906 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1330,10 +1330,20 @@ text-align: center; } - width: 175px; + width: 190px; } } + td.sha .clipboard { + margin-left: 2px; + vertical-align: text-bottom; + } + + td.sha .clipboard.isSigned { + margin-left: 2px; + vertical-align: text-bottom; + } + td.sha .sha.label { margin: 0; } From d1d2f0f5c934b487e61fd2715f1aba07a8ae7fe2 Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 23 Nov 2021 00:26:43 +0900 Subject: [PATCH 3/7] fix: locale_en fixed --- options/locale/locale_en-US.ini | 3 --- 1 file changed, 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c93d9e0fd6dd4..2d522acb982f4 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1052,9 +1052,6 @@ 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 = Commit ID has been copied -commits.copy_sha_error = Use ⌘C or Ctrl-C to copy commits.message = Message commits.date = Date commits.older = Older From 44b68e969c0b92d13227b647f90396014f05dd32 Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 23 Nov 2021 01:00:37 +0900 Subject: [PATCH 4/7] fix: use ui button --- templates/repo/commits_list.tmpl | 40 +++++++++++++------------------- web_src/less/_repository.less | 16 ++++--------- 2 files changed, 21 insertions(+), 35 deletions(-) diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 3025439e9ee76..cdd0bc4c80935 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -24,12 +24,9 @@ {{end}} - {{$class_wrapper := "ui"}} {{$class := "ui sha label"}} - {{$clipboard := "clipboard"}} {{if .Signature}} {{$class = (printf "%s%s" $class " isSigned")}} - {{$clipboard = (printf "%s%s" $clipboard " isSigned")}} {{if .Verification.Verified}} {{if eq .Verification.TrustStatus "trusted"}} {{$class = (printf "%s%s" $class " isVerified")}} @@ -42,34 +39,29 @@ {{$class = (printf "%s%s" $class " isWarning")}} {{end}} {{end}} + + {{svg "octicon-copy"}} + {{if $.PageIsWiki}} - + {{else if $.Reponame}} - + {{else}} {{end}} - {{if $.PageIsWiki}} - - {{else if $.Reponame}} - + {{ShortSha .ID.String}} + {{if .Signature}} + {{template "repo/shabox_badge" dict "root" $ "verification" .Verification}} {{end}} - {{ShortSha .ID.String}} - {{if .Signature}} - {{template "repo/shabox_badge" dict "root" $ "verification" .Verification}} - {{end}} - {{if $.PageIsWiki}} - - {{else if $.Reponame}} - - {{end}} - {{$commitID := .ID.String}} - - {{svg "octicon-copy"}} + {{if $.PageIsWiki}} - + {{else if $.Reponame}} + + {{else}} + + {{end}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 3dd9d3f032906..f0a1d3a2788a2 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1330,24 +1330,18 @@ text-align: center; } - width: 190px; + width: 300px; } } - td.sha .clipboard { - margin-left: 2px; - vertical-align: text-bottom; - } - - td.sha .clipboard.isSigned { - margin-left: 2px; - vertical-align: text-bottom; - } - td.sha .sha.label { margin: 0; } + td.sha .sha.label .shortsha { + width: 100px; + } + td.message { text-overflow: unset; } From a303dc11abe9523fc61149e6b1bc033490b18eed Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 23 Nov 2021 00:17:12 +0800 Subject: [PATCH 5/7] tune copy button --- templates/repo/commits_list.tmpl | 14 ++++---------- web_src/less/_repository.less | 6 +----- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 2da79b79466c1..e61450ad6f592 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -39,25 +39,19 @@ {{$class = (printf "%s%s" $class " isWarning")}} {{end}} {{end}} - - {{svg "octicon-copy"}} - {{if $.PageIsWiki}} {{else if $.Reponame}} {{else}} - + {{end}} - {{ShortSha .ID.String}} + {{svg "octicon-copy"}} + {{ShortSha .ID.String}} {{if .Signature}} {{template "repo/shabox_badge" dict "root" $ "verification" .Verification}} {{end}} - {{if $.PageIsWiki}} - - {{else if $.Reponame}} + {{if $.Reponame}} {{else}} diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 6e880bb3f9905..e0f8b98fa2a7e 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1364,7 +1364,7 @@ text-align: center; } - width: 300px; + width: 200px; } } @@ -1372,10 +1372,6 @@ margin: 0; } - td.sha .sha.label .shortsha { - width: 100px; - } - td.message { text-overflow: unset; } From 884ccc646facd3ebca5bcdbe07b91e10596341e6 Mon Sep 17 00:00:00 2001 From: Ysmr-Ry Date: Tue, 23 Nov 2021 08:58:22 +0900 Subject: [PATCH 6/7] fix: button size --- templates/repo/commits_list.tmpl | 8 ++------ web_src/less/_base.less | 7 +++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index cdd0bc4c80935..70def184154b1 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -23,7 +23,8 @@ {{$userName}} {{end}} - + + {{$class := "ui sha label"}} {{if .Signature}} {{$class = (printf "%s%s" $class " isSigned")}} @@ -39,11 +40,6 @@ {{$class = (printf "%s%s" $class " isWarning")}} {{end}} {{end}} - - {{svg "octicon-copy"}} - {{if $.PageIsWiki}} {{else if $.Reponame}} diff --git a/web_src/less/_base.less b/web_src/less/_base.less index 4e2782a4c8ce4..a462860a129ff 100644 --- a/web_src/less/_base.less +++ b/web_src/less/_base.less @@ -979,6 +979,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%; From 51ead0f4be01bad6f2557399e084592246dbf4dd Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 23 Nov 2021 10:34:10 +0800 Subject: [PATCH 7/7] Fix merge --- templates/repo/commits_list.tmpl | 1 - 1 file changed, 1 deletion(-) diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index 6b9949e6655df..e270a99972942 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -47,7 +47,6 @@ {{else}} {{end}} - {{svg "octicon-copy"}} {{ShortSha .ID.String}} {{if .Signature}} {{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}