gitea源码

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <div id="profile-avatar-card" class="ui card">
  2. <div id="profile-avatar" class="content tw-flex">
  3. {{if eq .SignedUserID .ContextUser.ID}}
  4. <a class="image" href="{{AppSubUrl}}/user/settings" data-tooltip-content="{{ctx.Locale.Tr "user.change_avatar"}}">
  5. {{/* 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*/}}
  6. {{ctx.AvatarUtils.Avatar .ContextUser 256}}
  7. </a>
  8. {{else}}
  9. <span class="image">
  10. {{ctx.AvatarUtils.Avatar .ContextUser 256}}
  11. </span>
  12. {{end}}
  13. </div>
  14. <div class="content tw-break-anywhere profile-avatar-name">
  15. {{if .ContextUser.FullName}}<span class="header text center">{{.ContextUser.FullName}}</span>{{end}}
  16. <span class="username text center">{{.ContextUser.Name}} {{if .IsAdmin}}
  17. <a class="muted" href="{{AppSubUrl}}/-/admin/users/{{.ContextUser.ID}}" data-tooltip-content="{{ctx.Locale.Tr "admin.users.details"}}">
  18. {{svg "octicon-gear" 18}}
  19. </a>
  20. {{end}}</span>
  21. <div class="tw-mt-2">
  22. <a class="muted" href="{{.ContextUser.HomeLink}}?tab=followers">{{svg "octicon-person" 18 "tw-mr-1"}}{{.NumFollowers}} {{ctx.Locale.Tr "user.followers"}}</a> · <a class="muted" href="{{.ContextUser.HomeLink}}?tab=following">{{.NumFollowing}} {{ctx.Locale.Tr "user.following"}}</a>
  23. {{if .EnableFeed}}
  24. <a href="{{.ContextUser.HomeLink}}.rss"><i class="ui text grey tw-ml-2" data-tooltip-content="{{ctx.Locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</i></a>
  25. {{end}}
  26. </div>
  27. </div>
  28. <div class="extra content tw-break-anywhere">
  29. <ul>
  30. {{if .UserBlocking}}
  31. <li class="text red">{{svg "octicon-circle-slash"}} {{ctx.Locale.Tr "user.block.blocked"}}</li>
  32. {{if .UserBlocking.Note}}
  33. <li class="text small red">{{ctx.Locale.Tr "user.block.note"}}: {{.UserBlocking.Note}}</li>
  34. {{end}}
  35. {{end}}
  36. {{if .ContextUser.Location}}
  37. <li>
  38. {{svg "octicon-location"}}
  39. <span class="tw-flex-1">{{.ContextUser.Location}}</span>
  40. {{if .ContextUserLocationMapURL}}
  41. <a href="{{.ContextUserLocationMapURL}}" rel="nofollow noreferrer" data-tooltip-content="{{ctx.Locale.Tr "user.show_on_map"}}">
  42. {{svg "octicon-link-external"}}
  43. </a>
  44. {{end}}
  45. </li>
  46. {{end}}
  47. {{if (eq .SignedUserID .ContextUser.ID)}}
  48. <li>
  49. {{svg "octicon-mail"}}
  50. <a class="tw-flex-1" href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a>
  51. <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")}}">
  52. {{svg (Iif .ShowUserEmail "octicon-unlock" "octicon-lock")}}
  53. </a>
  54. </li>
  55. {{else}}
  56. {{if .ShowUserEmail}}
  57. <li>
  58. {{svg "octicon-mail"}}
  59. <a href="mailto:{{.ContextUser.Email}}" rel="nofollow">{{.ContextUser.Email}}</a>
  60. </li>
  61. {{end}}
  62. {{end}}
  63. {{if .ContextUser.Website}}
  64. <li>
  65. {{svg "octicon-link"}}
  66. <a target="_blank" rel="noopener noreferrer me" href="{{.ContextUser.Website}}">{{.ContextUser.Website}}</a>
  67. </li>
  68. {{end}}
  69. {{if $.RenderedDescription}}
  70. <li>
  71. <div class="render-content markup">{{$.RenderedDescription}}</div>
  72. </li>
  73. {{end}}
  74. {{range .OpenIDs}}
  75. {{if .Show}}
  76. <li>
  77. {{svg "fontawesome-openid"}}
  78. <a target="_blank" rel="noopener noreferrer" href="{{.URI}}">{{.URI}}</a>
  79. </li>
  80. {{end}}
  81. {{end}}
  82. <li>{{svg "octicon-calendar"}} <span>{{ctx.Locale.Tr "user.joined_on" (DateUtils.AbsoluteShort .ContextUser.CreatedUnix)}}</span></li>
  83. {{if and .Orgs .HasOrgsVisible}}
  84. <li>
  85. <ul class="user-orgs">
  86. {{range .Orgs}}
  87. {{if (or .Visibility.IsPublic (and ($.SignedUser) (or .Visibility.IsLimited (and (.HasMemberWithUserID ctx $.SignedUserID) .Visibility.IsPrivate) ($.IsAdmin))))}}
  88. <li>
  89. <a href="{{.HomeLink}}" data-tooltip-content="{{.Name}}">
  90. {{ctx.AvatarUtils.Avatar .}}
  91. </a>
  92. </li>
  93. {{end}}
  94. {{end}}
  95. {{if .ShowMoreOrgs}}
  96. <li><a class="tw-align-center" href="{{.ContextUser.HomeLink}}?tab=organizations" data-tooltip-content="{{ctx.Locale.Tr "user.show_more"}}">{{svg "octicon-kebab-horizontal" 28 "icon tw-p-1"}}</a></li>
  97. {{end}}
  98. </ul>
  99. </li>
  100. {{end}}
  101. {{if .Badges}}
  102. <li>
  103. <ul class="user-badges">
  104. {{range .Badges}}
  105. <li>
  106. <img loading="lazy" width="64" height="64" src="{{.ImageURL}}" alt="{{.Description}}" data-tooltip-content="{{.Description}}">
  107. </li>
  108. {{end}}
  109. </ul>
  110. </li>
  111. {{end}}
  112. {{if and .IsSigned (ne .SignedUserID .ContextUser.ID)}}
  113. {{if not .UserBlocking}}
  114. <li class="follow" hx-target="#profile-avatar-card" hx-indicator="#profile-avatar-card">
  115. {{if $.IsFollowing}}
  116. <button hx-post="{{.ContextUser.HomeLink}}?action=unfollow" class="ui basic red button">
  117. {{svg "octicon-person"}} {{ctx.Locale.Tr "user.unfollow"}}
  118. </button>
  119. {{else}}
  120. <button hx-post="{{.ContextUser.HomeLink}}?action=follow" class="ui basic primary button">
  121. {{svg "octicon-person"}} {{ctx.Locale.Tr "user.follow"}}
  122. </button>
  123. {{end}}
  124. </li>
  125. {{end}}
  126. <li>
  127. {{if not .UserBlocking}}
  128. <a class="muted 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.action="{{AppSubUrl}}/user/settings/blocked_users">{{ctx.Locale.Tr "user.block.block.user"}}</a>
  129. {{else}}
  130. <a class="muted" href="{{AppSubUrl}}/user/settings/blocked_users">{{ctx.Locale.Tr "user.block.unblock"}}</a>
  131. {{end}}
  132. </li>
  133. {{end}}
  134. </ul>
  135. </div>
  136. </div>
  137. {{template "shared/user/block_user_dialog" .}}