From 9269a038a4e904bdeaf5470e76e3a4f8a2a4685b Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 3 Dec 2020 19:46:11 +0100 Subject: Direct avatar rendering (#13649) * Direct avatar rendering This adds new template helpers for avatar rendering which output image elements with direct links to avatars which makes them cacheable by the browsers. This should be a major performance improvment for pages with many avatars. * fix avatars of other user's profile pages * fix top border on user avatar name * uncircle avatars * remove old incomplete avatar selector * use title attribute for name and add it back on blame * minor refactor * tweak comments * fix url path join and adjust test to new result * dedupe functions --- templates/user/dashboard/feeds.tmpl | 10 ++++++++-- templates/user/dashboard/navbar.tmpl | 7 +++---- templates/user/profile.tmpl | 14 ++++++++------ templates/user/project.tmpl | 8 +++++--- templates/user/settings/organization.tmpl | 2 +- 5 files changed, 25 insertions(+), 16 deletions(-) (limited to 'templates/user') diff --git a/templates/user/dashboard/feeds.tmpl b/templates/user/dashboard/feeds.tmpl index 739caeba5f..76c751de8a 100644 --- a/templates/user/dashboard/feeds.tmpl +++ b/templates/user/dashboard/feeds.tmpl @@ -1,7 +1,7 @@ {{range .Feeds}}
- + {{avatar .ActUser}}
@@ -84,7 +84,13 @@ {{if $push.Commits}} {{range $push.Commits}} {{ $commitLink := printf "%s/commit/%s" $repoLink .Sha1}} -
  • {{ShortSha .Sha1}} {{RenderCommitMessage .Message $repoLink $.ComposeMetas}}
  • +
  • + {{avatarByEmail .AuthorEmail .AuthorName 28 "img-8 mr-2"}} + {{ShortSha .Sha1}} + + {{RenderCommitMessage .Message $repoLink $.ComposeMetas}} + +
  • {{end}} {{end}} {{if and (gt $push.Len 1) $push.CompareURL}}
  • {{$.i18n.Tr "action.compare_commits" $push.Len}} ยป
  • {{end}} diff --git a/templates/user/dashboard/navbar.tmpl b/templates/user/dashboard/navbar.tmpl index 0fc328e9c6..030219c816 100644 --- a/templates/user/dashboard/navbar.tmpl +++ b/templates/user/dashboard/navbar.tmpl @@ -3,7 +3,7 @@