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 "search.code_search_unavailable"}}"{{end}}>
  19. <input name="q" value="{{.Keyword}}"{{if .CodeIndexerUnavailable}} disabled{{end}} placeholder="{{ctx.Locale.Tr "search.code_kind"}}">
  20. {{if .CodeIndexerUnavailable}}
  21. <i class="icon">{{svg "octicon-alert"}}</i>
  22. {{end}}
  23. {{template "shared/search/button" dict "Disabled" .CodeIndexerUnavailable}}
  24. </div>
  25. </div>
  26. </form>
  27. </div>
  28. {{end}}
  29. </div>
  30. <div class="tw-flex tw-content-center tw-flex-wrap gt-gap-2" id="repo-topics">
  31. {{range .Topics}}<a class="ui repo-topic large label topic gt-m-0" href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
  32. {{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}}
  33. </div>
  34. {{end}}
  35. {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
  36. <div class="ui form gt-hidden tw-flex tw-flex-col gt-mt-4" id="topic_edit">
  37. <div class="field tw-flex-1 gt-mb-2">
  38. <div class="ui fluid multiple search selection dropdown tw-flex-wrap" data-text-count-prompt="{{ctx.Locale.Tr "repo.topic.count_prompt"}}" data-text-format-prompt="{{ctx.Locale.Tr "repo.topic.format_prompt"}}">
  39. <input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
  40. {{range .Topics}}
  41. {{/* keey the same layout as Fomantic UI generated labels */}}
  42. <a class="ui label transition visible tw-cursor-default tw-inline-block" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
  43. {{end}}
  44. <div class="text"></div>
  45. </div>
  46. </div>
  47. <div>
  48. <button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button>
  49. <button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{ctx.Locale.Tr "save"}}</button>
  50. </div>
  51. </div>
  52. {{end}}
  53. {{if .Repository.IsArchived}}
  54. <div class="ui warning message tw-text-center">
  55. {{if .Repository.ArchivedUnix.IsZero}}
  56. {{ctx.Locale.Tr "repo.archive.title"}}
  57. {{else}}
  58. {{ctx.Locale.Tr "repo.archive.title_date" (DateTime "long" .Repository.ArchivedUnix)}}
  59. {{end}}
  60. </div>
  61. {{end}}
  62. {{template "repo/sub_menu" .}}
  63. <div class="repo-button-row">
  64. <div class="tw-flex tw-content-center tw-flex-wrap gt-gap-y-3">
  65. {{template "repo/branch_dropdown" dict "root" . "ContainerClasses" "gt-mr-2"}}
  66. {{if and .CanCompareOrPull .IsViewBranch (not .Repository.IsArchived)}}
  67. {{$cmpBranch := ""}}
  68. {{if ne .Repository.ID .BaseRepo.ID}}
  69. {{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}}
  70. {{end}}
  71. {{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}}
  72. {{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}}
  73. <a id="new-pull-request" role="button" class="ui compact basic button" href="{{$compareLink}}"
  74. data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{ctx.Locale.Tr "repo.pulls.compare_changes"}}{{else}}{{ctx.Locale.Tr "action.compare_branch"}}{{end}}">
  75. {{svg "octicon-git-pull-request"}}
  76. </a>
  77. {{end}}
  78. <!-- Show go to file and breadcrumbs if not on home page -->
  79. {{$n := len .TreeNames}}
  80. {{$l := Eval $n "-" 1}}
  81. {{if eq $n 0}}
  82. <a href="{{.Repository.Link}}/find/{{.BranchNameSubURL}}" class="ui compact basic button">{{ctx.Locale.Tr "repo.find_file.go_to_file"}}</a>
  83. {{end}}
  84. {{if and .CanWriteCode .IsViewBranch (not .Repository.IsMirror) (not .Repository.IsArchived) (not .IsViewFile)}}
  85. <button class="ui dropdown basic compact jump button gt-mr-2"{{if not .Repository.CanEnableEditor}} disabled{{end}}>
  86. {{ctx.Locale.Tr "repo.editor.add_file"}}
  87. {{svg "octicon-triangle-down" 14 "dropdown icon"}}
  88. <div class="menu">
  89. <a class="item" href="{{.RepoLink}}/_new/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
  90. {{ctx.Locale.Tr "repo.editor.new_file"}}
  91. </a>
  92. {{if .RepositoryUploadEnabled}}
  93. <a class="item" href="{{.RepoLink}}/_upload/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
  94. {{ctx.Locale.Tr "repo.editor.upload_file"}}
  95. </a>
  96. {{end}}
  97. <a class="item" href="{{.RepoLink}}/_diffpatch/{{.BranchName | PathEscapeSegments}}/{{.TreePath | PathEscapeSegments}}">
  98. {{ctx.Locale.Tr "repo.editor.patch"}}
  99. </a>
  100. </div>
  101. </button>
  102. {{end}}
  103. {{if and (eq $n 0) (.Repository.IsTemplate)}}
  104. <a role="button" class="ui primary compact button" href="{{AppSubUrl}}/repo/create?template_id={{.Repository.ID}}">
  105. {{ctx.Locale.Tr "repo.use_template"}}
  106. </a>
  107. {{end}}
  108. {{if ne $n 0}}
  109. <span class="breadcrumb repo-path gt-ml-2">
  110. <a class="section" href="{{.RepoLink}}/src/{{.BranchNameSubURL}}" title="{{.Repository.Name}}">{{StringUtils.EllipsisString .Repository.Name 30}}</a>
  111. {{- range $i, $v := .TreeNames -}}
  112. <span class="breadcrumb-divider">/</span>
  113. {{- if eq $i $l -}}
  114. <span class="active section" title="{{$v}}">{{StringUtils.EllipsisString $v 30}}</span>
  115. {{- else -}}
  116. {{$p := index $.Paths $i}}<span class="section"><a href="{{$.BranchLink}}/{{PathEscapeSegments $p}}" title="{{$v}}">{{StringUtils.EllipsisString $v 30}}</a></span>
  117. {{- end -}}
  118. {{- end -}}
  119. </span>
  120. {{end}}
  121. </div>
  122. <div class="tw-flex tw-content-center">
  123. <!-- Only show clone panel in repository home page -->
  124. {{if eq $n 0}}
  125. <div class="clone-panel ui action tiny input">
  126. {{template "repo/clone_buttons" .}}
  127. <button class="ui small jump dropdown icon button" data-tooltip-content="{{ctx.Locale.Tr "repo.more_operations"}}">
  128. {{svg "octicon-kebab-horizontal"}}
  129. <div class="menu">
  130. {{if not $.DisableDownloadSourceArchives}}
  131. <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>
  132. <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>
  133. <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>
  134. {{end}}
  135. {{if .CitiationExist}}
  136. <a class="item" id="cite-repo-button">{{svg "octicon-cross-reference" 16 "gt-mr-3"}}{{ctx.Locale.Tr "repo.cite_this_repo"}}</a>
  137. {{end}}
  138. {{range .OpenWithEditorApps}}
  139. <a class="item js-clone-url-editor" data-href-template="{{.OpenURL}}">{{.IconHTML}}{{ctx.Locale.Tr "repo.open_with_editor" .DisplayName}}</a>
  140. {{end}}
  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" .}}