gitea源码

repos.tmpl 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. {{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings repos")}}
  2. <div class="user-setting-content">
  3. <h4 class="ui top attached header">
  4. {{ctx.Locale.Tr "settings.repos"}}
  5. </h4>
  6. <div class="ui attached segment">
  7. {{if or .allowAdopt .allowDelete}}
  8. {{if .Dirs}}
  9. <div class="ui list">
  10. {{range $dirI, $dir := .Dirs}}
  11. {{$repo := index $.ReposMap $dir}}
  12. <div class="item {{if not $repo}}tw-py-1{{end}}">{{/* if not repo, then there are "adapt" buttons, so the padding shouldn't be that default large*/}}
  13. <div class="content">
  14. {{if $repo}}
  15. {{if $repo.IsPrivate}}
  16. <span class="text gold icon">{{svg "octicon-lock"}}</span>
  17. {{else if $repo.IsFork}}
  18. <span class="icon">{{svg "octicon-repo-forked"}}</span>
  19. {{else if $repo.IsMirror}}
  20. <span class="icon">{{svg "octicon-mirror"}}</span>
  21. {{else if $repo.IsTemplate}}
  22. <span class="icon">{{svg "octicon-repo-template"}}</span>
  23. {{else}}
  24. <span class="icon">{{svg "octicon-repo"}}</span>
  25. {{end}}
  26. <a class="muted name" href="{{$repo.Link}}">{{$repo.OwnerName}}/{{$repo.Name}}</a>
  27. <span class="text light-3" {{if not (eq $repo.Size 0)}} data-tooltip-content="{{$repo.SizeDetailsString}}"{{end}}>{{FileSize $repo.Size}}</span>
  28. {{if $repo.IsFork}}
  29. {{ctx.Locale.Tr "repo.forked_from"}}
  30. <span><a href="{{$repo.BaseRepo.Link}}">{{$repo.BaseRepo.OwnerName}}/{{$repo.BaseRepo.Name}}</a></span>
  31. {{end}}
  32. {{else}}
  33. <span class="icon tw-inline-block tw-pt-2">{{svg "octicon-file-directory-fill"}}</span>
  34. <span class="name tw-inline-block tw-pt-2">{{$.ContextUser.Name}}/{{$dir}}</span>
  35. <div class="tw-float-right">
  36. {{if $.allowAdopt}}
  37. <button class="ui button primary show-modal tw-p-2" data-modal="#adopt-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-plus"}}</span><span class="label">{{ctx.Locale.Tr "repo.adopt_preexisting_label"}}</span></button>
  38. <div class="ui g-modal-confirm modal" id="adopt-unadopted-modal-{{$dirI}}">
  39. <div class="header">
  40. <span class="label">{{ctx.Locale.Tr "repo.adopt_preexisting"}}</span>
  41. </div>
  42. <div class="content">
  43. <p>{{ctx.Locale.Tr "repo.adopt_preexisting_content" $dir}}</p>
  44. </div>
  45. <form class="ui form" method="post" action="{{AppSubUrl}}/user/settings/repos/unadopted">
  46. {{$.CsrfTokenHtml}}
  47. <input type="hidden" name="id" value="{{$dir}}">
  48. <input type="hidden" name="action" value="adopt">
  49. {{template "base/modal_actions_confirm" $}}
  50. </form>
  51. </div>
  52. {{end}}
  53. {{if $.allowDelete}}
  54. <button class="ui button red show-modal tw-p-2" data-modal="#delete-unadopted-modal-{{$dirI}}"><span class="icon">{{svg "octicon-x"}}</span><span class="label">{{ctx.Locale.Tr "repo.delete_preexisting_label"}}</span></button>
  55. <div class="ui g-modal-confirm modal" id="delete-unadopted-modal-{{$dirI}}">
  56. <div class="header">
  57. <span class="label">{{ctx.Locale.Tr "repo.delete_preexisting"}}</span>
  58. </div>
  59. <div class="content">
  60. <p>{{ctx.Locale.Tr "repo.delete_preexisting_content" $dir}}</p>
  61. </div>
  62. <form class="ui form" method="post" action="{{AppSubUrl}}/user/settings/repos/unadopted">
  63. {{$.CsrfTokenHtml}}
  64. <input type="hidden" name="id" value="{{$dir}}">
  65. <input type="hidden" name="action" value="delete">
  66. {{template "base/modal_actions_confirm" $}}
  67. </form>
  68. </div>
  69. {{end}}
  70. </div>
  71. {{end}}
  72. </div>
  73. </div>
  74. {{end}}
  75. </div>
  76. {{template "base/paginate" .}}
  77. {{else}}
  78. <div class="item">
  79. {{ctx.Locale.Tr "settings.repos_none"}}
  80. </div>
  81. {{end}}
  82. {{else}}
  83. {{if .Repos}}
  84. <div class="ui list">
  85. {{range .Repos}}
  86. <div class="item">
  87. <div class="content flex-text-block">
  88. {{if .IsPrivate}}
  89. {{svg "octicon-lock" 16 "text gold"}}
  90. {{else if .IsFork}}
  91. {{svg "octicon-repo-forked"}}
  92. {{else if .IsMirror}}
  93. {{svg "octicon-mirror"}}
  94. {{else if .IsTemplate}}
  95. {{svg "octicon-repo-template"}}
  96. {{else}}
  97. {{svg "octicon-repo"}}
  98. {{end}}
  99. <a class="name" href="{{.Link}}">{{.OwnerName}}/{{.Name}}</a>
  100. <span>{{FileSize .Size}}</span>
  101. {{if .IsFork}}
  102. {{ctx.Locale.Tr "repo.forked_from"}}
  103. <span><a href="{{.BaseRepo.Link}}">{{.BaseRepo.OwnerName}}/{{.BaseRepo.Name}}</a></span>
  104. {{end}}
  105. </div>
  106. </div>
  107. {{end}}
  108. </div>
  109. {{template "base/paginate" .}}
  110. {{else}}
  111. <div class="item">
  112. {{ctx.Locale.Tr "settings.repos_none"}}
  113. </div>
  114. {{end}}
  115. {{end}}
  116. </div>
  117. </div>
  118. <div class="ui g-modal-confirm delete modal">
  119. <div class="header">
  120. {{svg "octicon-trash"}}
  121. {{ctx.Locale.Tr "settings.remove_account_link"}}
  122. </div>
  123. <div class="content">
  124. <p>{{ctx.Locale.Tr "settings.remove_account_link_desc"}}</p>
  125. </div>
  126. {{template "base/modal_actions_confirm" .}}
  127. </div>
  128. {{template "user/settings/layout_footer" .}}