gitea源码

home_sidebar_top.tmpl 3.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <div class="repo-home-sidebar-top">
  2. <form class="ignore-dirty tw-flex tw-flex-1" action="{{.RepoLink}}/search" method="get">
  3. <div class="ui small action input tw-flex-1">
  4. <input name="q" size="10" placeholder="{{ctx.Locale.Tr "search.code_kind"}}"> {{template "shared/search/button"}}
  5. </div>
  6. </form>
  7. <div class="flex-list">
  8. <div class="flex-item">
  9. <div class="flex-item-main">
  10. <div class="flex-item-title">{{ctx.Locale.Tr "repo.repo_desc"}}</div>
  11. <div class="flex-item-body tw-text-16">
  12. <div class="tw-flex tw-flex-col tw-gap-2 tw-mt-2">
  13. <div class="repo-description tw-break-anywhere tw-gap-2">
  14. {{- $description := .Repository.DescriptionHTML ctx -}}
  15. {{if $description}}{{$description | RenderCodeBlock}}{{else}}{{ctx.Locale.Tr "repo.repo_no_desc"}}{{end}}
  16. </div>
  17. {{if .Repository.Website}}
  18. <a class="flex-text-block" href="{{.Repository.Website}}">
  19. {{svg "octicon-link" 16 "tw-text-text"}} <span class="tw-text-primary">{{.Repository.Website}}</span>
  20. </a>
  21. {{end}}
  22. <div id="repo-topics" class="flex-text-block tw-flex-wrap tw-gap-1 tw-my-1 tw-text-text">
  23. {{/* !!!! it SHOULD and MUST match the code in repo-home.ts */}}
  24. {{range .Topics}}<a class="repo-topic ui large label gt-ellipsis" title={{.Name}} href="{{AppSubUrl}}/explore/repos?q={{.Name}}&topic=1">{{.Name}}</a>{{end}}
  25. </div>
  26. {{if and .Permission.IsAdmin (not .Repository.IsArchived)}}
  27. <button id="manage_topic" class="btn interact-fg tw-mb-2 tw-text-12">{{ctx.Locale.Tr "repo.topic.manage_topics"}}</button>
  28. <div class="ui form tw-hidden tw-my-2" id="topic_edit">
  29. <div class="ui fluid multiple search selection dropdown tw-flex-wrap tw-flex-1">
  30. <input type="hidden" name="topics" value="{{range $i, $v := .Topics}}{{.Name}}{{if Eval $i "+" 1 "<" (len $.Topics)}},{{end}}{{end}}">
  31. {{range .Topics}}
  32. {{/* keep the same layout as Fomantic UI generated labels */}}
  33. <a class="ui label transition visible tw-cursor-default tw-inline-block repo-topic" data-value="{{.Name}}">{{.Name}}{{svg "octicon-x" 16 "delete icon"}}</a>
  34. {{end}}
  35. <div class="text"></div>
  36. </div>
  37. <div class="tw-my-2">
  38. <button class="ui primary button" id="save_topic" data-link="{{.RepoLink}}/topics">{{ctx.Locale.Tr "save"}}</button>
  39. <button class="ui basic button" id="cancel_topic_edit">{{ctx.Locale.Tr "cancel"}}</button>
  40. </div>
  41. </div>
  42. {{end}}
  43. {{if .ReadmeExist}}
  44. <a class="flex-text-block muted" href="{{.RepoLink}}/src/{{.RefTypeNameSubURL}}/{{PathEscapeSegments .FileTreePath}}">
  45. {{svg "octicon-book"}} {{ctx.Locale.Tr "readme"}}
  46. </a>
  47. {{end}}
  48. {{if .DetectedRepoLicenses}}
  49. <a class="flex-text-block muted" href="{{.RepoLink}}/src/{{.Repository.DefaultBranch}}/{{PathEscapeSegments .LicenseFileName}}" title="{{StringUtils.Join .DetectedRepoLicenses ", "}}">
  50. {{svg "octicon-law"}} {{if eq (len .DetectedRepoLicenses) 1}}{{index .DetectedRepoLicenses 0}}{{else}}{{ctx.Locale.Tr "repo.multiple_licenses"}}{{end}}
  51. </a>
  52. {{end}}
  53. {{if .CitiationExist}}
  54. {{template "repo/cite/cite_modal" .}}
  55. <a class="flex-text-block muted" id="cite-repo-button">
  56. {{svg "octicon-cross-reference"}} {{ctx.Locale.Tr "repo.cite_this_repo"}}
  57. </a>
  58. {{end}}
  59. <span class="flex-text-block muted" {{if not (eq .Repository.Size 0)}}data-tooltip-placement="top" data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>
  60. {{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}}
  61. {{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}}
  62. {{svg "octicon-database"}} <b>{{ctx.Locale.PrettyNumber (index $fileSizeFields 0)}}</b> {{index $fileSizeFields 1}}
  63. </span>
  64. </div>
  65. </div>
  66. </div>
  67. </div>
  68. </div>
  69. </div>