From b918609acc11d2deb1dd2182597c7cbb3624dbdb Mon Sep 17 00:00:00 2001 From: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Date: Sun, 28 Jun 2020 06:05:50 +0200 Subject: [PATCH] Use custom SVGs for commit signing lock icon (#12017) * Use custom SVGs for commit signing lock icon * missing spans * editorconfig * xmlns and remove aria-hidden Co-authored-by: Lunny Xiao Co-authored-by: techknowlogick --- .editorconfig | 3 +++ assets/svg/gitea-lock-cog.svg | 4 ++++ assets/svg/gitea-lock.svg | 3 +++ assets/svg/gitea-unlock.svg | 3 +++ templates/repo/commit_page.tmpl | 9 +++------ templates/repo/shabox_badge.tmpl | 9 +++------ web_src/less/_repository.less | 6 +++++- webpack.config.js | 5 ++++- 8 files changed, 28 insertions(+), 14 deletions(-) create mode 100644 assets/svg/gitea-lock-cog.svg create mode 100644 assets/svg/gitea-lock.svg create mode 100644 assets/svg/gitea-unlock.svg diff --git a/.editorconfig b/.editorconfig index 5b3a4ff79f..6059fa100b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -23,3 +23,6 @@ indent_size = 2 [Makefile] indent_style = tab + +[*.svg] +insert_final_newline = false diff --git a/assets/svg/gitea-lock-cog.svg b/assets/svg/gitea-lock-cog.svg new file mode 100644 index 0000000000..13e374a9d1 --- /dev/null +++ b/assets/svg/gitea-lock-cog.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/assets/svg/gitea-lock.svg b/assets/svg/gitea-lock.svg new file mode 100644 index 0000000000..2511b94331 --- /dev/null +++ b/assets/svg/gitea-lock.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/assets/svg/gitea-unlock.svg b/assets/svg/gitea-unlock.svg new file mode 100644 index 0000000000..afaa9f03de --- /dev/null +++ b/assets/svg/gitea-unlock.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/templates/repo/commit_page.tmpl b/templates/repo/commit_page.tmpl index 51f56574c1..f9e8c4acb9 100644 --- a/templates/repo/commit_page.tmpl +++ b/templates/repo/commit_page.tmpl @@ -90,7 +90,7 @@
{{if .Verification.Verified }} {{if ne .Verification.SigningUser.ID 0}} - + {{svg "gitea-lock" 16}} {{if eq .Verification.TrustStatus "trusted"}} {{.i18n.Tr "repo.commits.signed_by"}}: {{else if eq .Verification.TrustStatus "untrusted"}} @@ -102,17 +102,14 @@ {{.Verification.SigningUser.Name}} <{{.Verification.SigningEmail}}> {{.i18n.Tr "repo.commits.gpg_key_id"}}: {{.Verification.SigningKey.KeyID}} {{else}} - - - - + {{svg "gitea-lock-cog" 16}} {{.i18n.Tr "repo.commits.signed_by"}}: {{.Verification.SigningUser.Name}} <{{.Verification.SigningEmail}}> {{.i18n.Tr "repo.commits.gpg_key_id"}}: {{.Verification.SigningKey.KeyID}} {{end}} {{else if .Verification.Warning}} - + {{svg "gitea-unlock" 16}} {{.i18n.Tr .Verification.Reason}} {{.i18n.Tr "repo.commits.gpg_key_id"}}: {{.Verification.SigningKey.KeyID}} {{else}} diff --git a/templates/repo/shabox_badge.tmpl b/templates/repo/shabox_badge.tmpl index f4bd30fdb1..f46b52004e 100644 --- a/templates/repo/shabox_badge.tmpl +++ b/templates/repo/shabox_badge.tmpl @@ -2,17 +2,14 @@ {{if .verification.Verified}}
{{if ne .verification.SigningUser.ID 0}} - + {{svg "gitea-lock" 16}} {{else}} - - - - + {{svg "gitea-lock-cog" 16}} {{end}}
{{else}} - + {{svg "gitea-unlock" 16}} {{end}}
diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 2fd67b66fe..b26f0fa880 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1484,8 +1484,12 @@ margin-right: 0; } + .svg { + margin: 0 .25em 0 0; + } + > div { - display: inline-flex; + display: flex; align-items: center; } } diff --git a/webpack.config.js b/webpack.config.js index fa96f42e91..7b917cbdc1 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -50,7 +50,10 @@ module.exports = { serviceworker: [ resolve(__dirname, 'web_src/js/serviceworker.js'), ], - icons: glob('node_modules/@primer/octicons/build/svg/**/*.svg'), + icons: [ + ...glob('node_modules/@primer/octicons/build/svg/**/*.svg'), + ...glob('assets/svg/*.svg'), + ], ...themes, }, devtool: false,