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 8.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. {{template "repo/code/recently_pushed_new_branches" .}}
  7. {{if and (not .HideRepoInfo) (not .IsBlame)}}
  8. <div class="ui repo-description gt-word-break">
  9. <div id="repo-desc" class="gt-font-16">
  10. {{$description := .Repository.DescriptionHTML $.Context}}
  11. {{if $description}}<span class="description">{{$description | RenderCodeBlock}}</span>{{else if .IsRepositoryAdmin}}<span class="no-description text-italic">{{ctx.Locale.Tr "repo.no_desc"}}</span>{{end}}
  12. <a class="link" href="{{.Repository.Website}}">{{.Repository.Website}}</a>
  13. </div>
  14. {{if .RepoSearchEnabled}}
  15. <div class="ui repo-search">
  16. <form class="ui form ignore-dirty" action="{{.RepoLink}}/search" method="get">
  17. <div class="field">
  18. <div class="ui small action input{{if .CodeIndexerUnavailable}} disabled left icon{{end}}"{{if .CodeIndexerUnavailable}} data-tooltip-content="{{ctx.Locale.Tr "repo.search.code_search_unavailable"}}"{{end}}>
  19. <input name="q" value="{{.Keyword}}"{{if .CodeIndexerUnavailable}} disabled{{end}} placeholder="{{ctx.Locale.Tr "repo.search.search_repo"}}">
  20. {{if .CodeIndexerUnavailable}}
  21. <i class="icon">{{svg "octicon-alert"}}</i>
  22. {{end}}
  23. <button class="ui small icon button"{{if .CodeIndexerUnavailable}} disabled{{end}} type="submit">
  24. {{svg "octicon-search"}}
  25. </button>
  26. </div>
  27. </div>
  28. </form>
  29. </div>
  30. {{end}}
  31. </div>
  32. <div class="gt-df gt-ac gt-fw gt-gap-2" id="repo-topics">
  33. {{range .Topics}}<a class="ui repo-topic large label topic gt-m-0" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
  34. {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}<button id="manage_topic" class="btn interact-fg gt-font-12">{{ctx.Locale.Tr "repo.topic.manage_topics"}}</button>{{end}}
  35. </div>
  36. {{end}}
  37. {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
  38. <div class="ui form gt-hidden gt-df gt-mt-4" id="topic_edit">
  39. <div class="field gt-f1 gt-mr-3">
  40. <div class="ui fluid multiple search selection dropdown" data-text-count-prompt="{{ctx.Locale.Tr "repo.topic.count_prompt"}}" data-text-format-prompt="{{ctx.Locale.Tr "repo.topic.format_prompt"}}">
  41. <input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
  42. {{range .Topics}}
  43. {{/* keey the same layout as Fomantic UI generated labels */}}
  44. <a class="ui label transition visible gt-cursor-default gt-dib" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
  45. {{end}}
  46. <div class="text"></div>
  47. </div>
  48. </div>
  49. <div>
  50. <button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button>
  51. <button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{ctx.Locale.Tr "save"}}</button>
  52. </div>
  53. </div>
  54. {{end}}
  55. {{if .Repository.IsArchived}}
  56. <div class="ui warning message gt-text-center">
  57. {{if .Repository.ArchivedUnix.IsZero}}
  58. {{ctx.Locale.Tr "repo.archive.title"}}
  59. {{else}}
  60. {{ctx.Locale.Tr "repo.archive.title_date" (DateTime "long" .Repository.ArchivedUnix) | Safe}}
  61. {{end}}
  62. </div>
  63. {{end}}
  64. {{template "repo/sub_menu" .}}
  65. <div class="repo-button-row">
  66. <div class="gt-df gt-ac gt-fw gt-gap-y-3">
  67. {{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "gt-mr-2"}}
  68. {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
  69. {{$cmpBranch := ""}}
  70. {{if ne .Repository.ID .BaseRepo.ID}}
  71. {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}}
  72. {{end}}
  73. {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}}
  74. {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}}
  75. <a id="new-pull-request" role="button" class="ui compact basic button" href="{{$compareLink}}"
  76. data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}">
  77. {{svg "octicon-git-pull-request"}}
  78. </a>
  79. {{end}}
  80. <!-- Show go to file and breadcrumbs if not on home page -->
  81. {{$n := len .TreeNames}}
  82. {{$l := Eval $n "-" 1}}
  83. {{if eq $n 0}}
  84. <a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a>
  85. {{end}}
  86. {{if and .CanWriteCode .IsViewBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}}
  87. <button class="ui dropdown basic compact jump button gt-mr-2"{{if not .Repository.CanEnableEditor}} disabled{{end}}>
  88. {{ctx.Locale.Tr "repo.editor.add_file"}}
  89. {{svg "octicon-triangle-down" 14 "dropdown icon"}}
  90. <div class="menu">
  91. <a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
  92. {{ctx.Locale.Tr "repo.editor.new_file"}}
  93. </a>
  94. {{if .RepositoryUploadEnabled}}
  95. <a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
  96. {{ctx.Locale.Tr "repo.editor.upload_file"}}
  97. </a>
  98. {{end}}
  99. <a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
  100. {{ctx.Locale.Tr "repo.editor.patch"}}
  101. </a>
  102. </div>
  103. </button>
  104. {{end}}
  105. {{if and (eq $n 0) (.Repository.IsTemplate)}}
  106. <a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}">
  107. {{ctx.Locale.Tr "repo.use_template"}}
  108. </a>
  109. {{end}}
  110. {{if ne $n 0}}
  111. <span class="breadcrumb repo-path gt-ml-2">
  112. <a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a>
  113. {{- range $i, $v := .TreeNames -}}
  114. <span class="breadcrumb-divider">/</span>
  115. {{- if eq $i $l -}}
  116. <span class="active section" title="{{$v}}">{{StringUtils.EllipsisString $v 30}}</span>
  117. {{- else -}}
  118. {{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{StringUtils.EllipsisString $v 30}}</a></span>
  119. {{- end -}}
  120. {{- end -}}
  121. </span>
  122. {{end}}
  123. </div>
  124. <div class="gt-df gt-ac">
  125. <!-- Only show clone panel in repository home page -->
  126. {{if eq $n 0}}
  127. <div class="ui action tiny input" id="clone-panel">
  128. {{template "repo/clone_buttons" .}}
  129. <button id="more-btn" class="ui basic small compact jump dropdown icon button" data-tooltip-content="{{ctx.Locale.Tr "repo.more_operations"}}">
  130. {{svg "octicon-kebab-horizontal"}}
  131. <div class="menu">
  132. {{if not $.DisableDownloadSourceArchives}}
  133. <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.zip" rel="nofollow">{{svg "octicon-file-zip" 16 "gt-mr-3"}}{{ctx.Locale.Tr "repo.download_zip"}}</a>
  134. <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.tar.gz" rel="nofollow">{{svg "octicon-file-zip" 16 "gt-mr-3"}}{{ctx.Locale.Tr "repo.download_tar"}}</a>
  135. <a class="item archive-link" href="{{$.RepoLink}}/archive/{{PathEscapeSegments $.RefName}}.bundle" rel="nofollow">{{svg "octicon-package" 16 "gt-mr-3"}}{{ctx.Locale.Tr "repo.download_bundle"}}</a>
  136. {{if .CitiationExist}}
  137. <a class="item" id="cite-repo-button">{{svg "octicon-cross-reference" 16 "gt-mr-3"}}{{ctx.Locale.Tr "repo.cite_this_repo"}}</a>
  138. {{end}}
  139. {{end}}
  140. <a class="item js-clone-url-vsc" href="vscode://vscode.git/clone?url={{.CloneButtonOriginLink.HTTPS}}">{{svg "gitea-vscode" 16 "gt-mr-3"}}{{ctx.Locale.Tr "repo.clone_in_vsc"}}</a>
  141. </div>
  142. </button>
  143. {{template "repo/clone_script" .}}{{/* the script will update `.js-clone-url` and related elements */}}
  144. </div>
  145. {{template "repo/cite/cite_modal" .}}
  146. {{end}}
  147. {{if and (ne $n 0) (not .IsViewFile) (not .IsBlame)}}
  148. <a class="ui button" href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}/{{.TreePath | PathEscapeSegments}}">
  149. {{svg "octicon-history" 16 "gt-mr-3"}}{{ctx.Locale.Tr "repo.file_history"}}
  150. </a>
  151. {{end}}
  152. </div>
  153. </div>
  154. {{if .IsViewFile}}
  155. {{template "repo/view_file" .}}
  156. {{else if .IsBlame}}
  157. {{template "repo/blame" .}}
  158. {{else}}
  159. {{template "repo/view_list" .}}
  160. {{end}}
  161. </div>
  162. </div>
  163. {{template "base/footer" .}}