mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-03 18:24:29 +00:00
a3caf21440
* fix #3631 * fix #21599 by the way, refactored the "profile avatar card" to simplify the code.
153 lines
6.0 KiB
Handlebars
153 lines
6.0 KiB
Handlebars
<div id="profile-avatar-card" class="ui fitted segment">
|
|
<div class="flex-divided-list items-px-default muted-links">
|
|
<div class="item flex-text-block tw-justify-center tw-p-5">
|
|
{{if eq .SignedUserID .ContextUser.ID}}
|
|
<a class="flex-text-block" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{ctx.Locale.Tr "user.change_avatar"}}">
|
|
{{/* the size doesn't take affect (and no need to take affect), image size(width) should be controlled by the parent container since this is not a flex layout*/}}
|
|
{{ctx.AvatarUtils.Avatar .ContextUser 256 "profile-avatar-image"}}
|
|
</a>
|
|
{{else}}
|
|
{{ctx.AvatarUtils.Avatar .ContextUser 256 "profile-avatar-image"}}
|
|
{{end}}
|
|
</div>
|
|
|
|
<div class="item flex-relaxed-list">
|
|
<span class="tw-text-center">
|
|
{{.ContextUser.Name}}
|
|
{{if .IsAdmin}}
|
|
<a href="{{AppSubUrl}}/-/admin/users/{{.ContextUser.ID}}" data-tooltip-content="{{ctx.Locale.Tr "admin.users.details"}}">{{svg "octicon-gear" 18}}</a>
|
|
{{end}}
|
|
</span>
|
|
{{if .ContextUser.FullName}}
|
|
<span class="tw-text-center">{{.ContextUser.FullName}}</span>
|
|
{{end}}
|
|
<div class="tw-text-center">
|
|
<a href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-person" 18 "tw-mr-1"}}{{.NumFollowers}} {{ctx.Locale.Tr "user.followers"}}</a> · <a href="{{.ContextUser.HomeLink}}?tab=following">{{.NumFollowing}} {{ctx.Locale.Tr "user.following"}}</a>
|
|
{{if .EnableFeed}}
|
|
<a href="{{.ContextUser.HomeLink}}.rss"><i class="ui tw-text-text-light tw-ml-2" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
|
|
{{if .UserBlocking}}
|
|
<div class="item tw-text-red">{{svg "octicon-circle-slash"}} {{ctx.Locale.Tr "user.block.blocked"}}</div>
|
|
{{if .UserBlocking.Note}}
|
|
<div class="item tw-text-xs tw-text-red">{{ctx.Locale.Tr "user.block.note"}}: {{.UserBlocking.Note}}</div>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{if .ContextUser.Location}}
|
|
<div class="item">
|
|
{{svg "octicon-location"}}
|
|
<span class="tw-flex-1">{{.ContextUser.Location}}</span>
|
|
{{if .ContextUserLocationMapURL}}
|
|
<a href="{{.ContextUserLocationMapURL}}" data-tooltip-content="{{ctx.Locale.Tr "user.show_on_map"}}">
|
|
{{svg "octicon-link-external"}}
|
|
</a>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if (eq .SignedUserID .ContextUser.ID)}}
|
|
<div class="item flex-text-inline">
|
|
{{svg "octicon-mail"}}
|
|
<a class="tw-flex-1" href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a>
|
|
<a class="flex-text-inline" href="{{AppSubUrl}}/user/settings#privacy-user-settings" data-tooltip-content="{{ctx.Locale.Tr (Iif .ShowUserEmail "user.email_visibility.limited" "user.email_visibility.private")}}">
|
|
{{svg (Iif .ShowUserEmail "octicon-unlock" "octicon-lock")}}
|
|
</a>
|
|
</div>
|
|
{{else}}
|
|
{{if .ShowUserEmail}}
|
|
<div class="item">
|
|
{{svg "octicon-mail"}}
|
|
<a href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
{{if .ContextUser.Website}}
|
|
<div class="item">
|
|
{{svg "octicon-link"}}
|
|
<a target="_blank" rel="me" href="{{.ContextUser.Website}}">{{.ContextUser.Website}}</a>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if $.RenderedDescription}}
|
|
<div class="item">
|
|
<div class="render-content markup">{{$.RenderedDescription}}</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{range .OpenIDs}}
|
|
{{if .Show}}
|
|
<div class="item">
|
|
{{svg "fontawesome-openid"}}
|
|
<a target="_blank" href="{{.URI}}">{{.URI}}</a>
|
|
</div>
|
|
{{end}}
|
|
{{end}}
|
|
|
|
<div class="item">{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (DateUtils.AbsoluteShort .ContextUser.CreatedUnix)}}</span></div>
|
|
|
|
{{if and .Orgs .HasOrgsVisible}}
|
|
<div class="item flex-relaxed-list">
|
|
<div class="flex-text-block tw-flex-wrap">
|
|
{{range .Orgs}}
|
|
{{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID ctx $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}}
|
|
<a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}">{{ctx.AvatarUtils.Avatar .}}</a>
|
|
{{end}}
|
|
{{end}}
|
|
{{if .ShowMoreOrgs}}
|
|
<a href="{{.ContextUser.HomeLink}}?tab=organizations" data-tooltip-content="{{ctx.Locale.Tr "user.show_more"}}">{{svg "octicon-kebab-horizontal" 28}}</a>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if .Badges}}
|
|
<div class="item">
|
|
<div class="user-badges">
|
|
{{range .Badges}}
|
|
<span class="user-badge-item">
|
|
{{if .ImageURL}}
|
|
<img loading="lazy" width="64" height="64" src="{{.ImageURL}}" alt="{{.Description}}" data-tooltip-content="{{.Description}}">
|
|
{{else}}
|
|
<span class="ui label user-badge-chip" data-tooltip-content="{{if .Description}}{{.Description}}{{else}}{{.Slug}}{{end}}">{{.Slug}}</span>
|
|
{{end}}
|
|
</span>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
{{end}}
|
|
|
|
{{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
|
|
{{if not .UserBlocking}}
|
|
<div class="item">
|
|
{{$buttonExtraClass := Iif $.IsFollowing "" "primary"}}
|
|
{{$followAction := Iif $.IsFollowing "unfollow" "follow"}}
|
|
<button class="ui basic {{$buttonExtraClass}} button tw-w-full"
|
|
data-fetch-method="post" data-fetch-url="{{.ContextUser.HomeLink}}?action={{$followAction}}"
|
|
data-fetch-sync="$body #profile-avatar-card"
|
|
>
|
|
{{if $.IsFollowing}}
|
|
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}}
|
|
{{else}}
|
|
{{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}}
|
|
{{end}}
|
|
</button>
|
|
</div>
|
|
{{end}}
|
|
|
|
<div class="item">
|
|
{{if not .UserBlocking}}
|
|
<a class="show-modal" href="#" data-modal="#block-user-modal" data-modal-modal-blockee="{{.ContextUser.Name}}" data-modal-modal-blockee-name="{{.ContextUser.GetDisplayName}}" data-modal-modal-form.url="{{AppSubUrl}}/user/settings/blocked_users">{{ctx.Locale.Tr "user.block.block.user"}}</a>
|
|
{{else}}
|
|
<a href="{{AppSubUrl}}/user/settings/blocked_users">{{ctx.Locale.Tr "user.block.unblock"}}</a>
|
|
{{end}}
|
|
</div>
|
|
{{end}}
|
|
</div>
|
|
</div>
|
|
|
|
{{template "shared/user/block_user_dialog" .}}
|