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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 if .IsTemplate}}
  9. {{if .IsPrivate}}
  10. {{svg "octicon-repo-template-private" 32}}
  11. {{else}}
  12. {{svg "octicon-repo-template" 32}}
  13. {{end}}
  14. {{else}}
  15. {{if .IsPrivate}}
  16. {{svg "octicon-lock" 32}}
  17. {{else if .IsMirror}}
  18. {{svg "octicon-repo-clone" 32}}
  19. {{else if .IsFork}}
  20. {{svg "octicon-repo-fork" 32}}
  21. {{else}}
  22. {{svg "octicon-repo" 32}}
  23. {{end}}
  24. {{end}}
  25. <a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
  26. <div class="divider"> / </div>
  27. <a href="{{$.RepoLink}}">{{.Name}}</a>
  28. {{if .RelAvatarLink}}
  29. {{if .IsTemplate}}
  30. {{if .IsPrivate}}
  31. {{svg "octicon-repo-template-private" 32}}
  32. {{else}}
  33. {{svg "octicon-repo-template" 32}}
  34. {{end}}
  35. {{else}}
  36. {{if .IsPrivate}}
  37. {{svg "octicon-lock" 32}}
  38. {{else if .IsMirror}}
  39. {{svg "octicon-repo-clone" 32}}
  40. {{else if .IsFork}}
  41. {{svg "octicon-repo-fork" 32}}
  42. {{else}}
  43. {{svg "octicon-repo" 32}}
  44. {{end}}
  45. {{end}}
  46. {{end}}
  47. {{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}}
  48. {{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}}
  49. {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{SubStr .BaseRepo.RelLink 1 -1}}</a></div>{{end}}
  50. {{if .IsGenerated}}<div class="fork-flag">{{$.i18n.Tr "repo.generated_from"}} <a href="{{.TemplateRepo.Link}}">{{SubStr .TemplateRepo.RelLink 1 -1}}</a></div>{{end}}
  51. </div>
  52. {{if not .IsBeingCreated}}
  53. <div class="repo-buttons">
  54. <div class="ui labeled button" tabindex="0">
  55. <a class="ui compact basic button" href="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}">
  56. <i class="icon fa-eye{{if not $.IsWatchingRepo}}-slash{{end}}"></i>{{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}}
  57. </a>
  58. <a class="ui basic label" href="{{.Link}}/watchers">
  59. {{.NumWatches}}
  60. </a>
  61. </div>
  62. <div class="ui labeled button" tabindex="0">
  63. <a class="ui compact basic button" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
  64. <i class="icon star{{if not $.IsStaringRepo}} outline{{end}}"></i>{{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}}
  65. </a>
  66. <a class="ui basic label" href="{{.Link}}/stars">
  67. {{.NumStars}}
  68. </a>
  69. </div>
  70. {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
  71. <div class="ui labeled button {{if and ($.IsSigned) (not $.CanSignedUserFork)}}disabled-repo-button{{end}}" tabindex="0">
  72. <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">
  73. {{svg "octicon-repo-forked" 16}}{{$.i18n.Tr "repo.fork"}}
  74. </a>
  75. <a class="ui basic label" href="{{.Link}}/forks">
  76. {{.NumForks}}
  77. </a>
  78. </div>
  79. {{end}}
  80. </div>
  81. {{end}}
  82. </div><!-- end grid -->
  83. </div><!-- end container -->
  84. {{end}}
  85. <div class="ui tabs container">
  86. {{if not .Repository.IsBeingCreated}}
  87. <div class="ui tabular stackable menu navbar">
  88. {{if .Permission.CanRead $.UnitTypeCode}}
  89. <a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL | EscapePound}}{{end}}">
  90. {{svg "octicon-code" 16}} {{.i18n.Tr "repo.code"}}
  91. </a>
  92. {{end}}
  93. {{if .Permission.CanRead $.UnitTypeIssues}}
  94. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
  95. {{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>
  96. </a>
  97. {{end}}
  98. {{if .Permission.CanRead $.UnitTypeExternalTracker}}
  99. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
  100. {{svg "octicon-link-external" 16}} {{.i18n.Tr "repo.issues"}} </span>
  101. </a>
  102. {{end}}
  103. {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
  104. <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
  105. {{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>
  106. </a>
  107. {{end}}
  108. {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }}
  109. <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
  110. {{svg "octicon-tag" 16}} {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .Repository.NumReleases}}gray{{else}}blue{{end}} small label">{{.Repository.NumReleases}}</span>
  111. </a>
  112. {{end}}
  113. {{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}}
  114. <a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if (.Permission.CanRead $.UnitTypeExternalWiki)}} target="_blank" rel="noopener noreferrer" {{end}}>
  115. {{svg "octicon-book" 16}} {{.i18n.Tr "repo.wiki"}}
  116. </a>
  117. {{end}}
  118. {{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}}
  119. <a class="{{if .PageIsActivity}}active{{end}} item" href="{{.RepoLink}}/activity">
  120. {{svg "octicon-pulse" 16}} {{.i18n.Tr "repo.activity"}}
  121. </a>
  122. {{end}}
  123. {{template "custom/extra_tabs" .}}
  124. {{if .Permission.IsAdmin}}
  125. <div class="right menu">
  126. <a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">
  127. {{svg "octicon-tools" 16}} {{.i18n.Tr "repo.settings"}}
  128. </a>
  129. </div>
  130. {{end}}
  131. </div>
  132. {{end}}
  133. </div>
  134. <div class="ui tabs divider"></div>
  135. </div>