my-gitea-templates/templates/repo/ home.tmpl
100 lines
4.6 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 class="ui repo-description">
  7. <div id="repo-desc">
  8. {{if .Repository.DescriptionHTML}}<span class="description has-emoji">{{.Repository.DescriptionHTML}}</span>{{else if .IsRepositoryAdmin}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}}
  9. <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
  10. </div>
  11. {{if .RepoSearchEnabled}}
  12. <div class="ui repo-search">
  13. <form class="ui form" action="{{.RepoLink}}/search" method="get">
  14. <div class="field">
  15. <div class="ui action input">
  16. <input name="q" value="{{.Keyword}}" placeholder="{{.i18n.Tr "repo.search.search_repo"}}">
  17. <button class="ui icon button" type="submit">
  18. <i class="search icon"></i>
  19. </button>
  20. </div>
  21. </div>
  22. </form>
  23. </div>
  24. {{end}}
  25. </div>
  26. {{template "repo/sub_menu" .}}
  27. <div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
  28. {{if and .PullRequestCtx.Allowed .IsViewBranch}}
  29. <div class="fitted item">
  30. <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch}}...{{.Repository.Owner.Name}}:{{.BranchName}}">
  31. <button class="ui green tiny compact button"><i class="octicon octicon-git-compare"></i></button>
  32. </a>
  33. </div>
  34. {{end}}
  35. {{template "repo/branch_dropdown" .}}
  36. {{ $n := len .TreeNames}}
  37. {{ $l := Subtract $n 1}}
  38. <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>
  39. <div class="right fitted item" id="file-buttons">
  40. {{if .Repository.CanEnableEditor}}
  41. <div class="ui tiny blue buttons">
  42. {{if .CanAddFile}}
  43. <a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
  44. {{.i18n.Tr "repo.editor.new_file"}}
  45. </a>
  46. {{end}}
  47. {{if .CanUploadFile}}
  48. <a href="{{.RepoLink}}/_upload/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
  49. {{.i18n.Tr "repo.editor.upload_file"}}
  50. </a>
  51. {{end}}
  52. </div>
  53. {{end}}
  54. </div>
  55. <div class="fitted item">
  56. <!-- Only show clone panel in repository home page -->
  57. {{if eq $n 0}}
  58. <div class="ui action tiny input" id="clone-panel">
  59. {{if not $.DisableHTTP}}
  60. <button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
  61. {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
  62. </button>
  63. {{end}}
  64. {{if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
  65. <button class="ui basic clone button" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}">
  66. SSH
  67. </button>
  68. {{end}}
  69. {{if not $.DisableHTTP}}
  70. <input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly>
  71. {{else if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
  72. <input id="repo-clone-url" value="{{$.CloneLink.SSH}}" readonly>
  73. {{end}}
  74. {{if or ((not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)))}}
  75. <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">
  76. <i class="octicon octicon-clippy"></i>
  77. </button>
  78. {{end}}
  79. <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">
  80. <i class="download icon"></i>
  81. <div class="menu">
  82. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.zip"><i class="octicon octicon-file-zip"></i> ZIP</a>
  83. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.tar.gz"><i class="octicon octicon-file-zip"></i> TAR.GZ</a>
  84. </div>
  85. </div>
  86. </div>
  87. {{end}}
  88. </div>
  89. </div>
  90. {{if .IsViewFile}}
  91. {{template "repo/view_file" .}}
  92. {{else}}
  93. {{template "repo/view_list" .}}
  94. {{end}}
  95. </div>
  96. </div>
  97. {{template "base/footer" .}}