my-gitea-templates/templates/repo/ home.tmpl
96 lines
4.3 KiB

  1. {{template "base/head" .}}
  2. <div class="repository file list">
  3. {{template "repo/header" .}}
  4. <div class="ui container">
  5. {{template "base/alert" .}}
  6. <div>
  7. {{if .RepoSearchEnabled}}
  8. <div class="ui repo-search">
  9. <form class="ui form" action="{{.RepoLink}}/search" method="get">
  10. <div class="field">
  11. <div class="ui action input">
  12. <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "repo.search.search_repo"}}">
  13. <button class="ui icon button" type="submit">
  14. <i class="search icon"></i>
  15. </button>
  16. </div>
  17. </div>
  18. </form>
  19. </div>
  20. {{end}}
  21. </div>
  22. {{template "repo/sub_menu" .}}
  23. <div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
  24. {{if and .PullRequestCtx.Allowed .IsViewBranch}}
  25. <div class="fitted item">
  26. <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{.Repository.Owner.Name}}:{{.BranchName}}">
  27. <button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button>
  28. </a>
  29. </div>
  30. {{end}}
  31. {{template "repo/branch_dropdown" .}}
  32. {{ $n := len .TreeNames}}
  33. {{ $l := Subtract $n 1}}
  34. <div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span></div>
  35. <div class="right fitted item" id="file-buttons">
  36. {{if .Repository.CanEnableEditor}}
  37. <div class="ui tiny blue buttons">
  38. {{if .CanAddFile}}
  39. <a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
  40. {{.i18n.Tr "repo.editor.new_file"}}
  41. </a>
  42. {{end}}
  43. {{if .CanUploadFile}}
  44. <a href="{{.RepoLink}}/_upload/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
  45. {{.i18n.Tr "repo.editor.upload_file"}}
  46. </a>
  47. {{end}}
  48. </div>
  49. {{end}}
  50. </div>
  51. <div class="fitted item">
  52. <!-- Only show clone panel in repository home page -->
  53. {{if eq $n 0}}
  54. <div class="ui action tiny input" id="clone-panel">
  55. {{if not $.DisableHTTP}}
  56. <button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
  57. {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
  58. </button>
  59. {{end}}
  60. {{if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
  61. <button class="ui basic clone button" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}">
  62. SSH
  63. </button>
  64. {{end}}
  65. {{if not $.DisableHTTP}}
  66. <input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly>
  67. {{else if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
  68. <input id="repo-clone-url" value="{{$.CloneLink.SSH}}" readonly>
  69. {{end}}
  70. {{if or ((not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)))}}
  71. <button class="ui basic icon button poping up clipboard" id="clipboard-btn" data-original="{{.i18n.Tr "repo.copy_link"}}" data-success="{{.i18n.Tr "repo.copy_link_success"}}" data-error="{{.i18n.Tr "repo.copy_link_error"}}" data-content="{{.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-target="#repo-clone-url">
  72. <i class="octicon octicon-clippy"></i>
  73. </button>
  74. {{end}}
  75. <div class="ui basic jump dropdown icon button poping up" data-content="{{.i18n.Tr "repo.download_archive"}}" data-variation="tiny inverted" data-position="top right">
  76. <i class="download icon"></i>
  77. <div class="menu">
  78. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.zip"><i class="octicon octicon-file-zip"></i> ZIP</a>
  79. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.tar.gz"><i class="octicon octicon-file-zip"></i> TAR.GZ</a>
  80. </div>
  81. </div>
  82. </div>
  83. {{end}}
  84. </div>
  85. </div>
  86. {{if .IsViewFile}}
  87. {{template "repo/view_file" .}}
  88. {{else}}
  89. {{template "repo/view_list" .}}
  90. {{end}}
  91. </div>
  92. </div>
  93. {{template "base/footer" .}}