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.

header.tmpl 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <div class="header-wrapper">
  2. {{with .Repository}}
  3. <div class="ui container">
  4. <div class="repo-header">
  5. <div class="repo-title-wrap gt-df gt-fc">
  6. <div class="repo-title" role="heading" aria-level="1">
  7. {{$avatar := (repoAvatar . 32 "gt-mr-3")}}
  8. {{if $avatar}}
  9. {{$avatar}}
  10. {{else}}
  11. <div class="gt-mr-3">
  12. {{template "repo/icon" .}}
  13. </div>
  14. {{end}}
  15. <a href="{{.Owner.HomeLink}}">{{.Owner.Name}}</a>
  16. <div class="gt-mx-2">/</div>
  17. <a href="{{$.RepoLink}}">{{.Name}}</a>
  18. <div class="labels gt-df gt-ac gt-fw">
  19. {{if .IsTemplate}}
  20. {{if .IsPrivate}}
  21. <span class="ui basic label">{{$.locale.Tr "repo.desc.private_template"}}</span>
  22. {{else}}
  23. {{if .Owner.Visibility.IsPrivate}}
  24. <span class="ui basic label">{{$.locale.Tr "repo.desc.internal_template"}}</span>
  25. {{end}}
  26. {{end}}
  27. {{else}}
  28. {{if .IsPrivate}}
  29. <span class="ui basic label">{{$.locale.Tr "repo.desc.private"}}</span>
  30. {{else}}
  31. {{if .Owner.Visibility.IsPrivate}}
  32. <span class="ui basic label">{{$.locale.Tr "repo.desc.internal"}}</span>
  33. {{end}}
  34. {{end}}
  35. {{end}}
  36. {{if .IsArchived}}
  37. <span class="ui basic label">{{$.locale.Tr "repo.desc.archived"}}</span>
  38. {{end}}
  39. </div>
  40. {{if $.EnableFeed}}
  41. <a class="rss-icon gt-ml-3" href="{{$.RepoLink}}.rss" data-tooltip-content="{{$.locale.Tr "rss_feed"}}">{{svg "octicon-rss" 18}}</a>
  42. {{end}}
  43. </div>
  44. {{if $.PullMirror}}
  45. {{$address := MirrorRemoteAddress $.Context . $.PullMirror.GetRemoteName false}}
  46. <div class="fork-flag">{{$.locale.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{$address.Address}}">{{$address.Address}}</a></div>
  47. {{end}}
  48. {{if .IsFork}}<div class="fork-flag">{{$.locale.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{.BaseRepo.FullName}}</a></div>{{end}}
  49. {{if .IsGenerated}}<div class="fork-flag">{{$.locale.Tr "repo.generated_from"}} <a href="{{.TemplateRepo.Link}}">{{.TemplateRepo.FullName}}</a></div>{{end}}
  50. </div>
  51. {{if not (or .IsBeingCreated .IsBroken)}}
  52. <div class="repo-buttons">
  53. {{if $.RepoTransfer}}
  54. <form method="post" action="{{$.RepoLink}}/action/accept_transfer?redirect_to={{$.RepoLink}}">
  55. {{$.CsrfTokenHtml}}
  56. <div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{$.locale.Tr "repo.transfer.accept_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{$.locale.Tr "repo.transfer.no_permission_to_accept"}}{{end}}">
  57. <button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}green {{end}} ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}>
  58. {{$.locale.Tr "repo.transfer.accept"}}
  59. </button>
  60. </div>
  61. </form>
  62. <form method="post" action="{{$.RepoLink}}/action/reject_transfer?redirect_to={{$.RepoLink}}">
  63. {{$.CsrfTokenHtml}}
  64. <div data-tooltip-content="{{if $.CanUserAcceptTransfer}}{{$.locale.Tr "repo.transfer.reject_desc" $.RepoTransfer.Recipient.DisplayName}}{{else}}{{$.locale.Tr "repo.transfer.no_permission_to_reject"}}{{end}}">
  65. <button type="submit" class="ui basic button {{if $.CanUserAcceptTransfer}}red {{end}}ok small"{{if not $.CanUserAcceptTransfer}} disabled{{end}}>
  66. {{$.locale.Tr "repo.transfer.reject"}}
  67. </button>
  68. </div>
  69. </form>
  70. {{end}}
  71. <form method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}">
  72. {{$.CsrfTokenHtml}}
  73. <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{$.locale.Tr "repo.watch_guest_user"}}"{{end}}>
  74. <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
  75. {{if $.IsWatchingRepo}}{{svg "octicon-eye-closed" 16}}{{$.locale.Tr "repo.unwatch"}}{{else}}{{svg "octicon-eye"}}{{$.locale.Tr "repo.watch"}}{{end}}
  76. </button>
  77. <a class="ui basic label" href="{{.Link}}/watchers">
  78. {{CountFmt .NumWatches}}
  79. </a>
  80. </div>
  81. </form>
  82. {{if not $.DisableStars}}
  83. <form method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
  84. {{$.CsrfTokenHtml}}
  85. <div class="ui labeled button" {{if not $.IsSigned}}data-tooltip-content="{{$.locale.Tr "repo.star_guest_user"}}"{{end}}>
  86. <button type="submit" class="ui compact small basic button"{{if not $.IsSigned}} disabled{{end}}>
  87. {{if $.IsStaringRepo}}{{svg "octicon-star-fill"}}{{$.locale.Tr "repo.unstar"}}{{else}}{{svg "octicon-star"}}{{$.locale.Tr "repo.star"}}{{end}}
  88. </button>
  89. <a class="ui basic label" href="{{.Link}}/stars">
  90. {{CountFmt .NumStars}}
  91. </a>
  92. </div>
  93. </form>
  94. {{end}}
  95. {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
  96. <div class="ui labeled button
  97. {{if or (not $.IsSigned) (and (not $.CanSignedUserFork) (eq (len $.UserAndOrgForks) 0))}}
  98. disabled
  99. {{end}}"
  100. {{if not $.IsSigned}}
  101. data-tooltip-content="{{$.locale.Tr "repo.fork_guest_user"}}"
  102. {{else if and (not $.CanSignedUserFork) (eq (len $.UserAndOrgForks) 0)}}
  103. data-tooltip-content="{{$.locale.Tr "repo.fork_from_self"}}"
  104. {{end}}
  105. >
  106. <a class="ui compact{{if $.ShowForkModal}} show-modal{{end}} small basic button"
  107. {{if not $.CanSignedUserFork}}
  108. {{if gt (len $.UserAndOrgForks) 1}}
  109. data-modal="#fork-repo-modal"
  110. {{else if eq (len $.UserAndOrgForks) 1}}
  111. href="{{AppSubUrl}}/{{(index $.UserAndOrgForks 0).FullName}}"
  112. {{/*else is not required here, because the button shouldn't link to any site if you can't create a fork*/}}
  113. {{end}}
  114. {{else if eq (len $.UserAndOrgForks) 0}}
  115. href="{{AppSubUrl}}/repo/fork/{{.ID}}"
  116. {{else}}
  117. data-modal="#fork-repo-modal"
  118. {{end}}
  119. >
  120. {{svg "octicon-repo-forked"}}{{$.locale.Tr "repo.fork"}}
  121. </a>
  122. <div class="ui small modal" id="fork-repo-modal">
  123. <div class="header">
  124. {{$.locale.Tr "repo.already_forked" .Name}}
  125. </div>
  126. <div class="content gt-text-left">
  127. <div class="ui list">
  128. {{range $.UserAndOrgForks}}
  129. <div class="ui item gt-py-3">
  130. <a href="{{.Link}}">
  131. {{svg "octicon-repo-forked" 16 "gt-mr-3"}}{{.FullName}}
  132. </a>
  133. </div>
  134. {{end}}
  135. </div>
  136. {{if $.CanSignedUserFork}}
  137. <div class="divider"></div>
  138. <a href="{{AppSubUrl}}/repo/fork/{{.ID}}">
  139. {{$.locale.Tr "repo.fork_to_different_account"}}
  140. </a>
  141. {{end}}
  142. </div>
  143. </div>
  144. <a class="ui basic label" href="{{.Link}}/forks">
  145. {{CountFmt .NumForks}}
  146. </a>
  147. </div>
  148. {{end}}
  149. </div>
  150. {{end}}
  151. </div><!-- end grid -->
  152. </div><!-- end container -->
  153. {{end}}
  154. <div class="ui tabs container">
  155. {{if not (or .Repository.IsBeingCreated .Repository.IsBroken)}}
  156. <div class="ui tabular menu navbar gt-overflow-x-auto gt-overflow-y-hidden">
  157. {{if .Permission.CanRead $.UnitTypeCode}}
  158. <a class="{{if .PageIsViewCode}}active {{end}}item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL}}{{end}}">
  159. {{svg "octicon-code"}} {{.locale.Tr "repo.code"}}
  160. </a>
  161. {{end}}
  162. {{if .Permission.CanRead $.UnitTypeIssues}}
  163. <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoLink}}/issues">
  164. {{svg "octicon-issue-opened"}} {{.locale.Tr "repo.issues"}}
  165. {{if .Repository.NumOpenIssues}}
  166. <span class="ui small label">{{CountFmt .Repository.NumOpenIssues}}</span>
  167. {{end}}
  168. </a>
  169. {{end}}
  170. {{if .Permission.CanRead $.UnitTypeExternalTracker}}
  171. <a class="{{if .PageIsIssueList}}active {{end}}item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
  172. {{svg "octicon-link-external"}} {{.locale.Tr "repo.issues"}}
  173. </a>
  174. {{end}}
  175. {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
  176. <a class="{{if .PageIsPullList}}active {{end}}item" href="{{.RepoLink}}/pulls">
  177. {{svg "octicon-git-pull-request"}} {{.locale.Tr "repo.pulls"}}
  178. {{if .Repository.NumOpenPulls}}
  179. <span class="ui small label">{{CountFmt .Repository.NumOpenPulls}}</span>
  180. {{end}}
  181. </a>
  182. {{end}}
  183. {{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}}
  184. <a class="{{if .PageIsActions}}active {{end}}item" href="{{.RepoLink}}/actions">
  185. {{svg "octicon-play"}} {{.locale.Tr "actions.actions"}}
  186. {{if .Repository.NumOpenActionRuns}}
  187. <span class="ui small label">{{CountFmt .Repository.NumOpenActionRuns}}</span>
  188. {{end}}
  189. </a>
  190. {{end}}
  191. {{if .Permission.CanRead $.UnitTypePackages}}
  192. <a href="{{.RepoLink}}/packages" class="{{if .IsPackagesPage}}active {{end}}item">
  193. {{svg "octicon-package"}} {{.locale.Tr "packages.title"}}
  194. </a>
  195. {{end}}
  196. {{if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}}
  197. <a href="{{.RepoLink}}/projects" class="{{if .IsProjectsPage}}active {{end}}item">
  198. {{svg "octicon-project"}} {{.locale.Tr "repo.project_board"}}
  199. {{if .Repository.NumOpenProjects}}
  200. <span class="ui small label">{{CountFmt .Repository.NumOpenProjects}}</span>
  201. {{end}}
  202. </a>
  203. {{end}}
  204. {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo)}}
  205. <a class="{{if or .PageIsReleaseList .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/releases">
  206. {{svg "octicon-tag"}} {{.locale.Tr "repo.releases"}}
  207. {{if .NumReleases}}
  208. <span class="ui small label">{{CountFmt .NumReleases}}</span>
  209. {{end}}
  210. </a>
  211. {{end}}
  212. {{if .Permission.CanRead $.UnitTypeWiki}}
  213. <a class="{{if .PageIsWiki}}active {{end}}item" href="{{.RepoLink}}/wiki">
  214. {{svg "octicon-book"}} {{.locale.Tr "repo.wiki"}}
  215. </a>
  216. {{end}}
  217. {{if .Permission.CanRead $.UnitTypeExternalWiki}}
  218. <a class="item" href="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}" target="_blank" rel="noopener noreferrer">
  219. {{svg "octicon-link-external"}} {{.locale.Tr "repo.wiki"}}
  220. </a>
  221. {{end}}
  222. {{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}}
  223. <a class="{{if .PageIsActivity}}active {{end}}item" href="{{.RepoLink}}/activity">
  224. {{svg "octicon-pulse"}} {{.locale.Tr "repo.activity"}}
  225. </a>
  226. {{end}}
  227. {{template "custom/extra_tabs" .}}
  228. {{if .Permission.IsAdmin}}
  229. <a class="{{if .PageIsRepoSettings}}active {{end}}right item" href="{{.RepoLink}}/settings">
  230. {{svg "octicon-tools"}} {{.locale.Tr "repo.settings"}}
  231. </a>
  232. {{end}}
  233. </div>
  234. {{else if .Permission.IsAdmin}}
  235. <div class="ui tabular menu navbar gt-overflow-x-auto gt-overflow-y-hidden">
  236. <a class="{{if .PageIsRepoSettings}}active {{end}}right item" href="{{.RepoLink}}/settings">
  237. {{svg "octicon-tools"}} {{.locale.Tr "repo.settings"}}
  238. </a>
  239. </div>
  240. {{end}}
  241. </div>
  242. <div class="ui tabs divider"></div>
  243. </div>