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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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. <!-- TODO use star-filled once octicons v2 are in place */ -->
  54. {{if $.IsStaringRepo}}{{svg "octicon-star" 16}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{svg "octicon-star" 16}}{{$.i18n.Tr "repo.star"}}{{end}}
  55. </button>
  56. <a class="ui basic label" href="{{.Link}}/stars">
  57. {{.NumStars}}
  58. </a>
  59. </div>
  60. </form>
  61. {{if and (not .IsEmpty) ($.Permission.CanRead $.UnitTypeCode)}}
  62. <div class="ui labeled button {{if and ($.IsSigned) (not $.CanSignedUserFork)}}disabled-repo-button{{end}}" tabindex="0">
  63. <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">
  64. {{svg "octicon-repo-forked" 16}}{{$.i18n.Tr "repo.fork"}}
  65. </a>
  66. <a class="ui basic label" href="{{.Link}}/forks">
  67. {{.NumForks}}
  68. </a>
  69. </div>
  70. {{end}}
  71. </div>
  72. {{end}}
  73. </div><!-- end grid -->
  74. </div><!-- end container -->
  75. {{end}}
  76. <div class="ui tabs container">
  77. {{if not .Repository.IsBeingCreated}}
  78. <div class="ui tabular stackable menu navbar">
  79. {{if .Permission.CanRead $.UnitTypeCode}}
  80. <a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL | EscapePound}}{{end}}">
  81. {{svg "octicon-code" 16}} {{.i18n.Tr "repo.code"}}
  82. </a>
  83. {{end}}
  84. {{if .Permission.CanRead $.UnitTypeIssues}}
  85. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
  86. {{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>
  87. </a>
  88. {{end}}
  89. {{if .Permission.CanRead $.UnitTypeExternalTracker}}
  90. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoExternalIssuesLink}}" target="_blank" rel="noopener noreferrer">
  91. {{svg "octicon-link-external" 16}} {{.i18n.Tr "repo.issues"}} </span>
  92. </a>
  93. {{end}}
  94. {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
  95. <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
  96. {{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>
  97. </a>
  98. {{end}}
  99. {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }}
  100. <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
  101. {{svg "octicon-tag" 16}} {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .NumReleases}}gray{{else}}blue{{end}} small label">{{.NumReleases}}</span>
  102. </a>
  103. {{end}}
  104. {{if or (.Permission.CanRead $.UnitTypeWiki) (.Permission.CanRead $.UnitTypeExternalWiki)}}
  105. <a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if (.Permission.CanRead $.UnitTypeExternalWiki)}} target="_blank" rel="noopener noreferrer" {{end}}>
  106. {{svg "octicon-book" 16}} {{.i18n.Tr "repo.wiki"}}
  107. </a>
  108. {{end}}
  109. {{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}}
  110. <a class="{{if .PageIsActivity}}active{{end}} item" href="{{.RepoLink}}/activity">
  111. {{svg "octicon-pulse" 16}} {{.i18n.Tr "repo.activity"}}
  112. </a>
  113. {{end}}
  114. {{template "custom/extra_tabs" .}}
  115. {{if .Permission.IsAdmin}}
  116. <div class="right menu">
  117. <a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">
  118. {{svg "octicon-tools" 16}} {{.i18n.Tr "repo.settings"}}
  119. </a>
  120. </div>
  121. {{end}}
  122. </div>
  123. {{end}}
  124. </div>
  125. <div class="ui tabs divider"></div>
  126. </div>