You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

home.tmpl 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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 ignore-dirty" 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. <div class="ui" id="repo-topics">
  27. {{range .Topics}}<a class="ui repo-topic small label topic" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
  28. {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<a id="manage_topic">{{.i18n.Tr "repo.topic.manage_topics"}}</a>{{end}}
  29. </div>
  30. {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
  31. <div class="ui repo-topic-edit grid form segment error" id="topic_edit" style="display:none">
  32. <div class="fourteen wide column">
  33. <div class="field">
  34. <div class="ui fluid multiple search selection dropdown">
  35. <input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if lt (Add $i 1) (len $.Topics)}},{{end}}{{end}}">
  36. {{range .Topics}}
  37. <div class="ui small label topic transition visible" data-value="{{.Name}}" style="display: inline-block !important; cursor: default;">{{.Name}}<i class="delete icon"></i></div>
  38. {{end}}
  39. <div class="text"></div>
  40. </div>
  41. </div>
  42. </div>
  43. <div class="two wide column">
  44. <a class="ui button primary" href="javascript:;" id="save_topic"
  45. data-link="{{.RepoLink}}/topics">{{.i18n.Tr "repo.topic.done"}}</a>
  46. </div>
  47. </div>
  48. {{end}}
  49. <div class="hide" id="validate_prompt">
  50. <span id="count_prompt">{{.i18n.Tr "repo.topic.count_prompt"}}</span>
  51. <span id="format_prompt">{{.i18n.Tr "repo.topic.format_prompt"}}</span>
  52. </div>
  53. {{if .Repository.IsArchived}}
  54. <div class="ui warning message">
  55. {{.i18n.Tr "repo.archive.title"}}
  56. </div>
  57. {{end}}
  58. {{template "repo/sub_menu" .}}
  59. <div class="ui stackable secondary menu mobile--margin-between-items mobile--no-negative-margins">
  60. {{template "repo/branch_dropdown" .}}
  61. {{ $n := len .TreeNames}}
  62. {{ $l := Subtract $n 1}}
  63. <!-- If home page, show new PR. If not, show breadcrumb -->
  64. {{if eq $n 0}}
  65. {{if and .PullRequestCtx.Allowed .IsViewBranch (not .Repository.IsArchived)}}
  66. <div class="fitted item">
  67. <a href="{{.BaseRepo.Link}}/compare/{{.BaseRepo.DefaultBranch | EscapePound}}...{{if ne .Repository.Owner.Name .BaseRepo.Owner.Name}}{{.Repository.Owner.Name}}:{{end}}{{.BranchName | EscapePound}}">
  68. <button id="new-pull-request" class="ui compact basic button">{{.i18n.Tr "repo.pulls.compare_changes"}}</button>
  69. </a>
  70. </div>
  71. {{end}}
  72. {{else}}
  73. <div class="fitted item"><span class="ui breadcrumb repo-path"><a class="section" href="{{.RepoLink}}/src/{{EscapePound .BranchNameSubURL}}" title="{{.Repository.Name}}">{{EllipsisString .Repository.Name 30}}</a>{{range $i, $v := .TreeNames}}<span class="divider">/</span>{{if eq $i $l}}<span class="active section" title="{{$v}}">{{EllipsisString $v 30}}</span>{{else}}{{ $p := index $.Paths $i}}<span class="section"><a href="{{EscapePound $.BranchLink}}/{{EscapePound $p}}" title="{{$v}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span></div>
  74. {{end}}
  75. <div class="right fitted item" id="file-buttons">
  76. <div class="ui tiny blue buttons">
  77. {{if .Repository.CanEnableEditor}}
  78. {{if .CanAddFile}}
  79. <a href="{{.RepoLink}}/_new/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
  80. {{.i18n.Tr "repo.editor.new_file"}}
  81. </a>
  82. {{end}}
  83. {{if .CanUploadFile}}
  84. <a href="{{.RepoLink}}/_upload/{{EscapePound .BranchName}}/{{EscapePound .TreePath}}" class="ui button">
  85. {{.i18n.Tr "repo.editor.upload_file"}}
  86. </a>
  87. {{end}}
  88. {{end}}
  89. {{if and (ne $n 0) (not .IsViewFile) (not .IsBlame) }}
  90. <a href="{{.RepoLink}}/commits/{{EscapePound .BranchNameSubURL}}/{{EscapePound .TreePath}}" class="ui button">
  91. {{.i18n.Tr "repo.file_history"}}
  92. </a>
  93. {{end}}
  94. </div>
  95. </div>
  96. <div class="fitted item">
  97. {{if eq $n 0}}
  98. {{if .Repository.IsTemplate}}
  99. <div class="ui tiny blue buttons">
  100. <a href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}" class="ui button">
  101. {{.i18n.Tr "repo.use_template"}}
  102. </a>
  103. </div>
  104. {{end}}
  105. {{end}}
  106. </div>
  107. <div class="fitted item">
  108. <!-- Only show clone panel in repository home page -->
  109. {{if eq $n 0}}
  110. <div class="ui action tiny input" id="clone-panel">
  111. {{if not $.DisableHTTP}}
  112. <button class="ui basic clone button" id="repo-clone-https" data-link="{{.CloneLink.HTTPS}}">
  113. {{if UseHTTPS}}HTTPS{{else}}HTTP{{end}}
  114. </button>
  115. {{end}}
  116. {{if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
  117. <button class="ui basic clone button" id="repo-clone-ssh" data-link="{{.CloneLink.SSH}}">
  118. SSH
  119. </button>
  120. {{end}}
  121. {{if not $.DisableHTTP}}
  122. <input id="repo-clone-url" value="{{$.CloneLink.HTTPS}}" readonly>
  123. {{else if and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH)}}
  124. <input id="repo-clone-url" value="{{$.CloneLink.SSH}}" readonly>
  125. {{end}}
  126. {{if or (not $.DisableHTTP) (and (not $.DisableSSH) (or $.IsSigned $.ExposeAnonSSH))}}
  127. <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">
  128. {{svg "octicon-clippy" 16}}
  129. </button>
  130. {{end}}
  131. <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">
  132. <i class="download icon"></i>
  133. <div class="menu">
  134. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.zip">{{svg "octicon-file-zip" 16}}&nbsp;ZIP</a>
  135. <a class="item" href="{{$.RepoLink}}/archive/{{EscapePound $.BranchName}}.tar.gz">{{svg "octicon-file-zip" 16}}&nbsp;TAR.GZ</a>
  136. </div>
  137. </div>
  138. </div>
  139. {{end}}
  140. </div>
  141. </div>
  142. {{if .IsViewFile}}
  143. {{template "repo/view_file" .}}
  144. {{else if .IsBlame}}
  145. {{template "repo/blame" .}}
  146. {{else}}
  147. {{template "repo/view_list" .}}
  148. {{end}}
  149. </div>
  150. </div>
  151. {{template "base/footer" .}}