header.tmpl 4.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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. <!-- customised: first mirror/fork info, then the repo name -->
  7. {{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}}
  8. {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{SubStr .BaseRepo.RelLink 1 -1}}</a></div>{{end}}
  9. {{if .IsGenerated}}<div class="fork-flag">{{$.i18n.Tr "repo.generated_from"}} <a href="{{.TemplateRepo.Link}}">{{SubStr .TemplateRepo.RelLink 1 -1}}</a></div>{{end}}
  10. {{if .RelAvatarLink}}
  11. <img class="ui avatar image" src="{{.RelAvatarLink}}"/>
  12. {{else if .IsTemplate}}
  13. {{if .IsPrivate}}
  14. {{svg "octicon-repo-template-private" 32}}
  15. {{else}}
  16. {{svg "octicon-repo-template" 32}}
  17. {{end}}
  18. {{else}}
  19. {{if .IsPrivate}}
  20. {{svg "octicon-lock" 32}}
  21. {{else if .IsMirror}}
  22. {{svg "octicon-repo-clone" 32}}
  23. {{else if .IsFork}}
  24. {{svg "octicon-repo-forked" 32}}
  25. {{else}}
  26. {{svg "octicon-repo" 32}}
  27. {{end}}
  28. {{end}}
  29. <a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
  30. <div class="divider"> / </div>
  31. <a href="{{$.RepoLink}}">{{.Name}}</a>
  32. {{if .RelAvatarLink}}
  33. {{if .IsTemplate}}
  34. {{if .IsPrivate}}
  35. {{svg "octicon-repo-template-private" 32}}
  36. {{else}}
  37. {{svg "octicon-repo-template" 32}}
  38. {{end}}
  39. {{else}}
  40. {{if .IsPrivate}}
  41. {{svg "octicon-lock" 32}}
  42. {{else if .IsMirror}}
  43. {{svg "octicon-repo-clone" 32}}
  44. {{else if .IsFork}}
  45. {{svg "octicon-repo-forked" 32}}
  46. {{else}}
  47. {{svg "octicon-repo" 32}}
  48. {{end}}
  49. {{end}}
  50. {{end}}
  51. {{if .IsArchived}}<i class="archive icon archived-icon"></i>{{end}}
  52. </div>
  53. <div class="ui repo-description">
  54. <div id="repo-desc">
  55. {{if .DescriptionHTML}}<span class="description has-emoji">{{.DescriptionHTML}}</span>{{end}}
  56. <a class="link" href="{{.Website}}">{{.Website}}</a>
  57. </div>
  58. </div>
  59. </div><!-- end grid -->
  60. </div><!-- end container -->
  61. {{end}}
  62. <div class="ui tabs container">
  63. {{if not .Repository.IsBeingCreated}}
  64. <div class="ui tabular stackable menu navbar">
  65. {{if .Permission.CanRead $.UnitTypeCode}}
  66. <a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}{{if (ne .BranchName .Repository.DefaultBranch)}}/src/{{.BranchNameSubURL | EscapePound}}{{end}}">
  67. {{svg "octicon-code" 16}} {{.i18n.Tr "repo.code"}}
  68. </a>
  69. {{end}}
  70. {{if .Permission.CanRead $.UnitTypeIssues}}
  71. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues" rel="noopener noreferrer">
  72. {{svg "octicon-issue-opened" 16}} {{.i18n.Tr "repo.issues"}} <span class="ui small label">{{.Repository.NumOpenIssues}}</span>
  73. </a>
  74. {{end}}
  75. {{if .Permission.CanRead $.UnitTypeExternalTracker}}
  76. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoExternalIssuesLink}}" target="_blank">
  77. {{svg "octicon-issue-opened" 16}} {{.i18n.Tr "repo.issues"}} </span>
  78. </a>
  79. {{end}}
  80. {{if and .Repository.CanEnablePulls (.Permission.CanRead $.UnitTypePullRequests)}}
  81. <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
  82. {{svg "octicon-git-pull-request" 16}} {{.i18n.Tr "repo.pulls"}} <span class="ui small label">{{.Repository.NumOpenPulls}}</span>
  83. </a>
  84. {{end}}
  85. {{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo) }}
  86. <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
  87. {{svg "octicon-tag" 16}} {{.i18n.Tr "repo.releases"}} <span class="ui small label">{{.NumReleases}}</span>
  88. </a>
  89. {{end}}
  90. {{if and (.Permission.CanReadAny $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsEmptyRepo)}}
  91. <a class="{{if .PageIsActivity}}active{{end}} item" href="{{.RepoLink}}/activity">
  92. {{svg "octicon-pulse" 16}} {{.i18n.Tr "repo.activity"}}
  93. </a>
  94. {{end}}
  95. {{template "custom/extra_tabs" .}}
  96. {{if .Permission.IsAdmin}}
  97. <div class="right menu">
  98. <a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">
  99. {{svg "octicon-tools" 16}} {{.i18n.Tr "repo.settings"}}
  100. </a>
  101. </div>
  102. {{end}}
  103. </div>
  104. {{end}}
  105. </div>
  106. <div class="ui tabs divider"></div>
  107. </div>