forgejo/templates/shared/user/profile_big_avatar.tmpl
Panagiotis "Ivory" Vasilopoulos 67e66ab40e
[GITEA] Add OpenStreetMap URL to Location field in profile
Not too important, but I think that it'd be a pretty neat touch.

(cherry picked from commit 64de4e02f9)

Add placeholder text

(cherry picked from commit 1396e2716b)

Add test for OSM feature (doesn't work yet)

(cherry picked from commit 2c94e6d56f)

Lint tests (sorry, I'm a bit tired)

(cherry picked from commit 5731fbb4a4)

It finally works, will add more tests later.

(cherry picked from commit 4437292622)

Improve testing

(cherry picked from commit 56a028ec96)

Introduce new button for OpenStreetMap URL

(cherry picked from commit 852317b467)

16, "gt-mr-2" in *all* icons

(cherry picked from commit c2c60a01eb)

Wait, I forgot about *that* icon

(cherry picked from commit 9930f9b8f2)

Alright, we just made all the icons in that submenu a bit bolder and more consistent.

(cherry picked from commit d5c0009ad0)

Remove | Safe attribute, it does exactly the opposite of what I intended it to.

(cherry picked from commit 1254f2aa9d)

Make OSM button configurable

(cherry picked from commit ba3d76f5ba)

Fix tests (tested)

(cherry picked from commit 22983c65f8)

Add more tests

(cherry picked from commit 4bbcbd37e1)

Add tooltip

(cherry picked from commit b906008ff1)

Revert "16, "gt-mr-2" in *all* icons"

This reverts commit c2c60a01eb.

(cherry picked from commit 02bb52617d)

Revert "Wait, I forgot about *that* icon"

This reverts commit 9930f9b8f2.

(cherry picked from commit a36d657509)

Revert "Alright, we just made all the icons in that submenu a bit bolder and more consistent."

This reverts commit d5c0009ad0.

(cherry picked from commit 27d8d1c5fc)
2023-07-26 16:48:06 +02:00

124 lines
4.3 KiB
Handlebars

<div class="ui card">
<div id="profile-avatar" class="content gt-df">
{{if eq .SignedUserID .ContextUser.ID}}
<a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{.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*/}}
{{avatar $.Context .ContextUser 256}}
</a>
{{else}}
<span class="image">
{{avatar $.Context .ContextUser 256}}
</span>
{{end}}
</div>
<div class="content gt-word-break profile-avatar-name">
{{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}}
<span class="username text center">{{.ContextUser.Name}}</span>
{{if .EnableFeed}}
<a href="{{.ContextUser.HomeLink}}.rss"><i class="ui text grey gt-ml-3" data-tooltip-content="{{.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a>
{{end}}
<div class="gt-mt-3">
<a class="muted" href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-person" 18 "gt-mr-2"}}{{.NumFollowers}} {{.locale.Tr "user.followers"}}</a> ยท <a class="muted" href="{{.ContextUser.HomeLink}}?tab=following">{{.NumFollowing}} {{.locale.Tr "user.following"}}</a>
</div>
</div>
<div class="extra content gt-word-break">
<ul>
{{if .ContextUser.Location}}
<li>
{{svg "octicon-location"}}
{{.ContextUser.Location}}
{{if .EnableOSMButton}}
<a href="https://www.openstreetmap.org/search?query={{.ContextUser.Location}}" rel="nofollow noreferrer">
<i class="ui right" data-tooltip-content="{{.locale.Tr "user.redirect_to_osm"}}">
{{svg "octicon-link-external"}}
</i>
</a>
{{end}}
</li>
{{end}}
{{if (eq .SignedUserID .ContextUser.ID)}}
<li>
{{svg "octicon-mail"}}
<a href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a>
<a href="{{AppSubUrl}}/user/settings#keep-email-private">
{{if .ShowUserEmail}}
<i class="ui right" data-tooltip-content="{{.locale.Tr "user.email_visibility.limited"}}">
{{svg "octicon-unlock"}}
</i>
{{else}}
<i class="ui right" data-tooltip-content="{{.locale.Tr "user.email_visibility.private"}}">
{{svg "octicon-lock"}}
</i>
{{end}}
</a>
</li>
{{else}}
{{if .ShowUserEmail}}
<li>
{{svg "octicon-mail"}}
<a href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a>
</li>
{{end}}
{{end}}
{{if .ContextUser.Website}}
<li>
{{svg "octicon-link"}}
<a target="_blank" rel="noopener noreferrer me" href="{{.ContextUser.Website}}">{{.ContextUser.Website}}</a>
</li>
{{end}}
{{if $.RenderedDescription}}
<li>
<div class="render-content markup">{{$.RenderedDescription|Str2html}}</div>
</li>
{{end}}
{{range .OpenIDs}}
{{if .Show}}
<li>
{{svg "fontawesome-openid"}}
<a target="_blank" rel="noopener noreferrer" href="{{.URI}}">{{.URI}}</a>
</li>
{{end}}
{{end}}
<li>{{svg "octicon-clock"}} {{.locale.Tr "user.joined_on" (DateTime "short" .ContextUser.CreatedUnix) | Safe}}</li>
{{if and .Orgs .HasOrgsVisible}}
<li>
<ul class="user-orgs">
{{range .Orgs}}
{{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}}
<li>
<a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}">
{{avatar $.Context .}}
</a>
</li>
{{end}}
{{end}}
</ul>
</li>
{{end}}
{{if .Badges}}
<li>
<ul class="user-badges">
{{range .Badges}}
<li>
<img width="64" height="64" src="{{.ImageURL}}" alt="{{.Description}}" data-tooltip-content="{{.Description}}">
</li>
{{end}}
</ul>
</li>
{{end}}
{{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
<li class="follow">
{{if $.IsFollowing}}
<button class="ui basic red button link-action" data-url="{{.ContextUser.HomeLink}}?action=unfollow">
{{svg "octicon-person"}} {{.locale.Tr "user.unfollow"}}
</button>
{{else}}
<button class="ui basic green button link-action" data-url="{{.ContextUser.HomeLink}}?action=follow">
{{svg "octicon-person"}} {{.locale.Tr "user.follow"}}
</button>
{{end}}
</li>
{{end}}
</ul>
</div>
</div>