diff options
author | silverwind <me@silverwind.io> | 2020-12-03 19:46:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-03 19:46:11 +0100 |
commit | 9269a038a4e904bdeaf5470e76e3a4f8a2a4685b (patch) | |
tree | 59730c0dbe7b011a8cb751d135e44152e7feeec0 /templates/user/profile.tmpl | |
parent | 0d35ef5b439623774d1adddf7071d744b1116809 (diff) | |
download | gitea-9269a038a4e904bdeaf5470e76e3a4f8a2a4685b.tar.gz gitea-9269a038a4e904bdeaf5470e76e3a4f8a2a4685b.zip |
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
Diffstat (limited to 'templates/user/profile.tmpl')
-rw-r--r-- | templates/user/profile.tmpl | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 12498868f4..12e1459764 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -6,19 +6,19 @@ <div class="ui card"> {{if eq .SignedUserName .Owner.Name}} <a class="image poping up" href="{{AppSubUrl}}/user/settings" id="profile-avatar" data-content="{{.i18n.Tr "user.change_avatar"}}" data-variation="inverted tiny" data-position="bottom center"> - <img src="{{.Owner.SizedRelAvatarLink 290}}" title="{{.Owner.Name}}" height="290" width="290"/> + {{avatar .Owner 290}} </a> {{else}} - <span class="image"> - <img src="{{.Owner.SizedRelAvatarLink 290}}" title="{{.Owner.Name}}" height="290" width="290"/> + <span class="image" id="profile-avatar"> + {{avatar .Owner 290}} </span> {{end}} - <div class="content word-break"> + <div class="content word-break profile-avatar-name"> {{if .Owner.FullName}}<span class="header text center">{{.Owner.FullName}}</span>{{end}} <span class="username text center">{{.Owner.Name}}</span> </div> <div class="extra content word-break"> - <ul class="text black"> + <ul> {{if .Owner.Location}} <li>{{svg "octicon-location"}} {{.Owner.Location}}</li> {{end}} @@ -54,7 +54,9 @@ {{range .Orgs}} {{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}} <li> - <a href="{{.HomeLink}}"><img class="ui image poping up" src="{{.RelAvatarLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted"></a> + <a class="poping up" href="{{.HomeLink}}" data-content="{{.Name}}" data-position="top center" data-variation="tiny inverted"> + {{avatar .}} + </a> </li> {{end}} {{end}} |