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.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. {{template "base/head" .}}
  2. <div role="main" aria-label="{{.Title}}" class="page-content repository file list {{if .IsBlame}}blame{{end}}">
  3. {{template "repo/header" .}}
  4. <div class="ui container {{if .IsBlame}}fluid padded{{end}}">
  5. {{template "base/alert" .}}
  6. {{if and (not .HideRepoInfo) (not .IsBlame)}}
  7. <div class="ui repo-description">
  8. <div id="repo-desc">
  9. {{$description := .Repository.DescriptionHTML $.Context}}
  10. {{if $description}}<span class="description">{{$description}}</span>{{else if .IsRepositoryAdmin}}<span class="no-description text-italic">{{.locale.Tr "repo.no_desc"}}</span>{{end}}
  11. <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
  12. </div>
  13. {{if .RepoSearchEnabled}}
  14. <div class="ui repo-search">
  15. <form class="ui form ignore-dirty" action="{{.RepoLink}}/search" method="get">
  16. <div class="field">
  17. <div class="ui action input{{if .CodeIndexerUnavailable}} disabled left icon tooltip{{end}}"{{if .CodeIndexerUnavailable}} data-content="{{.locale.Tr "repo.search.code_search_unavailable"}}"{{end}}>
  18. <input name="q" value="{{.Keyword}}"{{if .CodeIndexerUnavailable}} disabled{{end}} placeholder="{{.locale.Tr "repo.search.search_repo"}}">
  19. {{if .CodeIndexerUnavailable}}
  20. <i class="icon df ac jc">{{svg "octicon-alert"}}</i>
  21. {{end}}
  22. <button class="ui icon button"{{if .CodeIndexerUnavailable}} disabled{{end}} type="submit">
  23. {{svg "octicon-search"}}
  24. </button>
  25. </div>
  26. </div>
  27. </form>
  28. </div>
  29. {{end}}
  30. </div>
  31. <div class="mt-3" id="repo-topics">
  32. {{range .Topics}}<a class="ui repo-topic large label topic" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
  33. {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<a id="manage_topic" class="muted">{{.locale.Tr "repo.topic.manage_topics"}}</a>{{end}}
  34. </div>
  35. {{end}}
  36. {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
  37. <div class="ui repo-topic-edit grid form" id="topic_edit" style="display:none">
  38. <div class="fourteen wide column">
  39. <div class="field">
  40. <div class="ui fluid multiple search selection dropdown">
  41. <input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if lt (Add $i 1) (len $.Topics)}},{{end}}{{end}}">
  42. {{range .Topics}}
  43. <div class="ui small label topic transition visible" data-value="{{.Name}}" style="display: inline-block !important; cursor: default;">{{.Name}}{{svg "octicon-x" 16 "delete icon ml-3 mt-1"}}</div>
  44. {{end}}
  45. <div class="text"></div>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="two wide column">
  50. <a class="ui button primary" role="button" tabindex="0" id="save_topic"
  51. data-link="{{.RepoLink}}/topics">{{.locale.Tr "repo.topic.done"}}</a>
  52. </div>
  53. </div>
  54. {{end}}
  55. <div class="hide" id="validate_prompt">
  56. <span id="count_prompt">{{.locale.Tr "repo.topic.count_prompt"}}</span>
  57. <span id="format_prompt">{{.locale.Tr "repo.topic.format_prompt"}}</span>
  58. </div>
  59. {{if .Repository.IsArchived}}
  60. <div class="ui warning message">
  61. {{.locale.Tr "repo.archive.title"}}
  62. </div>
  63. {{end}}
  64. {{template "repo/sub_menu" .}}
  65. <div class="repo-button-row df ac sb fw">
  66. <div class="df ac">
  67. {{template "repo/branch_dropdown" dict "root" .}}
  68. {{$n := len .TreeNames}}
  69. {{$l := Subtract $n 1}}
  70. <!-- If home page, show new PR. If not, show breadcrumb -->
  71. {{if eq $n 0}}
  72. {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
  73. <a href="{{CompareLink .BaseRepo .Repository .BranchName}}">
  74. <button id="new-pull-request" class="ui compact basic button tooltip" data-content="{{if .PullRequestCtx.Allowed}}{{.locale.Tr "repo.pulls.compare_changes"}}{{else}}{{.locale.Tr "action.compare_branch"}}{{end}}"><span class="text">{{svg "octicon-git-pull-request"}}</span></button>
  75. </a>
  76. {{end}}
  77. <a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{.locale.Tr "repo.find_file.go_to_file"}}</a>
  78. {{end}}
  79. {{if or .CanAddFile .CanUploadFile}}
  80. <button class="ui basic small compact dropdown jump icon button mr-2"{{if not .Repository.CanEnableEditor}} disabled{{end}}>
  81. <span class="text">{{.locale.Tr "repo.editor.add_file"}}</span>
  82. <div class="menu">
  83. {{if .CanAddFile}}
  84. <a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
  85. {{.locale.Tr "repo.editor.new_file"}}
  86. </a>
  87. {{end}}
  88. {{if .CanUploadFile}}
  89. <a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
  90. {{.locale.Tr "repo.editor.upload_file"}}
  91. </a>
  92. {{end}}
  93. {{if .CanAddFile}}
  94. <a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
  95. {{.locale.Tr "repo.editor.patch"}}
  96. </a>
  97. {{end}}
  98. </div>
  99. {{svg "octicon-triangle-down" 14 "dropdown icon"}}
  100. </button>
  101. {{end}}
  102. {{if ne $n 0}}
  103. <span class="ui breadcrumb repo-path ml-2"><a class="section" href="{{.RepoLink}}/src/{{.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="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{EllipsisString $v 30}}</a></span>{{end}}{{end}}</span>
  104. {{end}}
  105. </div>
  106. <div class="df ac">
  107. {{if eq $n 0}}
  108. {{if .Repository.IsTemplate}}
  109. <div class="ui tiny primary buttons">
  110. <a href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}" class="ui button">
  111. {{.locale.Tr "repo.use_template"}}
  112. </a>
  113. </div>
  114. {{end}}
  115. {{end}}
  116. <!-- Only show clone panel in repository home page -->
  117. {{if eq $n 0}}
  118. <div class="ui action tiny input" id="clone-panel">
  119. {{template "repo/clone_buttons" .}}
  120. <button id="more-btn" class="ui basic small compact jump dropdown icon button tooltip" data-content="{{.locale.Tr "repo.more_operations"}}" data-position="top right">
  121. {{svg "octicon-kebab-horizontal"}}
  122. <div class="menu">
  123. {{if not $.DisableDownloadSourceArchives}}
  124. <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-3"}}{{.locale.Tr "repo.download_zip"}}</a>
  125. <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "mr-3"}}{{.locale.Tr "repo.download_tar"}}</a>
  126. <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package" 16 "mr-3"}}{{.locale.Tr "repo.download_bundle"}}</a>
  127. {{if .CitiationExist}}
  128. <a class="item" id="cite-repo-button">{{svg "octicon-cross-reference" 16 "mr-3"}}{{.locale.Tr "repo.cite_this_repo"}}</a>
  129. {{end}}
  130. {{end}}
  131. <a class="item js-clone-url-vsc" href="vscode://vscode.git/clone?url={{.CloneButtonOriginLink.HTTPS}}">{{svg "gitea-vscode" 16 "mr-3"}}{{.locale.Tr "repo.clone_in_vsc"}}</a>
  132. </div>
  133. </button>
  134. {{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}}
  135. </div>
  136. {{template "repo/cite/cite_modal" .}}
  137. {{end}}
  138. {{if and (ne $n 0) (not .IsViewFile) (not .IsBlame)}}
  139. <a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">
  140. {{svg "octicon-history" 16 "mr-3"}}{{.locale.Tr "repo.file_history"}}
  141. </a>
  142. {{end}}
  143. </div>
  144. </div>
  145. {{if .IsViewFile}}
  146. {{template "repo/view_file" .}}
  147. {{else if .IsBlame}}
  148. {{template "repo/blame" .}}
  149. {{else}}
  150. {{template "repo/view_list" .}}
  151. {{end}}
  152. </div>
  153. </div>
  154. {{template "base/footer" .}}