home.tmpl 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. {{template "base/head" .}}
  2. <div class="repository file list">
  3. {{template "repo/header" .}}
  4. <div class="ui container">
  5. {{template "base/alert" .}}
  6. {{if .PageIsRepoHome}}
  7. {{if not .IsLogged}}
  8. {{template "misc/signup_prompt" .}}
  9. {{end}}
  10. <p id="repo-desc">
  11. {{if .Repository.Description}}<span class="description has-emoji">{{.Repository.Description | NewLine2br | Str2HTML}}</span>{{else}}<span class="no-description text-italic">{{.i18n.Tr "repo.no_desc"}}</span>{{end}}
  12. <a class="link repo url" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
  13. </p>
  14. <div class="ui segment" id="git-stats">
  15. <div class="ui two horizontal center link list">
  16. <div class="item">
  17. <a href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}"><span class="ui text black"><i class="menu-icon octicon">🕒</i> <b>{{.CommitsCount}}</b> {{.i18n.Tr "repo.commits"}}</span> </a>
  18. </div>
  19. <div class="item">
  20. <a href="{{.RepoLink}}/branches"><span class="ui text black"><i class="menu-icon octicon">🌵</i> <b>{{.BrancheCount}}</b> {{.i18n.Tr "repo.git_branches"}}</span> </a>
  21. </div>
  22. <div class="item">
  23. <a href="{{.RepoLink}}/releases"><span class="ui text black"><i class="menu-icon octicon">🏷️</i> <b>{{.Repository.NumTags}}</b> {{.i18n.Tr "repo.releases"}}</span> </a>
  24. </div>
  25. </div>
  26. </div>
  27. {{end}}
  28. <div class="ui secondary menu">
  29. {{if .PullRequestCtx.Allowed}}
  30. <div class="fitted item">
  31. <a href="{{.BaseRepo.Link}}/compare/{{EscapePound .BaseRepo.DefaultBranch}}...{{EscapePound .PullRequestCtx.HeadInfo}}">
  32. <button class="ui green small button"><i class="octicon octicon-git-compare"></i></button>
  33. </a>
  34. </div>
  35. {{end}}
  36. {{template "repo/branch_dropdown" .}}
  37. <div class="fitted item">
  38. <div class="ui breadcrumb">
  39. <a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchName}}">{{EllipsisString .Repository.Name 15}}</a>
  40. {{ $n := len .TreeNames}}
  41. {{ $l := Subtract $n 1}}
  42. {{range $i, $v := .TreeNames}}
  43. <div class="divider"> / </div>
  44. {{if eq $i $l}}
  45. <span class="active section">{{$v}}</span>
  46. {{else}}
  47. {{ $p := index $.Paths $i}}
  48. <span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}">{{$v}}</a></span>
  49. {{end}}
  50. {{end}}
  51. </div>
  52. </div>
  53. <div class="right fitted item">
  54. {{if .Repository.CanEnableEditor}}
  55. <div id="file-buttons" class="ui tiny blue buttons">
  56. {{if .CanAddFile}}
  57. <a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui teal basic button">
  58. {{.i18n.Tr "repo.editor.new_file"}}
  59. </a>
  60. {{end}}
  61. {{if .CanUploadFile}}
  62. <a href="{{.RepoLink}}/_upload/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui green basic button">
  63. {{.i18n.Tr "repo.editor.upload_file"}}
  64. </a>
  65. {{end}}
  66. </div>
  67. {{end}}
  68. <!-- Only show clone panel in repository home page -->
  69. {{if eq $n 0}}
  70. <div class="ui action small input" id="clone-panel">
  71. {{if not $.DisableHTTP}}
  72. <button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
  73. {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
  74. </button>
  75. {{end}}
  76. {{if not $.DisableSSH}}
  77. <button class="ui basic clone button" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}">
  78. SSH
  79. </button>
  80. {{end}}
  81. <input id="repo-clone-url" value="{{if not $.DisableHTTP}}{{$.CloneLink.HTTPS}}{{else}}{{$.CloneLink.SSH}}{{end}}" readonly>
  82. <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">
  83. <i class="octicon octicon-clippy"></i>
  84. </button>
  85. <div class="ui basic jump dropdown icon button">
  86. <i class="download icon"></i>
  87. <div class="menu">
  88. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.zip"><i class="octicon octicon-file-zip"></i> ZIP</a>
  89. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.tar.gz"><i class="octicon octicon-file-zip"></i> TAR.GZ</a>
  90. </div>
  91. </div>
  92. </div>
  93. {{end}}
  94. </div>
  95. </div>
  96. {{if .IsViewFile}}
  97. {{template "repo/view_file" .}}
  98. {{else}}
  99. {{template "repo/view_list" .}}
  100. {{end}}
  101. </div>
  102. </div>
  103. {{template "base/footer" .}}