From e7938c9c44384e044afba14d5a86b1ba32520dd3 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 8 Dec 2020 05:14:28 +0100 Subject: Repo avatar fixes (#13891) - Split up avatar rendering helpers for performance - Fix showing repo SVG icon when no avatar is set - Make repo SVG and avatar same size at 32px - Fix fork line by adding vertical flexbox on repo title Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao --- templates/explore/repo_list.tmpl | 65 ++++++++++++++++++++++------------------ templates/repo/header.tmpl | 57 +++++++++++++++++++---------------- templates/repo/header_icon.tmpl | 20 ------------- templates/repo/icon.tmpl | 20 +++++++++++++ 4 files changed, 87 insertions(+), 75 deletions(-) delete mode 100644 templates/repo/header_icon.tmpl create mode 100644 templates/repo/icon.tmpl (limited to 'templates') diff --git a/templates/explore/repo_list.tmpl b/templates/explore/repo_list.tmpl index fe4b278e2c..bfec17ff29 100644 --- a/templates/explore/repo_list.tmpl +++ b/templates/explore/repo_list.tmpl @@ -1,37 +1,44 @@
{{range .Repos}}
-
- {{avatar .}} - - {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} / {{end}}{{end}}{{.Name}} - - {{if .IsArchived}} - {{$.i18n.Tr "repo.desc.archived"}} - {{end}} - {{if .IsTemplate}} - {{if .IsPrivate}} - {{$.i18n.Tr "repo.desc.private_template"}} - {{else}} - {{if .Owner.Visibility.IsPrivate}} - {{$.i18n.Tr "repo.desc.internal_template"}} - {{end}} +
+
+ {{$avatar := (repoAvatar . 32 "mr-3")}} + {{if $avatar}} + {{$avatar}} {{end}} - {{else}} - {{if .IsPrivate}} - {{$.i18n.Tr "repo.desc.private"}} - {{else}} - {{if .Owner.Visibility.IsPrivate}} - {{$.i18n.Tr "repo.desc.internal"}} + + {{if or $.PageIsExplore $.PageIsProfileStarList }}{{if .Owner}}{{.Owner.Name}} / {{end}}{{end}}{{.Name}} + +
+ {{if .IsArchived}} + {{$.i18n.Tr "repo.desc.archived"}} {{end}} - {{end}} - {{end}} - {{if .IsFork}} - {{svg "octicon-repo-forked"}} - {{else if .IsMirror}} - {{svg "octicon-mirror"}} - {{end}} -
+ {{if .IsTemplate}} + {{if .IsPrivate}} + {{$.i18n.Tr "repo.desc.private_template"}} + {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{$.i18n.Tr "repo.desc.internal_template"}} + {{end}} + {{end}} + {{else}} + {{if .IsPrivate}} + {{$.i18n.Tr "repo.desc.private"}} + {{else}} + {{if .Owner.Visibility.IsPrivate}} + {{$.i18n.Tr "repo.desc.internal"}} + {{end}} + {{end}} + {{end}} + {{if .IsFork}} + {{svg "octicon-repo-forked"}} + {{else if .IsMirror}} + {{svg "octicon-mirror"}} + {{end}} +
+
+
{{if .PrimaryLanguage }} {{ .PrimaryLanguage.Language }} {{end}} diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 348c6b1ffa..8799cda655 100644 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -2,35 +2,40 @@ {{with .Repository}}
-