From d04e581f09befcc309598da4f3dda01c7b965f0e Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 18 Sep 2021 18:22:51 +0200 Subject: [PATCH] Switch migration icon to svg (#15954) Followup on https://github.com/go-gitea/gitea/pull/15952, use SVG for migration icon. Screen Shot 2021-05-23 at 00 26 12 Screen Shot 2021-05-23 at 00 25 39 --- modules/templates/helper.go | 6 ++--- public/img/svg/gitea-git.svg | 2 +- templates/repo/diff/comments.tmpl | 2 +- templates/repo/issue/view_content.tmpl | 2 +- .../repo/issue/view_content/comments.tmpl | 23 +++++++++++++++---- templates/repo/issue/view_content/pull.tmpl | 7 +++++- .../repo/issue/view_content/sidebar.tmpl | 7 +++++- web_src/less/_base.less | 6 ++++- web_src/svg/gitea-git.svg | 2 +- 9 files changed, 43 insertions(+), 14 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index f8a93228d..27d81ec9d 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -911,13 +911,13 @@ func TrN(lang string, cnt interface{}, key1, keyN string) string { return keyN } -// MigrationIcon returns a Font Awesome name matching the service an issue/comment was migrated from +// MigrationIcon returns a SVG name matching the service an issue/comment was migrated from func MigrationIcon(hostname string) string { switch hostname { case "github.com": - return "fa-github" + return "octicon-mark-github" default: - return "fa-git-alt" + return "gitea-git" } } diff --git a/public/img/svg/gitea-git.svg b/public/img/svg/gitea-git.svg index ed592a6bb..f0d692251 100644 --- a/public/img/svg/gitea-git.svg +++ b/public/img/svg/gitea-git.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/templates/repo/diff/comments.tmpl b/templates/repo/diff/comments.tmpl index 86e314dc5..ce99ccd9e 100644 --- a/templates/repo/diff/comments.tmpl +++ b/templates/repo/diff/comments.tmpl @@ -14,7 +14,7 @@
{{if .OriginalAuthor }} - + {{svg (MigrationIcon $.root.Repository.GetOriginalURLHostname)}} {{ .OriginalAuthor }} diff --git a/templates/repo/issue/view_content.tmpl b/templates/repo/issue/view_content.tmpl index d2928df34..872c3b620 100644 --- a/templates/repo/issue/view_content.tmpl +++ b/templates/repo/issue/view_content.tmpl @@ -24,7 +24,7 @@
{{if .Issue.OriginalAuthor }} - + {{svg (MigrationIcon .Repository.GetOriginalURLHostname)}} {{ .Issue.OriginalAuthor }} diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 7bc90b043..dabba7bc7 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -24,7 +24,7 @@
{{if .OriginalAuthor }} - + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} {{ .OriginalAuthor }} @@ -408,7 +408,12 @@ {{svg (printf "octicon-%s" .Review.Type.Icon)}} {{if .OriginalAuthor }} - {{ .OriginalAuthor }} {{if $.Repository.OriginalURL}}({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}} + + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{ .OriginalAuthor }} + + {{if $.Repository.OriginalURL}} + ({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}} {{else}} {{.Poster.GetDisplayName}} {{end}} @@ -433,7 +438,12 @@
{{if .OriginalAuthor }} - {{ .OriginalAuthor }} {{if $.Repository.OriginalURL}}({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}} + + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{ .OriginalAuthor }} + + {{if $.Repository.OriginalURL}} + ({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}} {{else}} {{.Poster.GetDisplayName}} {{end}} @@ -526,7 +536,12 @@ {{end}} {{if .OriginalAuthor }} - {{ .OriginalAuthor }} {{if $.Repository.OriginalURL}}({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}} + + {{svg (MigrationIcon $.Repository.GetOriginalURLHostname)}} + {{ .OriginalAuthor }} + + {{if $.Repository.OriginalURL}} + ({{$.i18n.Tr "repo.migrated_from" $.Repository.OriginalURL $.Repository.GetOriginalURLHostname | Safe }}){{end}} {{else}} {{.Poster.GetDisplayName}} {{end}} diff --git a/templates/repo/issue/view_content/pull.tmpl b/templates/repo/issue/view_content/pull.tmpl index 2e624a9fb..aa0f3dc91 100644 --- a/templates/repo/issue/view_content/pull.tmpl +++ b/templates/repo/issue/view_content/pull.tmpl @@ -86,7 +86,12 @@