gitea源码

navbar.tmpl 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <div class="secondary-nav tw-border-b tw-border-b-secondary">
  2. <div class="ui secondary stackable menu">
  3. <div class="item">
  4. <div class="ui floating dropdown jump">
  5. <span class="text">
  6. {{ctx.AvatarUtils.Avatar .ContextUser 24 "tw-mr-1"}}
  7. <span class="gt-ellipsis">{{.ContextUser.ShortName 40}}</span>
  8. <span class="org-visibility">
  9. {{if .ContextUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
  10. {{if .ContextUser.Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
  11. </span>
  12. {{svg "octicon-triangle-down" 14 "dropdown icon tw-ml-1"}}
  13. </span>
  14. <div class="menu context-user-switch">
  15. <div class="header">
  16. {{ctx.Locale.Tr "home.switch_dashboard_context"}}
  17. </div>
  18. <div class="scrolling menu">
  19. <a class="{{if eq .ContextUser.ID .SignedUser.ID}}active selected{{end}} item" href="{{AppSubUrl}}/{{if .PageIsIssues}}issues{{else if .PageIsPulls}}pulls{{else if .PageIsMilestonesDashboard}}milestones{{end}}">
  20. {{ctx.AvatarUtils.Avatar .SignedUser}}
  21. <span class="gt-ellipsis">{{.SignedUser.ShortName 40}}</span>
  22. <span class="org-visibility">
  23. {{if .SignedUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
  24. {{if .SignedUser.Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
  25. </span>
  26. </a>
  27. {{range .Orgs}}
  28. <a class="{{if eq $.ContextUser.ID .ID}}active selected{{end}} item" title="{{.Name}}" href="{{.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}">
  29. {{ctx.AvatarUtils.Avatar .}}
  30. <span class="gt-ellipsis">{{.ShortName 40}}</span>
  31. <span class="org-visibility">
  32. {{if .Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
  33. {{if .Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{ctx.Locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
  34. </span>
  35. </a>
  36. {{end}}
  37. </div>
  38. {{if .SignedUser.CanCreateOrganization}}
  39. <a class="item" href="{{AppSubUrl}}/org/create">
  40. {{svg "octicon-plus" 16 "tw-ml-1 tw-mr-5"}}{{ctx.Locale.Tr "new_org"}}
  41. </a>
  42. {{end}}
  43. </div>
  44. </div>
  45. </div>
  46. {{if .ContextUser.IsOrganization}}
  47. <div class="item">
  48. <div class="ui floating dropdown jump">
  49. <span class="text">
  50. {{svg "octicon-people" 18}}
  51. {{if .Team}}
  52. {{.Team.Name}}
  53. {{else}}
  54. {{ctx.Locale.Tr "org.teams"}}
  55. {{end}}
  56. </span>
  57. {{svg "octicon-triangle-down" 14 "dropdown icon"}}
  58. <div class="context user overflow menu">
  59. <div class="header">
  60. {{ctx.Locale.Tr "home.filter_by_team_repositories"}}
  61. </div>
  62. <div class="scrolling menu items">
  63. <a class="{{if not $.Team}}active selected{{end}} item" title="{{ctx.Locale.Tr "all"}}" href="{{$.Org.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}">
  64. {{ctx.Locale.Tr "all"}}
  65. </a>
  66. {{range .Teams}}
  67. {{if not .IncludesAllRepositories}}
  68. <a class="{{if $.Team}}{{if eq $.Team.ID .ID}}active selected{{end}}{{end}} item" title="{{.Name}}" href="{{$.Org.OrganisationLink}}/{{if $.PageIsIssues}}issues{{else if $.PageIsPulls}}pulls{{else if $.PageIsMilestonesDashboard}}milestones{{else}}dashboard{{end}}/{{.Name}}">
  69. {{.Name}}
  70. </a>
  71. {{end}}
  72. {{end}}
  73. </div>
  74. </div>
  75. </div>
  76. </div>
  77. {{end}}
  78. {{if .ContextUser.IsOrganization}}
  79. <div class="right menu tw-flex-wrap tw-justify-end">
  80. <a class="{{if .PageIsNews}}active {{end}}item tw-ml-auto" href="{{.ContextUser.DashboardLink}}{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
  81. {{svg "octicon-rss"}}&nbsp;{{ctx.Locale.Tr "activities"}}
  82. </a>
  83. {{if not ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled}}
  84. <a class="{{if .PageIsIssues}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/issues{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
  85. {{svg "octicon-issue-opened"}}&nbsp;{{ctx.Locale.Tr "issues"}}
  86. </a>
  87. {{end}}
  88. {{if not ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled}}
  89. <a class="{{if .PageIsPulls}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/pulls{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
  90. {{svg "octicon-git-pull-request"}}&nbsp;{{ctx.Locale.Tr "pull_requests"}}
  91. </a>
  92. {{end}}
  93. {{if and .ShowMilestonesDashboardPage (not (and ctx.Consts.RepoUnitTypeIssues.UnitGlobalDisabled ctx.Consts.RepoUnitTypePullRequests.UnitGlobalDisabled))}}
  94. <a class="{{if .PageIsMilestonesDashboard}}active {{end}}item" href="{{.ContextUser.OrganisationLink}}/milestones{{if .Team}}/{{PathEscape .Team.Name}}{{end}}">
  95. {{svg "octicon-milestone"}}&nbsp;{{ctx.Locale.Tr "milestones"}}
  96. </a>
  97. {{end}}
  98. <div class="item">
  99. <a class="ui primary basic button" href="{{.ContextUser.HomeLink}}" title="{{ctx.Locale.Tr "home.view_home" .ContextUser.Name}}">
  100. {{ctx.Locale.Tr "home.view_home" (.ContextUser.ShortName 20)}}
  101. </a>
  102. </div>
  103. </div>
  104. {{end}}
  105. </div>
  106. </div>