 7086e7a9ac
			
		
	
	
	7086e7a9ac
	
	
	
		
			
			Related: https://codeberg.org/forgejo/forgejo/pulls/3950#issue-785253, https://codeberg.org/forgejo/forgejo/pulls/3950#issuecomment-1998551. ## Links in dropdown * move _admin only_ User details link here, give it always-visible text * add new _self only_ Edit profile link here * move RSS feed link here * add new Atom feed link here, previously unadvertised * add new SSH keys link here (`.keys`), previously unadvertised * add new GPG keys link here (`.gpg`), previously unadvertised * move Block/Unblock button here * move Report abuse link here If primary action is available (Follow/Unfollow), dropdown with more actions goes after it. If not, it is in line with followers, in place where RSS feed button used to be. ## New dropdown Related: https://codeberg.org/forgejo/design/issues/23, https://codeberg.org/forgejo/forgejo/issues/3853, https://codeberg.org/0ko/forgejo/issues/2. Implemented a new dropdown: noJS-usable, JS-enhanced for better keyboard navigation and a11y. Styling is mostly same as the existing ones have, but row density depends on `@media` pointer type. My choice of CSS properties have been influenced of these: *72a3adb16b*51dd2293caInspired-by: KiranMantha <kiranv.mantha@gmail.com> Inspired-by: Lucas Larroche <lucas@larroche.com> Co-authored-by: Beowulf <beowulf@beocode.eu> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7906 Reviewed-by: Otto <otto@codeberg.org> Reviewed-by: Beowulf <beowulf@beocode.eu> Co-authored-by: 0ko <0ko@noreply.codeberg.org> Co-committed-by: 0ko <0ko@noreply.codeberg.org>
		
			
				
	
	
		
			125 lines
		
	
	
	
		
			4.5 KiB
		
	
	
	
		
			Go HTML Template
		
	
	
	
	
	
			
		
		
	
	
			125 lines
		
	
	
	
		
			4.5 KiB
		
	
	
	
		
			Go HTML Template
		
	
	
	
	
	
| {{if .IsHTMX}}
 | |
| 	{{template "base/alert" .}}
 | |
| {{end}}
 | |
| 
 | |
| {{$showFollow := and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
 | |
| 
 | |
| <div id="profile-avatar-card" class="ui card" hx-swap="morph">
 | |
| 	<div id="profile-avatar" class="content tw-flex">
 | |
| 	{{if eq .SignedUserID .ContextUser.ID}}
 | |
| 		<a class="image" href="{{AppSubUrl}}/user/settings#avatar-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}}
 | |
| 		</a>
 | |
| 	{{else}}
 | |
| 		<span class="image">
 | |
| 			{{ctx.AvatarUtils.Avatar .ContextUser 256}}
 | |
| 		</span>
 | |
| 	{{end}}
 | |
| 	</div>
 | |
| 	<div class="content tw-break-anywhere profile-avatar-name">
 | |
| 		{{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}}
 | |
| 		<span class="username">{{.ContextUser.Name}} {{if .ContextUser.GetPronouns .IsSigned}} · {{.ContextUser.GetPronouns .IsSigned}}{{end}}</span>
 | |
| 		<div class="tw-mt-2 tw-flex tw-items-center tw-gap-2 tw-justify-center">
 | |
| 			<span>
 | |
| 				<a class="muted" href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-people" 18 "tw-mr-1"}}{{ctx.Locale.TrN .NumFollowers "user.followers_one" "user.followers_few" .NumFollowers}}</a> · <a class="muted" href="{{.ContextUser.HomeLink}}?tab=following">{{ctx.Locale.TrN .NumFollowing "user.following_one" "user.following_few" .NumFollowing}}</a>
 | |
| 			</span>
 | |
| 			{{if not $showFollow}}
 | |
| 				{{template "shared/user/actions_menu" .}}
 | |
| 			{{end}}
 | |
| 		</div>
 | |
| 	</div>
 | |
| 	{{if $showFollow}}
 | |
| 		<div class="actions">
 | |
| 			<div class="primary-action" hx-target="#profile-avatar-card" hx-indicator="#profile-avatar-card">
 | |
| 				{{if .IsFollowing}}
 | |
| 					<button hx-post="{{.ContextUser.HomeLink}}?action=unfollow" class="ui basic red button tw-flex tw-gap-1">
 | |
| 						{{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}}
 | |
| 					</button>
 | |
| 				{{else}}
 | |
| 					<button hx-post="{{.ContextUser.HomeLink}}?action=follow" class="ui basic primary button tw-flex tw-gap-1">
 | |
| 						{{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}}
 | |
| 					</button>
 | |
| 				{{end}}
 | |
| 			</div>
 | |
| 			{{template "shared/user/actions_menu" .}}
 | |
| 		</div>
 | |
| 	{{end}}
 | |
| 	<div class="extra content tw-break-anywhere">
 | |
| 		<ul>
 | |
| 			{{if .ContextUser.Location}}
 | |
| 				<li>
 | |
| 					{{svg "octicon-location"}}
 | |
| 					<span class="tw-flex-1">{{.ContextUser.Location}}</span>
 | |
| 					{{if .ContextUserLocationMapURL}}
 | |
| 						<a href="{{.ContextUserLocationMapURL}}" rel="nofollow noreferrer" data-tooltip-content="{{ctx.Locale.Tr "user.show_on_map"}}">
 | |
| 							{{svg "octicon-link-external"}}
 | |
| 						</a>
 | |
| 					{{end}}
 | |
| 				</li>
 | |
| 			{{end}}
 | |
| 			{{if .ShowUserEmail}}
 | |
| 				<li>
 | |
| 					{{svg "octicon-mail"}}
 | |
| 					<a class="tw-flex-1" href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a>
 | |
| 					{{if (eq .SignedUserID .ContextUser.ID)}}
 | |
| 						<a href="{{AppSubUrl}}/user/settings#privacy-user-settings">
 | |
| 							<i data-tooltip-content="{{ctx.Locale.Tr "user.email_visibility.limited"}}">
 | |
| 								{{svg "octicon-unlock"}}
 | |
| 							</i>
 | |
| 						</a>
 | |
| 					{{end}}
 | |
| 				</li>
 | |
| 			{{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}}</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-calendar"}}
 | |
| 				<span>{{ctx.Locale.Tr "user.joined_on" (DateUtils.AbsoluteShort .ContextUser.CreatedUnix)}}</span>
 | |
| 			</li>
 | |
| 			{{if and .Orgs .HasOrgsVisible}}
 | |
| 			<li>
 | |
| 				<ul class="user-orgs">
 | |
| 				{{range .Orgs}}
 | |
| 					{{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID ctx $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}}
 | |
| 					<li>
 | |
| 						<a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}">
 | |
| 							{{ctx.AvatarUtils.Avatar .}}
 | |
| 						</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}}
 | |
| 		</ul>
 | |
| 	</div>
 | |
| </div>
 |