my-gitea-templates/templates/repo/ header.tmpl
108 lines
5.0 KiB

  1. <div class="header-wrapper">
  2. {{with .Repository}}
  3. <div class="ui container">
  4. <div class="ui stackable grid header-grid">
  5. <div class="eight wide column">
  6. <div class="ui huge breadcrumb">
  7. <i class="mega-octicon octicon-{{if .IsPrivate}}lock{{else if .IsMirror}}repo-clone{{else if .IsFork}}repo-forked{{else}}repo{{end}}"></i>
  8. <a href="{{AppSubUrl}}/{{.Owner.Name}}">{{.Owner.Name}}</a>
  9. <div class="divider"> / </div>
  10. <a href="{{$.RepoLink}}">{{.Name}}</a>
  11. {{if .IsMirror}}<div class="fork-flag">{{$.i18n.Tr "repo.mirror_from"}} <a target="_blank" rel="noopener" href="{{$.Mirror.Address}}">{{$.Mirror.Address}}</a></div>{{end}}
  12. {{if .IsFork}}<div class="fork-flag">{{$.i18n.Tr "repo.forked_from"}} <a href="{{.BaseRepo.Link}}">{{SubStr .BaseRepo.RelLink 1 -1}}</a></div>{{end}}
  13. </div>
  14. </div>
  15. <div class="ui eight wide right aligned column">
  16. <div class="ui compact labeled button" tabindex="0">
  17. <a class="ui compact button" href="{{$.RepoLink}}/action/{{if $.IsWatchingRepo}}un{{end}}watch?redirect_to={{$.Link}}">
  18. <i class="icon fa-eye{{if not $.IsWatchingRepo}}-slash{{end}}"></i>{{if $.IsWatchingRepo}}{{$.i18n.Tr "repo.unwatch"}}{{else}}{{$.i18n.Tr "repo.watch"}}{{end}}
  19. </a>
  20. <a class="ui basic label" href="{{.Link}}/watchers">
  21. {{.NumWatches}}
  22. </a>
  23. </div>
  24. <div class="ui compact labeled button" tabindex="0">
  25. <a class="ui compact button" href="{{$.RepoLink}}/action/{{if $.IsStaringRepo}}un{{end}}star?redirect_to={{$.Link}}">
  26. <i class="icon fa-star{{if not $.IsStaringRepo}}-o{{end}}"></i>{{if $.IsStaringRepo}}{{$.i18n.Tr "repo.unstar"}}{{else}}{{$.i18n.Tr "repo.star"}}{{end}}
  27. </a>
  28. <a class="ui basic label" href="{{.Link}}/stars">
  29. {{.NumStars}}
  30. </a>
  31. </div>
  32. {{if .CanBeForked}}
  33. <div class="ui compact labeled button" tabindex="0">
  34. <a class="ui compact button {{if not $.CanSignedUserFork}}poping up{{end}}" {{if $.CanSignedUserFork}}href="{{AppSubUrl}}/repo/fork/{{.ID}}"{{else}} data-content="{{$.i18n.Tr "repo.fork_from_self"}}" data-position="top center" data-variation="tiny"{{end}}>
  35. <i class="octicon octicon-repo-forked"></i>{{$.i18n.Tr "repo.fork"}}
  36. </a>
  37. <a class="ui basic label" href="{{.Link}}/forks">
  38. {{.NumForks}}
  39. </a>
  40. </div>
  41. {{end}}
  42. </div>
  43. </div><!-- end grid -->
  44. </div><!-- end container -->
  45. {{end}}
  46. {{if not .IsDiffCompare}}
  47. <div class="ui tabs container">
  48. <div class="ui tabular stackable menu navbar">
  49. {{if .Repository.UnitEnabled $.UnitTypeCode}}
  50. <a class="{{if .PageIsViewCode}}active{{end}} item" href="{{.RepoLink}}">
  51. <i class="octicon octicon-code"></i> {{.i18n.Tr "repo.code"}}
  52. </a>
  53. {{end}}
  54. {{if .Repository.UnitEnabled $.UnitTypeIssues}}
  55. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues">
  56. <i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} <span class="ui {{if not .Repository.NumOpenIssues}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenIssues}}</span>
  57. </a>
  58. {{end}}
  59. {{if .Repository.UnitEnabled $.UnitTypeExternalTracker}}
  60. <a class="{{if .PageIsIssueList}}active{{end}} item" href="{{.RepoLink}}/issues" target="_blank">
  61. <i class="octicon octicon-issue-opened"></i> {{.i18n.Tr "repo.issues"}} </span>
  62. </a>
  63. {{end}}
  64. {{if .Repository.AllowsPulls}}
  65. <a class="{{if .PageIsPullList}}active{{end}} item" href="{{.RepoLink}}/pulls">
  66. <i class="octicon octicon-git-pull-request"></i> {{.i18n.Tr "repo.pulls"}} <span class="ui {{if not .Repository.NumOpenPulls}}gray{{else}}blue{{end}} small label">{{.Repository.NumOpenPulls}}</span>
  67. </a>
  68. {{end}}
  69. {{if and (.Repository.UnitEnabled $.UnitTypeReleases) (not .IsBareRepo) }}
  70. <a class="{{if .PageIsReleaseList}}active{{end}} item" href="{{.RepoLink}}/releases">
  71. <i class="octicon octicon-tag"></i> {{.i18n.Tr "repo.releases"}} <span class="ui {{if not .Repository.NumReleases}}gray{{else}}blue{{end}} small label">{{.Repository.NumReleases}}</span>
  72. </a>
  73. {{end}}
  74. {{if or (.Repository.UnitEnabled $.UnitTypeWiki) (.Repository.UnitEnabled $.UnitTypeExternalWiki)}}
  75. <a class="{{if .PageIsWiki}}active{{end}} item" href="{{.RepoLink}}/wiki" {{if (.Repository.UnitEnabled $.UnitTypeExternalWiki)}} target="_blank" {{end}}>
  76. <i class="octicon octicon-book"></i> {{.i18n.Tr "repo.wiki"}}
  77. </a>
  78. {{end}}
  79. {{if and (.Repository.AnyUnitEnabled $.UnitTypePullRequests $.UnitTypeIssues $.UnitTypeReleases) (not .IsBareRepo)}}
  80. <a class="{{if .PageIsActivity}}active{{end}} item" href="{{.RepoLink}}/activity">
  81. <i class="octicon octicon-pulse"></i> {{.i18n.Tr "repo.activity"}}
  82. </a>
  83. {{end}}
  84. {{template "custom/extra_tabs" .}}
  85. {{if .IsRepositoryAdmin}}
  86. <div class="right menu">
  87. <a class="{{if .PageIsSettings}}active{{end}} item" href="{{.RepoLink}}/settings">
  88. <i class="octicon octicon-tools"></i> {{.i18n.Tr "repo.settings"}}
  89. </a>
  90. </div>
  91. {{end}}
  92. </div>
  93. </div>
  94. <div class="ui tabs divider"></div>
  95. {{else}}
  96. <div class="ui divider"></div>
  97. {{end}}
  98. </div>