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

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