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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <div class="header-wrapper">
  2. {{with .Repository}}
  3. <div class="ui container">
  4. <div class="repo-header">
  5. <div class="ui huge breadcrumb repo-title">
  6. {{if .RelAvatarLink}}
  7. <img class="ui avatar image" src="{{.RelAvatarLink}}">
  8. {{else}}
  9. {{template "repo/header_icon" .}}
  10. {{end}}
  11. <a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
  12. <div class="divider"> / </div>
  13. <a href="{{$.RepoLink}}">{{.Name}}</a>
  14. {{if .IsTemplate}}
  15. {{if .IsPrivate}}
  16. <span class="ui basic label">{{$.i18n.Tr "repo.desc.private_template"}}</span>
  17. {{else}}
  18. {{if .Owner.Visibility.IsPrivate}}
  19. <span class="ui basic label">{{$.i18n.Tr "repo.desc.internal_template"}}</span>
  20. {{end}}
  21. {{end}}
  22. {{else}}
  23. {{if .IsPrivate}}
  24. <span class="ui basic label">{{$.i18n.Tr "repo.desc.private"}}</span>
  25. {{else}}
  26. {{if .Owner.Visibility.IsPrivate}}
  27. <span class="ui basic label">{{$.i18n.Tr "repo.desc.internal"}}</span>
  28. {{end}}
  29. {{end}}
  30. {{end}}
  31. {{if .IsArchived}}<span class="ui compact label">{{$.i18n.Tr "repo.desc.archived"}}</span>{{end}}
  32. {{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener noreferrer" href="{{if .SanitizedOriginalURL}}{{.SanitizedOriginalURL}}{{else}}{{MirrorAddress $.Mirror}}{{end}}">{{if .SanitizedOriginalURL}}{{.SanitizedOriginalURL}}{{else}}{{MirrorAddress $.Mirror}}{{end}}</a></div>{{end}}
  33. {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{SubStr .BaseRepo.RelLink 1 -1}}</a></div>{{end}}
  34. {{if .IsGenerated}}<div class="fork-flag">{{$.i18n.Tr "repo.generated_from"}} <a href="{{.TemplateRepo.Link}}">{{SubStr .TemplateRepo.RelLink 1 -1}}</a></div>{{end}}
  35. </div>
  36. {{if not .IsBeingCreated}}
  37. <div class="repo-buttons">
  38. <form method="post" action="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}">
  39. {{$.CsrfTokenHtml}}
  40. <div class="ui labeled button" tabindex="0">
  41. <button type="submit" class="ui compact basic button">
  42. {{if $.IsWatchingRepo}}{{svg "octicon-eye-closed" 16}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{svg "octicon-eye" 16}}{{$.i18n.Tr "repo.watch"}}{{end}}
  43. </button>
  44. <a class="ui basic label" href="{{.Link}}/watchers">
  45. {{.NumWatches}}
  46. </a>
  47. </div>
  48. </form>
  49. <form method="post" action="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
  50. {{$.CsrfTokenHtml}}
  51. <div class="ui labeled button" tabindex="0">
  52. <button type="submit" class="ui compact basic button">
  53. {{if $.IsStaringRepo}}{{svg "octicon-star-fill" 16}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{svg "octicon-star" 16}}{{$.i18n.Tr "repo.star"}}{{end}}
  54. </button>
  55. <a class="ui basic label" href="{{.Link}}/stars">
  56. {{.NumStars}}
  57. </a>
  58. </div>
  59. </form>
  60. {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
  61. <div class="ui labeled button {{if and ($.IsSigned) (not $.CanSignedUserFork)}}disabled-repo-button{{end}}" tabindex="0">
  62. <a class="ui compact basic button {{if or (not $.IsSigned) (not $.CanSignedUserFork)}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else if $.IsSigned}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" {{ else }} data-content="{{$.i18n.Tr "repo.fork_guest_user" }}" rel="nofollow" href="{{AppSubUrl}}/user/login?redirect_to={{AppSubUrl}}/repo/fork/{{.ID}}" {{end}} data-position="top center" data-variation="tiny">
  63. {{svg "octicon-repo-forked" 16}}{{$.i18n.Tr "repo.fork"}}
  64. </a>
  65. <a class="ui basic label" href="{{.Link}}/forks">
  66. {{.NumForks}}
  67. </a>
  68. </div>
  69. {{end}}
  70. </div>
  71. {{end}}
  72. </div><!-- end grid -->
  73. </div><!-- end container -->
  74. {{end}}
  75. <div class="ui tabs container">
  76. {{if not .Repository.IsBeingCreated}}
  77. <div class="ui tabular stackable menu navbar">
  78. {{if .Permission.CanRead $.UnitTypeCode}}
  79. <a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL | EscapePound}}{{end}}">
  80. {{svg "octicon-code" 16}} {{.i18n.Tr "repo.code"}}
  81. </a>
  82. {{end}}
  83. {{if .Permission.CanRead $.UnitTypeIssues}}
  84. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
  85. {{svg "octicon-issue-opened" 16}} {{.i18n.Tr "repo.issues"}} <span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span>
  86. </a>
  87. {{end}}
  88. {{if .Permission.CanRead $.UnitTypeExternalTracker}}
  89. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
  90. {{svg "octicon-link-external" 16}} {{.i18n.Tr "repo.issues"}} </span>
  91. </a>
  92. {{end}}
  93. {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
  94. <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
  95. {{svg "octicon-git-pull-request" 16}} {{.i18n.Tr "repo.pulls"}} <span class="ui {{if not .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span>
  96. </a>
  97. {{end}}
  98. {{ if and (not .UnitProjectsGlobalDisabled) (.Permission.CanRead $.UnitTypeProjects)}}
  99. <a href="{{.RepoLink}}/projects" class="{{ if .IsProjectsPage }}active{{end}} item">
  100. {{svg "octicon-project" 16}} {{.i18n.Tr "repo.project_board"}}
  101. <span class="ui {{if not .Repository.NumOpenProjects}}gray{{else}}blue{{end}} small label">
  102. {{.Repository.NumOpenProjects}}
  103. </span>
  104. </a>
  105. {{ end }}
  106. {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }}
  107. <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
  108. {{svg "octicon-tag" 16}} {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .NumReleases}}gray{{else}}blue{{end}} small label">{{.NumReleases}}</span>
  109. </a>
  110. {{end}}
  111. {{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}}
  112. <a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if (.Permission.CanRead $.UnitTypeExternalWiki)}} target="_blank" rel="noopener noreferrer" {{end}}>
  113. {{svg "octicon-book" 16}} {{.i18n.Tr "repo.wiki"}}
  114. </a>
  115. {{end}}
  116. {{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}}
  117. <a class="{{if .PageIsActivity}}active{{end}} item" href="{{.RepoLink}}/activity">
  118. {{svg "octicon-pulse" 16}} {{.i18n.Tr "repo.activity"}}
  119. </a>
  120. {{end}}
  121. {{template "custom/extra_tabs" .}}
  122. {{if .Permission.IsAdmin}}
  123. <div class="right menu">
  124. <a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">
  125. {{svg "octicon-tools" 16}} {{.i18n.Tr "repo.settings"}}
  126. </a>
  127. </div>
  128. {{end}}
  129. </div>
  130. {{end}}
  131. </div>
  132. <div class="ui tabs divider"></div>
  133. </div>