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 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <div class="ui container" id="navbar">
  2. {{$notificationUnreadCount := 0}}
  3. {{if .IsSigned}}
  4. {{if .NotificationUnreadCount}}{{$notificationUnreadCount = call .NotificationUnreadCount}}{{end}}
  5. {{end}}
  6. <div class="item brand" style="justify-content: space-between;">
  7. <a href="{{AppSubUrl}}/" aria-label="{{if .IsSigned}}{{.locale.Tr "dashboard"}}{{else}}{{.locale.Tr "home"}}{{end}}">
  8. <img width="30" height="30" src="{{AssetUrlPrefix}}/img/logo.svg" alt="{{.locale.Tr "logo"}}" aria-hidden="true">
  9. </a>
  10. {{if .IsSigned}}
  11. <a href="{{AppSubUrl}}/notifications" class="tooltip mobile-only" data-content='{{.locale.Tr "notifications"}}'>
  12. <span class="text black">
  13. <span class="fitted">{{svg "octicon-bell"}}</span>
  14. <span class="ui red label mini{{if not $notificationUnreadCount}} hidden{{end}} notification_count">
  15. {{$notificationUnreadCount}}
  16. </span>
  17. </span>
  18. </a>
  19. {{end}}
  20. <div class="ui basic icon button mobile-only" id="navbar-expand-toggle">
  21. <i class="sidebar icon"></i>
  22. </div>
  23. </div>
  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}}<a class="item {{if .PageIsMilestonesDashboard}}active{{end}}" href="{{AppSubUrl}}/milestones">{{.locale.Tr "milestones"}}</a>{{end}}
  35. {{end}}
  36. <a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.locale.Tr "explore"}}</a>
  37. {{else if .IsLandingPageOrganizations}}
  38. <a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/organizations">{{.locale.Tr "explore"}}</a>
  39. {{else}}
  40. <a class="item {{if .PageIsExplore}}active{{end}}" href="{{AppSubUrl}}/explore/repos">{{.locale.Tr "explore"}}</a>
  41. {{end}}
  42. {{template "custom/extra_links" .}}
  43. {{/* TODO
  44. <div class="item">
  45. <div class="ui icon input">
  46. <input class="searchbox" type="text" placeholder="{{.locale.Tr "search_project"}}">
  47. <i class="icon df ac jc">{{svg "octicon-search" 16}}</i>
  48. </div>
  49. </div>
  50. */}}
  51. {{if and .IsSigned .MustChangePassword}}
  52. <div class="right stackable menu">
  53. <div class="ui dropdown jump item tooltip" tabindex="-1" data-content="{{.locale.Tr "user_profile_and_more"}}">
  54. <span class="text">
  55. {{avatar .SignedUser 24 "tiny"}}
  56. <span class="sr-only">{{.locale.Tr "user_profile_and_more"}}</span>
  57. <span class="mobile-only">{{.SignedUser.Name}}</span>
  58. <span class="fitted not-mobile" tabindex="-1">{{svg "octicon-triangle-down"}}</span>
  59. </span>
  60. <div class="menu user-menu" tabindex="-1">
  61. <div class="ui header">
  62. {{.locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
  63. </div>
  64. <div class="divider"></div>
  65. <a class="item link-action" href data-url="{{AppSubUrl}}/user/logout" data-redirect="{{AppSubUrl}}/">
  66. {{svg "octicon-sign-out"}}
  67. {{.locale.Tr "sign_out"}}<!-- Sign Out -->
  68. </a>
  69. </div><!-- end content avatar menu -->
  70. </div><!-- end dropdown avatar menu -->
  71. </div>
  72. {{else if .IsSigned}}
  73. <div class="right stackable menu">
  74. <a class="active-stopwatch-trigger item ui label {{if not .ActiveStopwatch}}hidden{{end}}" href="{{.ActiveStopwatch.IssueLink}}">
  75. <span class="text">
  76. <span class="fitted item">
  77. {{svg "octicon-stopwatch"}}
  78. <span class="red" style="position:absolute; right:-0.6em; top:-0.6em;">{{svg "octicon-dot-fill"}}</span>
  79. </span>
  80. <span class="sr-mobile-only">{{.locale.Tr "active_stopwatch"}}</span>
  81. </span>
  82. </a>
  83. <div class="active-stopwatch-popup tippy-target">
  84. <div class="df ac">
  85. <a class="stopwatch-link df ac" href="{{.ActiveStopwatch.IssueLink}}">
  86. {{svg "octicon-issue-opened" 16 "mr-3"}}
  87. <span class="stopwatch-issue">{{.ActiveStopwatch.RepoSlug}}#{{.ActiveStopwatch.IssueIndex}}</span>
  88. <span class="ui primary label stopwatch-time my-0 mx-4" data-seconds="{{.ActiveStopwatch.Seconds}}">
  89. {{if .ActiveStopwatch}}{{Sec2Time .ActiveStopwatch.Seconds}}{{end}}
  90. </span>
  91. </a>
  92. <form class="stopwatch-commit" method="POST" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/toggle">
  93. {{.CsrfTokenHtml}}
  94. <button
  95. type="submit"
  96. class="ui button mini compact basic icon fitted tooltip"
  97. data-content="{{.locale.Tr "repo.issues.stop_tracking"}}"
  98. data-position="top right"
  99. >{{svg "octicon-square-fill"}}</button>
  100. </form>
  101. <form class="stopwatch-cancel" method="POST" action="{{.ActiveStopwatch.IssueLink}}/times/stopwatch/cancel">
  102. {{.CsrfTokenHtml}}
  103. <button
  104. type="submit"
  105. class="ui button mini compact basic icon fitted tooltip"
  106. data-content="{{.locale.Tr "repo.issues.cancel_tracking"}}"
  107. data-position="top right"
  108. >{{svg "octicon-trash"}}</button>
  109. </form>
  110. </div>
  111. </div>
  112. <a href="{{AppSubUrl}}/notifications" class="item tooltip not-mobile" data-content="{{.locale.Tr "notifications"}}" aria-label="{{.locale.Tr "notifications"}}">
  113. <span class="text">
  114. <span class="fitted">{{svg "octicon-bell"}}</span>
  115. <span class="ui red label {{if not $notificationUnreadCount}}hidden{{end}} notification_count">
  116. {{$notificationUnreadCount}}
  117. </span>
  118. </span>
  119. </a>
  120. <div class="ui dropdown jump item tooltip" data-content="{{.locale.Tr "create_new"}}">
  121. <span class="text">
  122. <span class="fitted">{{svg "octicon-plus"}}</span>
  123. <span class="sr-mobile-only">{{.locale.Tr "create_new"}}</span>
  124. <span class="fitted not-mobile">{{svg "octicon-triangle-down"}}</span>
  125. </span>
  126. <div class="menu">
  127. <a class="item" href="{{AppSubUrl}}/repo/create">
  128. <span class="fitted">{{svg "octicon-plus"}}</span> {{.locale.Tr "new_repo"}}
  129. </a>
  130. {{if not .DisableMigrations}}
  131. <a class="item" href="{{AppSubUrl}}/repo/migrate">
  132. <span class="fitted">{{svg "octicon-repo-push"}}</span> {{.locale.Tr "new_migrate"}}
  133. </a>
  134. {{end}}
  135. {{if .SignedUser.CanCreateOrganization}}
  136. <a class="item" href="{{AppSubUrl}}/org/create">
  137. <span class="fitted">{{svg "octicon-organization"}}</span> {{.locale.Tr "new_org"}}
  138. </a>
  139. {{end}}
  140. </div><!-- end content create new menu -->
  141. </div><!-- end dropdown menu create new -->
  142. <div class="ui dropdown jump item tooltip" tabindex="-1" data-content="{{.locale.Tr "user_profile_and_more"}}">
  143. <span class="text">
  144. {{avatar .SignedUser 24 "tiny"}}
  145. <span class="sr-only">{{.locale.Tr "user_profile_and_more"}}</span>
  146. <span class="mobile-only">{{.SignedUser.Name}}</span>
  147. <span class="fitted not-mobile" tabindex="-1">{{svg "octicon-triangle-down"}}</span>
  148. </span>
  149. <div class="menu user-menu" tabindex="-1">
  150. <div class="ui header">
  151. {{.locale.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
  152. </div>
  153. <div class="divider"></div>
  154. <a class="item" href="{{.SignedUser.HomeLink}}">
  155. {{svg "octicon-person"}}
  156. {{.locale.Tr "your_profile"}}<!-- Your profile -->
  157. </a>
  158. {{if not .DisableStars}}
  159. <a class="item" href="{{.SignedUser.HomeLink}}?tab=stars">
  160. {{svg "octicon-star"}}
  161. {{.locale.Tr "your_starred"}}
  162. </a>
  163. {{end}}
  164. <a class="item" href="{{AppSubUrl}}/notifications/subscriptions">
  165. {{svg "octicon-bell"}}
  166. {{.locale.Tr "notification.subscriptions"}}<!-- Subscriptions -->
  167. </a>
  168. <a class="{{if .PageIsUserSettings}}active{{end}} item" href="{{AppSubUrl}}/user/settings">
  169. {{svg "octicon-tools"}}
  170. {{.locale.Tr "your_settings"}}<!-- Your settings -->
  171. </a>
  172. <a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io">
  173. {{svg "octicon-question"}}
  174. {{.locale.Tr "help"}}<!-- Help -->
  175. </a>
  176. {{if .IsAdmin}}
  177. <div class="divider"></div>
  178. <a class="{{if .PageIsAdmin}}active{{end}} item" href="{{AppSubUrl}}/admin">
  179. {{svg "octicon-server"}}
  180. {{.locale.Tr "admin_panel"}}<!-- Admin Panel -->
  181. </a>
  182. {{end}}
  183. <div class="divider"></div>
  184. <a class="item link-action" href data-url="{{AppSubUrl}}/user/logout" data-redirect="{{AppSubUrl}}/">
  185. {{svg "octicon-sign-out"}}
  186. {{.locale.Tr "sign_out"}}<!-- Sign Out -->
  187. </a>
  188. </div><!-- end content avatar menu -->
  189. </div><!-- end dropdown avatar menu -->
  190. </div><!-- end signed user right menu -->
  191. {{else}}
  192. <a class="item" target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io">{{.locale.Tr "help"}}</a>
  193. <div class="right stackable menu">
  194. {{if .ShowRegistrationButton}}
  195. <a class="item{{if .PageIsSignUp}} active{{end}}" href="{{AppSubUrl}}/user/sign_up">
  196. {{svg "octicon-person"}} {{.locale.Tr "register"}}
  197. </a>
  198. {{end}}
  199. <a class="item{{if .PageIsSignIn}} active{{end}}" rel="nofollow" href="{{AppSubUrl}}/user/login{{if not .PageIsSignIn}}?redirect_to={{.CurrentURL}}{{end}}">
  200. {{svg "octicon-sign-in"}} {{.locale.Tr "sign_in"}}
  201. </a>
  202. </div><!-- end anonymous right menu -->
  203. {{end}}
  204. </div>