You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

head_navbar.tmpl 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. {{$notificationUnreadCount := 0}}
  2. {{if and .IsSigned .NotificationUnreadCount}}
  3. {{$notificationUnreadCount = call .NotificationUnreadCount}}
  4. {{end}}
  5. <nav id="navbar" aria-label="{{.locale.Tr "aria.navbar"}}">
  6. <div class="navbar-left ui secondary menu">
  7. <!-- the logo -->
  8. <a class="item" id="navbar-logo" href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{.locale.Tr "dashboard"}}{{else}}{{.locale.Tr "home"}}{{end}}">
  9. <img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}" aria-hidden="true">
  10. </a>
  11. <!-- mobile right menu, it must be here because in mobile view, each item is a flex column, the first item is a full row column -->
  12. <div class="ui secondary menu item navbar-mobile-right">
  13. {{if .IsSigned}}
  14. <a id="mobile-notifications-icon" class="item gt-w-auto gt-p-3" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{.locale.Tr "notifications"}}" aria-label="{{.locale.Tr "notifications"}}">
  15. <div class="gt-relative">
  16. {{svg "octicon-bell"}}
  17. <span class="notification_count{{if not $notificationUnreadCount}} gt-hidden{{end}}">{{$notificationUnreadCount}}</span>
  18. </div>
  19. </a>
  20. {{end}}
  21. <button class="item gt-w-auto ui icon mini button gt-p-3 gt-m-0" id="navbar-expand-toggle">{{svg "octicon-three-bars"}}</button>
  22. </div>
  23. <!-- navbar links non-mobile -->
  24. {{if and .IsSigned .MustChangePassword}}
  25. {{/* No links */}}
  26. {{else if .IsSigned}}
  27. {{if not .UnitIssuesGlobalDisabled}}
  28. <a class="item{{if .PageIsIssues}} active{{end}}" href="{{AppSubUrl}}/issues">{{.locale.Tr "issues"}}</a>
  29. {{end}}
  30. {{if not .UnitPullsGlobalDisabled}}
  31. <a class="item{{if .PageIsPulls}} active{{end}}" href="{{AppSubUrl}}/pulls">{{.locale.Tr "pull_requests"}}</a>
  32. {{end}}
  33. {{if not (and .UnitIssuesGlobalDisabled .UnitPullsGlobalDisabled)}}
  34. {{if .ShowMilestonesDashboardPage}}
  35. <a class="item{{if .PageIsMilestonesDashboard}} active{{end}}" href="{{AppSubUrl}}/milestones">{{.locale.Tr "milestones"}}</a>
  36. {{end}}
  37. {{end}}
  38. <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.locale.Tr "explore"}}</a>
  39. {{else if .IsLandingPageOrganizations}}
  40. <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/organizations">{{.locale.Tr "explore"}}</a>
  41. {{else}}
  42. <a class="item{{if .PageIsExplore}} active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.locale.Tr "explore"}}</a>
  43. {{end}}
  44. {{template "custom/extra_links" .}}
  45. {{if not .IsSigned}}
  46. <a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com">{{.locale.Tr "help"}}</a>
  47. {{end}}
  48. </div>
  49. <!-- the full dropdown menus -->
  50. <div class="navbar-right ui secondary menu">
  51. {{if and .IsSigned .MustChangePassword}}
  52. <div class="ui dropdown jump item" data-tooltip-content="{{.locale.Tr "user_profile_and_more"}}">
  53. <span class="text gt-df gt-ac">
  54. {{ctx.AvatarUtils.Avatar .SignedUser 24 "gt-mr-2"}}
  55. <span class="mobile-only gt-ml-3">{{.SignedUser.Name}}</span>
  56. <span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
  57. </span>
  58. <div class="menu user-menu">
  59. <div class="ui header">
  60. {{.locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
  61. </div>
  62. <div class="divider"></div>
  63. <a class="item link-action" href data-url="{{AppSubUrl}}/user/logout">
  64. {{svg "octicon-sign-out"}}
  65. {{.locale.Tr "sign_out"}}
  66. </a>
  67. </div><!-- end content avatar menu -->
  68. </div><!-- end dropdown avatar menu -->
  69. {{else if .IsSigned}}
  70. {{if EnableTimetracking}}
  71. <a class="active-stopwatch-trigger item gt-mx-0{{if not .ActiveStopwatch}} gt-hidden{{end}}" href="{{.ActiveStopwatch.IssueLink}}" title="{{.locale.Tr "active_stopwatch"}}">
  72. <div class="gt-relative">
  73. {{svg "octicon-stopwatch"}}
  74. <span class="header-stopwatch-dot"></span>
  75. </div>
  76. <span class="mobile-only gt-ml-3">{{.locale.Tr "active_stopwatch"}}</span>
  77. </a>
  78. <div class="active-stopwatch-popup item tippy-target gt-p-3">
  79. <div class="gt-df gt-ac">
  80. <a class="stopwatch-link gt-df gt-ac" href="{{.ActiveStopwatch.IssueLink}}">
  81. {{svg "octicon-issue-opened" 16 "gt-mr-3"}}
  82. <span class="stopwatch-issue">{{.ActiveStopwatch.RepoSlug}}#{{.ActiveStopwatch.IssueIndex}}</span>
  83. <span class="ui primary label stopwatch-time gt-my-0 gt-mx-4" data-seconds="{{.ActiveStopwatch.Seconds}}">
  84. {{if .ActiveStopwatch}}{{Sec2Time .ActiveStopwatch.Seconds}}{{end}}
  85. </span>
  86. </a>
  87. <form class="stopwatch-commit" method="post" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/toggle">
  88. {{.CsrfTokenHtml}}
  89. <button
  90. type="submit"
  91. class="ui button mini compact basic icon"
  92. data-tooltip-content="{{.locale.Tr "repo.issues.stop_tracking"}}"
  93. >{{svg "octicon-square-fill"}}</button>
  94. </form>
  95. <form class="stopwatch-cancel" method="post" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/cancel">
  96. {{.CsrfTokenHtml}}
  97. <button
  98. type="submit"
  99. class="ui button mini compact basic icon"
  100. data-tooltip-content="{{.locale.Tr "repo.issues.cancel_tracking"}}"
  101. >{{svg "octicon-trash"}}</button>
  102. </form>
  103. </div>
  104. </div>
  105. {{end}}
  106. <a class="item not-mobile gt-mx-0" href="{{AppSubUrl}}/notifications" data-tooltip-content="{{.locale.Tr "notifications"}}" aria-label="{{.locale.Tr "notifications"}}">
  107. <div class="gt-relative">
  108. {{svg "octicon-bell"}}
  109. <span class="notification_count{{if not $notificationUnreadCount}} gt-hidden{{end}}">{{$notificationUnreadCount}}</span>
  110. </div>
  111. </a>
  112. <div class="ui dropdown jump item gt-mx-0 gt-pr-3" data-tooltip-content="{{.locale.Tr "create_new"}}">
  113. <span class="text">
  114. {{svg "octicon-plus"}}
  115. <span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
  116. <span class="mobile-only">{{.locale.Tr "create_new"}}</span>
  117. </span>
  118. <div class="menu">
  119. <a class="item" href="{{AppSubUrl}}/repo/create">
  120. {{svg "octicon-plus"}} {{.locale.Tr "new_repo"}}
  121. </a>
  122. {{if not .DisableMigrations}}
  123. <a class="item" href="{{AppSubUrl}}/repo/migrate">
  124. {{svg "octicon-repo-push"}} {{.locale.Tr "new_migrate"}}
  125. </a>
  126. {{end}}
  127. {{if .SignedUser.CanCreateOrganization}}
  128. <a class="item" href="{{AppSubUrl}}/org/create">
  129. {{svg "octicon-organization"}} {{.locale.Tr "new_org"}}
  130. </a>
  131. {{end}}
  132. </div><!-- end content create new menu -->
  133. </div><!-- end dropdown menu create new -->
  134. <div class="ui dropdown jump item gt-mx-0 gt-pr-3" data-tooltip-content="{{.locale.Tr "user_profile_and_more"}}">
  135. <span class="text gt-df gt-ac">
  136. {{ctx.AvatarUtils.Avatar .SignedUser 24 "gt-mr-2"}}
  137. <span class="mobile-only gt-ml-3">{{.SignedUser.Name}}</span>
  138. <span class="not-mobile">{{svg "octicon-triangle-down"}}</span>
  139. </span>
  140. <div class="menu user-menu">
  141. <div class="ui header">
  142. {{.locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
  143. </div>
  144. <div class="divider"></div>
  145. <a class="item" href="{{.SignedUser.HomeLink}}">
  146. {{svg "octicon-person"}}
  147. {{.locale.Tr "your_profile"}}
  148. </a>
  149. {{if not .DisableStars}}
  150. <a class="item" href="{{.SignedUser.HomeLink}}?tab=stars">
  151. {{svg "octicon-star"}}
  152. {{.locale.Tr "your_starred"}}
  153. </a>
  154. {{end}}
  155. <a class="item" href="{{AppSubUrl}}/notifications/subscriptions">
  156. {{svg "octicon-bell"}}
  157. {{.locale.Tr "notification.subscriptions"}}
  158. </a>
  159. <a class="{{if .PageIsUserSettings}}active {{end}}item" href="{{AppSubUrl}}/user/settings">
  160. {{svg "octicon-tools"}}
  161. {{.locale.Tr "your_settings"}}
  162. </a>
  163. <a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com">
  164. {{svg "octicon-question"}}
  165. {{.locale.Tr "help"}}
  166. </a>
  167. {{if .IsAdmin}}
  168. <div class="divider"></div>
  169. <a class="{{if .PageIsAdmin}}active {{end}}item" href="{{AppSubUrl}}/admin">
  170. {{svg "octicon-server"}}
  171. {{.locale.Tr "admin_panel"}}
  172. </a>
  173. {{end}}
  174. <div class="divider"></div>
  175. <a class="item link-action" href data-url="{{AppSubUrl}}/user/logout">
  176. {{svg "octicon-sign-out"}}
  177. {{.locale.Tr "sign_out"}}
  178. </a>
  179. </div><!-- end content avatar menu -->
  180. </div><!-- end dropdown avatar menu -->
  181. {{else}}
  182. {{if .ShowRegistrationButton}}
  183. <a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubUrl}}/user/sign_up">
  184. {{svg "octicon-person"}} {{.locale.Tr "register"}}
  185. </a>
  186. {{end}}
  187. <a class="item{{if .PageIsSignIn}} active{{end}}" rel="nofollow" href="{{AppSubUrl}}/user/login{{if not .PageIsSignIn}}?redirect_to={{.CurrentURL}}{{end}}">
  188. {{svg "octicon-sign-in"}} {{.locale.Tr "sign_in"}}
  189. </a>
  190. {{end}}
  191. </div><!-- end full right menu -->
  192. </nav>