Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

options.tmpl 51KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997
  1. {{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings options")}}
  2. <div class="user-main-content twelve wide column">
  3. <h4 class="ui top attached header">
  4. {{ctx.Locale.Tr "repo.settings.basic_settings"}}
  5. </h4>
  6. <div class="ui attached segment">
  7. <form class="ui form" action="{{.Link}}" method="post">
  8. {{template "base/disable_form_autofill"}}
  9. {{.CsrfTokenHtml}}
  10. <input type="hidden" name="action" value="update">
  11. <div class="required field {{if .Err_RepoName}}error{{end}}">
  12. <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label>
  13. <input id="repo_name" name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required>
  14. </div>
  15. <div class="inline field">
  16. <label>{{ctx.Locale.Tr "repo.repo_size"}}</label>
  17. <span {{if not (eq .Repository.Size 0)}} data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>{{FileSize .Repository.Size}}</span>
  18. </div>
  19. <div class="inline field">
  20. <label>{{ctx.Locale.Tr "repo.template"}}</label>
  21. <div class="ui checkbox">
  22. <input name="template" type="checkbox" {{if .Repository.IsTemplate}}checked{{end}}>
  23. <label>{{ctx.Locale.Tr "repo.template_helper"}}</label>
  24. </div>
  25. </div>
  26. {{if not .Repository.IsFork}}
  27. <div class="inline field">
  28. <label>{{ctx.Locale.Tr "repo.visibility"}}</label>
  29. <div class="ui checkbox" {{if and (not .Repository.IsPrivate) (gt .Repository.NumStars 0)}}data-tooltip-content="{{ctx.Locale.Tr "repo.stars_remove_warning"}}"{{end}}>
  30. {{if .IsAdmin}}
  31. <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}>
  32. {{else}}
  33. <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}{{if and $.ForcePrivate .Repository.IsPrivate}} readonly{{end}}>
  34. {{end}}
  35. <label>{{ctx.Locale.Tr "repo.visibility_helper" | Safe}} {{if .Repository.NumForks}}<span class="text red">{{ctx.Locale.Tr "repo.visibility_fork_helper"}}</span>{{end}}</label>
  36. </div>
  37. </div>
  38. {{end}}
  39. <div class="field {{if .Err_Description}}error{{end}}">
  40. <label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
  41. <textarea id="description" name="description" rows="2" maxlength="2048">{{.Repository.Description}}</textarea>
  42. </div>
  43. <div class="field {{if .Err_Website}}error{{end}}">
  44. <label for="website">{{ctx.Locale.Tr "repo.settings.site"}}</label>
  45. <input id="website" name="website" type="url" maxlength="1024" value="{{.Repository.Website}}">
  46. </div>
  47. <div class="field">
  48. <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
  49. </div>
  50. </form>
  51. <div class="divider"></div>
  52. <form class="ui form" action="{{.Link}}/avatar" method="post" enctype="multipart/form-data">
  53. {{.CsrfTokenHtml}}
  54. <div class="inline field">
  55. <label for="avatar">{{ctx.Locale.Tr "settings.choose_new_avatar"}}</label>
  56. <input name="avatar" type="file" accept="image/png,image/jpeg,image/gif,image/webp">
  57. </div>
  58. <div class="field">
  59. <button class="ui primary button">{{ctx.Locale.Tr "settings.update_avatar"}}</button>
  60. <button class="ui red button link-action" data-url="{{.Link}}/avatar/delete">{{ctx.Locale.Tr "settings.delete_current_avatar"}}</button>
  61. </div>
  62. </form>
  63. </div>
  64. {{/* These variables exist to make the logic in the Settings window easier to comprehend and are not used later on. */}}
  65. {{$newMirrorsPartiallyEnabled := or (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}}
  66. {{/* .Repository.IsMirror is not always reliable if the repository is not actively acting as a mirror because of errors. */}}
  67. {{$showMirrorSettings := or $newMirrorsPartiallyEnabled .Repository.IsMirror .PullMirror .PushMirrors}}
  68. {{$newMirrorsEntirelyEnabled := and (not .DisableNewPullMirrors) (not .DisableNewPushMirrors)}}
  69. {{$onlyNewPushMirrorsEnabled := and (not .DisableNewPushMirrors) .DisableNewPullMirrors}}
  70. {{$onlyNewPullMirrorsEnabled := and .DisableNewPushMirrors (not .DisableNewPullMirrors)}}
  71. {{$existingPushMirror := or .Repository.IsMirror .PushMirrors}}
  72. {{$modifyBrokenPullMirror := and .Repository.IsMirror (not .PullMirror)}}
  73. {{$isWorkingPullMirror := .PullMirror}}
  74. {{if $showMirrorSettings}}
  75. <h4 class="ui top attached header">
  76. {{ctx.Locale.Tr "repo.settings.mirror_settings"}}
  77. </h4>
  78. <div class="ui attached segment">
  79. {{if $newMirrorsEntirelyEnabled}}
  80. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs"}}
  81. <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/usage/repo-mirror#pushing-to-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br>
  82. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.pull_mirror_instructions"}}
  83. <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/usage/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_pull_section"}}</a><br>
  84. {{else if $onlyNewPushMirrorsEnabled}}
  85. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_pull_mirror.instructions"}}
  86. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}}
  87. <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/usage/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br>
  88. {{else if $onlyNewPullMirrorsEnabled}}
  89. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.instructions"}}
  90. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.pull_mirror_warning"}}
  91. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.more_information_if_disabled"}}
  92. <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.com/usage/repo-mirror#pulling-from-a-remote-repository">{{ctx.Locale.Tr "repo.settings.mirror_settings.docs.doc_link_title"}}</a><br><br>
  93. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.disabled_push_mirror.info"}}
  94. {{if $existingPushMirror}}
  95. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}
  96. {{end}}
  97. {{else}}
  98. {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.no_new_mirrors"}} {{ctx.Locale.Tr "repo.settings.mirror_settings.docs.can_still_use"}}<br>
  99. {{end}}
  100. <table class="ui table">
  101. {{if $existingPushMirror}}
  102. <thead>
  103. <tr>
  104. <th style="width:40%">{{ctx.Locale.Tr "repo.settings.mirror_settings.mirrored_repository"}}</th>
  105. <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction"}}</th>
  106. <th>{{ctx.Locale.Tr "repo.settings.mirror_settings.last_update"}}</th>
  107. <th></th>
  108. </tr>
  109. </thead>
  110. {{end}}
  111. {{if $modifyBrokenPullMirror}}
  112. {{/* even if a repo is a pull mirror (IsMirror=true), the PullMirror might still be nil if the mirror migration is broken */}}
  113. <tbody>
  114. <tr>
  115. <td colspan="4">
  116. <div class="text red gt-py-4 gt-border-secondary-bottom">{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}: {{ctx.Locale.Tr "error.occurred"}}</div>
  117. </td>
  118. </tr>
  119. </tbody>
  120. {{else if $isWorkingPullMirror}}
  121. <tbody>
  122. <tr>
  123. <td>{{.PullMirror.RemoteAddress}}</td>
  124. <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.pull"}}</td>
  125. <td>{{DateTime "full" .PullMirror.UpdatedUnix}}</td>
  126. <td class="right aligned">
  127. <form method="post" class="gt-dib">
  128. {{.CsrfTokenHtml}}
  129. <input type="hidden" name="action" value="mirror-sync">
  130. <button class="ui primary tiny button inline text-thin">{{ctx.Locale.Tr "repo.settings.sync_mirror"}}</button>
  131. </form>
  132. </td>
  133. </tr>
  134. <tr>
  135. <td colspan="4">
  136. <form class="ui form" method="post">
  137. {{template "base/disable_form_autofill"}}
  138. {{.CsrfTokenHtml}}
  139. <input type="hidden" name="action" value="mirror">
  140. <div class="inline field {{if .Err_EnablePrune}}error{{end}}">
  141. <label>{{ctx.Locale.Tr "repo.mirror_prune"}}</label>
  142. <div class="ui checkbox">
  143. <input id="enable_prune" name="enable_prune" type="checkbox" {{if .PullMirror.EnablePrune}}checked{{end}}>
  144. <label>{{ctx.Locale.Tr "repo.mirror_prune_desc"}}</label>
  145. </div>
  146. </div>
  147. <div class="inline field {{if .Err_Interval}}error{{end}}">
  148. <label for="interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
  149. <input id="interval" name="interval" value="{{.PullMirror.Interval}}">
  150. </div>
  151. {{$address := MirrorRemoteAddress $.Context .Repository .PullMirror.GetRemoteName false}}
  152. <div class="field {{if .Err_MirrorAddress}}error{{end}}">
  153. <label for="mirror_address">{{ctx.Locale.Tr "repo.mirror_address"}}</label>
  154. <input id="mirror_address" name="mirror_address" value="{{$address.Address}}" required>
  155. <p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p>
  156. </div>
  157. <details class="ui optional field" {{if or .Err_Auth $address.Username}}open{{end}}>
  158. <summary class="gt-p-2">
  159. {{ctx.Locale.Tr "repo.need_auth"}}
  160. </summary>
  161. <div class="gt-p-2">
  162. <div class="inline field {{if .Err_Auth}}error{{end}}">
  163. <label for="mirror_username">{{ctx.Locale.Tr "username"}}</label>
  164. <input id="mirror_username" name="mirror_username" value="{{$address.Username}}" {{if not .mirror_username}}data-need-clear="true"{{end}}>
  165. </div>
  166. <div class="inline field {{if .Err_Auth}}error{{end}}">
  167. <label for="mirror_password">{{ctx.Locale.Tr "password"}}</label>
  168. <input id="mirror_password" name="mirror_password" type="password" placeholder="{{if $address.Password}}{{ctx.Locale.Tr "repo.mirror_password_placeholder"}}{{else}}{{ctx.Locale.Tr "repo.mirror_password_blank_placeholder"}}{{end}}" value="" {{if not .mirror_password}}data-need-clear="true"{{end}} autocomplete="off">
  169. </div>
  170. <p class="help">{{ctx.Locale.Tr "repo.mirror_password_help"}}</p>
  171. </div>
  172. </details>
  173. {{if .LFSStartServer}}
  174. <div class="inline field">
  175. <label>{{ctx.Locale.Tr "repo.mirror_lfs"}}</label>
  176. <div class="ui checkbox">
  177. <input id="mirror_lfs" name="mirror_lfs" type="checkbox" {{if .PullMirror.LFS}}checked{{end}}>
  178. <label>{{ctx.Locale.Tr "repo.mirror_lfs_desc"}}</label>
  179. </div>
  180. </div>
  181. <div class="field {{if .Err_LFSEndpoint}}error{{end}}">
  182. <label for="mirror_lfs_endpoint">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint"}}</label>
  183. <input id="mirror_lfs_endpoint" name="mirror_lfs_endpoint" value="{{.PullMirror.LFSEndpoint}}" placeholder="{{ctx.Locale.Tr "repo.migrate_options_lfs_endpoint.placeholder"}}">
  184. <p class="help">{{ctx.Locale.Tr "repo.mirror_lfs_endpoint_desc" "https://github.com/git-lfs/git-lfs/blob/main/docs/api/server-discovery.md#server-discovery" | Str2html}}</p>
  185. </div>
  186. {{end}}
  187. <div class="field">
  188. <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_mirror_settings"}}</button>
  189. </div>
  190. </form>
  191. </td>
  192. </tr>
  193. </tbody>
  194. <thead><tr><th colspan="4"></th></tr></thead>
  195. {{end}}{{/* end if: IsMirror */}}
  196. <tbody>
  197. {{range .PushMirrors}}
  198. <tr>
  199. <td class="gt-word-break">{{.RemoteAddress}}</td>
  200. <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.direction.push"}}</td>
  201. <td>{{if .LastUpdateUnix}}{{DateTime "full" .LastUpdateUnix}}{{else}}{{ctx.Locale.Tr "never"}}{{end}} {{if .LastError}}<div class="ui red label" data-tooltip-content="{{.LastError}}">{{ctx.Locale.Tr "error"}}</div>{{end}}</td>
  202. <td class="right aligned">
  203. <button
  204. class="ui tiny button show-modal"
  205. data-modal="#push-mirror-edit-modal"
  206. data-tooltip-content="{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.edit_sync_time"}}"
  207. data-modal-push-mirror-edit-id="{{.ID}}"
  208. data-modal-push-mirror-edit-interval="{{.Interval}}"
  209. data-modal-push-mirror-edit-address="{{.RemoteAddress}}"
  210. >
  211. {{svg "octicon-pencil" 14}}
  212. </button>
  213. <form method="post" class="gt-dib">
  214. {{$.CsrfTokenHtml}}
  215. <input type="hidden" name="action" value="push-mirror-sync">
  216. <input type="hidden" name="push_mirror_id" value="{{.ID}}">
  217. <button class="ui primary tiny button" data-tooltip-content="{{ctx.Locale.Tr "repo.settings.sync_mirror"}}">{{svg "octicon-sync" 14}}</button>
  218. </form>
  219. <form method="post" class="gt-dib">
  220. {{$.CsrfTokenHtml}}
  221. <input type="hidden" name="action" value="push-mirror-remove">
  222. <input type="hidden" name="push_mirror_id" value="{{.ID}}">
  223. <button class="ui basic red tiny button" data-tooltip-content="{{ctx.Locale.Tr "remove"}}">{{svg "octicon-trash" 14}}</button>
  224. </form>
  225. </td>
  226. </tr>
  227. {{else}}
  228. <tr>
  229. <td>{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.none"}}</td>
  230. </tr>
  231. {{end}}
  232. {{if (not .DisableNewPushMirrors)}}
  233. <tr>
  234. <td colspan="4">
  235. <form class="ui form" method="post">
  236. {{template "base/disable_form_autofill"}}
  237. {{.CsrfTokenHtml}}
  238. <input type="hidden" name="action" value="push-mirror-add">
  239. <div class="field {{if .Err_PushMirrorAddress}}error{{end}}">
  240. <label for="push_mirror_address">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.remote_url"}}</label>
  241. <input id="push_mirror_address" name="push_mirror_address" value="{{.push_mirror_address}}" required>
  242. <p class="help">{{ctx.Locale.Tr "repo.mirror_address_desc"}}</p>
  243. </div>
  244. <details class="ui optional field" {{if or .Err_PushMirrorAuth .push_mirror_username}}open{{end}}>
  245. <summary class="gt-p-2">
  246. {{ctx.Locale.Tr "repo.need_auth"}}
  247. </summary>
  248. <div class="gt-p-2">
  249. <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}">
  250. <label for="push_mirror_username">{{ctx.Locale.Tr "username"}}</label>
  251. <input id="push_mirror_username" name="push_mirror_username" value="{{.push_mirror_username}}">
  252. </div>
  253. <div class="inline field {{if .Err_PushMirrorAuth}}error{{end}}">
  254. <label for="push_mirror_password">{{ctx.Locale.Tr "password"}}</label>
  255. <input id="push_mirror_password" name="push_mirror_password" type="password" value="{{.push_mirror_password}}" autocomplete="off">
  256. </div>
  257. </div>
  258. </details>
  259. <div class="field">
  260. <div class="ui checkbox">
  261. <input id="push_mirror_sync_on_commit" name="push_mirror_sync_on_commit" type="checkbox" {{if .push_mirror_sync_on_commit}}checked{{end}}>
  262. <label for="push_mirror_sync_on_commit">{{ctx.Locale.Tr "repo.mirror_sync_on_commit"}}</label>
  263. </div>
  264. </div>
  265. <div class="inline field {{if .Err_PushMirrorInterval}}error{{end}}">
  266. <label for="push_mirror_interval">{{ctx.Locale.Tr "repo.mirror_interval" .MinimumMirrorInterval}}</label>
  267. <input id="push_mirror_interval" name="push_mirror_interval" value="{{if .push_mirror_interval}}{{.push_mirror_interval}}{{else}}{{.DefaultMirrorInterval}}{{end}}">
  268. </div>
  269. <div class="field">
  270. <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.mirror_settings.push_mirror.add"}}</button>
  271. </div>
  272. </form>
  273. </td>
  274. </tr>
  275. {{end}}
  276. </tbody>
  277. </table>
  278. </div>
  279. {{end}}
  280. <h4 class="ui top attached header">
  281. {{ctx.Locale.Tr "repo.settings.advanced_settings"}}
  282. </h4>
  283. <div class="ui attached segment">
  284. <form class="ui form" method="post">
  285. {{.CsrfTokenHtml}}
  286. <input type="hidden" name="action" value="advanced">
  287. {{$isCodeEnabled := .Repository.UnitEnabled $.Context $.UnitTypeCode}}
  288. {{$isCodeGlobalDisabled := .UnitTypeCode.UnitGlobalDisabled}}
  289. <div class="inline field">
  290. <label>{{ctx.Locale.Tr "repo.code"}}</label>
  291. <div class="ui checkbox{{if $isCodeGlobalDisabled}} disabled{{end}}"{{if $isCodeGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  292. <input class="enable-system" name="enable_code" type="checkbox"{{if $isCodeEnabled}} checked{{end}}>
  293. <label>{{ctx.Locale.Tr "repo.code.desc"}}</label>
  294. </div>
  295. </div>
  296. {{$isWikiEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeWiki) (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}
  297. {{$isWikiGlobalDisabled := .UnitTypeWiki.UnitGlobalDisabled}}
  298. {{$isExternalWikiGlobalDisabled := .UnitTypeExternalWiki.UnitGlobalDisabled}}
  299. {{$isBothWikiGlobalDisabled := and $isWikiGlobalDisabled $isExternalWikiGlobalDisabled}}
  300. <div class="inline field">
  301. <label>{{ctx.Locale.Tr "repo.wiki"}}</label>
  302. <div class="ui checkbox{{if $isBothWikiGlobalDisabled}} disabled{{end}}"{{if $isBothWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  303. <input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if $isWikiEnabled}}checked{{end}}>
  304. <label>{{ctx.Locale.Tr "repo.settings.wiki_desc"}}</label>
  305. </div>
  306. </div>
  307. <div class="field{{if not $isWikiEnabled}} disabled{{end}}" id="wiki_box">
  308. <div class="field">
  309. <div class="ui radio checkbox{{if $isWikiGlobalDisabled}} disabled{{end}}"{{if $isWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  310. <input class="enable-system-radio" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}checked{{end}}>
  311. <label>{{ctx.Locale.Tr "repo.settings.use_internal_wiki"}}</label>
  312. </div>
  313. </div>
  314. <div class="field">
  315. <div class="ui radio checkbox{{if $isExternalWikiGlobalDisabled}} disabled{{end}}"{{if $isExternalWikiGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  316. <input class="enable-system-radio" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalWiki}}checked{{end}}>
  317. <label>{{ctx.Locale.Tr "repo.settings.use_external_wiki"}}</label>
  318. </div>
  319. </div>
  320. <div class="field gt-pl-4 {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalWiki)}}disabled{{end}}" id="external_wiki_box">
  321. <label for="external_wiki_url">{{ctx.Locale.Tr "repo.settings.external_wiki_url"}}</label>
  322. <input id="external_wiki_url" name="external_wiki_url" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}">
  323. <p class="help">{{ctx.Locale.Tr "repo.settings.external_wiki_url_desc"}}</p>
  324. </div>
  325. </div>
  326. <div class="divider"></div>
  327. {{$isIssuesEnabled := or (.Repository.UnitEnabled $.Context $.UnitTypeIssues) (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}
  328. {{$isIssuesGlobalDisabled := .UnitTypeIssues.UnitGlobalDisabled}}
  329. {{$isExternalTrackerGlobalDisabled := .UnitTypeExternalTracker.UnitGlobalDisabled}}
  330. {{$isIssuesAndExternalGlobalDisabled := and $isIssuesGlobalDisabled $isExternalTrackerGlobalDisabled}}
  331. <div class="inline field">
  332. <label>{{ctx.Locale.Tr "repo.issues"}}</label>
  333. <div class="ui checkbox{{if $isIssuesAndExternalGlobalDisabled}} disabled{{end}}"{{if $isIssuesAndExternalGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  334. <input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if $isIssuesEnabled}}checked{{end}}>
  335. <label>{{ctx.Locale.Tr "repo.settings.issues_desc"}}</label>
  336. </div>
  337. </div>
  338. <div class="field {{if not $isIssuesEnabled}}disabled{{end}}" id="issue_box">
  339. <div class="field">
  340. <div class="ui radio checkbox{{if $isIssuesGlobalDisabled}} disabled{{end}}"{{if $isIssuesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  341. <input class="enable-system-radio" name="enable_external_tracker" type="radio" value="false" data-context="#internal_issue_box" data-target="#external_issue_box" {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}checked{{end}}>
  342. <label>{{ctx.Locale.Tr "repo.settings.use_internal_issue_tracker"}}</label>
  343. </div>
  344. </div>
  345. <div class="field gt-pl-4 {{if (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}disabled{{end}}" id="internal_issue_box">
  346. {{if .Repository.CanEnableTimetracker}}
  347. <div class="field">
  348. <div class="ui checkbox">
  349. <input name="enable_timetracker" class="enable-system" data-target="#only_contributors" type="checkbox" {{if .Repository.IsTimetrackerEnabled $.Context}}checked{{end}}>
  350. <label>{{ctx.Locale.Tr "repo.settings.enable_timetracker"}}</label>
  351. </div>
  352. </div>
  353. <div class="field {{if not (.Repository.IsTimetrackerEnabled $.Context)}}disabled{{end}}" id="only_contributors">
  354. <div class="ui checkbox">
  355. <input name="allow_only_contributors_to_track_time" type="checkbox" {{if .Repository.AllowOnlyContributorsToTrackTime $.Context}}checked{{end}}>
  356. <label>{{ctx.Locale.Tr "repo.settings.allow_only_contributors_to_track_time"}}</label>
  357. </div>
  358. </div>
  359. {{end}}
  360. <div class="field">
  361. <div class="ui checkbox">
  362. <input name="enable_issue_dependencies" type="checkbox" {{if (.Repository.IsDependenciesEnabled $.Context)}}checked{{end}}>
  363. <label>{{ctx.Locale.Tr "repo.issues.dependency.setting"}}</label>
  364. </div>
  365. </div>
  366. <div class="ui checkbox">
  367. <input name="enable_close_issues_via_commit_in_any_branch" type="checkbox" {{if .Repository.CloseIssuesViaCommitInAnyBranch}}checked{{end}}>
  368. <label>{{ctx.Locale.Tr "repo.settings.admin_enable_close_issues_via_commit_in_any_branch"}}</label>
  369. </div>
  370. </div>
  371. <div class="field">
  372. <div class="ui radio checkbox{{if $isExternalTrackerGlobalDisabled}} disabled{{end}}"{{if $isExternalTrackerGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  373. <input class="enable-system-radio" name="enable_external_tracker" type="radio" value="true" data-context="#internal_issue_box" data-target="#external_issue_box" {{if .Repository.UnitEnabled $.Context $.UnitTypeExternalTracker}}checked{{end}}>
  374. <label>{{ctx.Locale.Tr "repo.settings.use_external_issue_tracker"}}</label>
  375. </div>
  376. </div>
  377. <div class="field gt-pl-4 {{if not (.Repository.UnitEnabled $.Context $.UnitTypeExternalTracker)}}disabled{{end}}" id="external_issue_box">
  378. <div class="field">
  379. <label for="external_tracker_url">{{ctx.Locale.Tr "repo.settings.external_tracker_url"}}</label>
  380. <input id="external_tracker_url" name="external_tracker_url" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerURL}}">
  381. <p class="help">{{ctx.Locale.Tr "repo.settings.external_tracker_url_desc"}}</p>
  382. </div>
  383. <div class="field">
  384. <label for="tracker_url_format">{{ctx.Locale.Tr "repo.settings.tracker_url_format"}}</label>
  385. <input id="tracker_url_format" name="tracker_url_format" type="url" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerFormat}}" placeholder="https://github.com/{user}/{repo}/issues/{index}">
  386. <p class="help">{{ctx.Locale.Tr "repo.settings.tracker_url_format_desc" | Str2html}}</p>
  387. </div>
  388. <div class="inline fields">
  389. <label for="issue_style">{{ctx.Locale.Tr "repo.settings.tracker_issue_style"}}</label>
  390. <div class="field">
  391. <div class="ui radio checkbox">
  392. {{$externalTracker := (.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker)}}
  393. {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}}
  394. <input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="numeric" {{if eq $externalTrackerStyle "numeric"}}checked{{end}}>
  395. <label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.numeric"}} <span class="ui light grey text">#1234</span></label>
  396. </div>
  397. </div>
  398. <div class="field">
  399. <div class="ui radio checkbox">
  400. <input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="alphanumeric" {{if eq $externalTrackerStyle "alphanumeric"}}checked{{end}}>
  401. <label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.alphanumeric"}} <span class="ui light grey text">ABC-123 , DEFG-234</span></label>
  402. </div>
  403. </div>
  404. <div class="field">
  405. <div class="ui radio checkbox">
  406. <input class="js-tracker-issue-style" name="tracker_issue_style" type="radio" value="regexp" {{if eq $externalTrackerStyle "regexp"}}checked{{end}}>
  407. <label>{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp"}} <span class="ui light grey text">(ISSUE-\d+) , ISSUE-(\d+)</span></label>
  408. </div>
  409. </div>
  410. </div>
  411. <div class="field {{if ne $externalTrackerStyle "regexp"}}disabled{{end}}" id="tracker-issue-style-regex-box">
  412. <label for="external_tracker_regexp_pattern">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern"}}</label>
  413. <input id="external_tracker_regexp_pattern" name="external_tracker_regexp_pattern" value="{{(.Repository.MustGetUnit $.Context $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerRegexpPattern}}">
  414. <p class="help">{{ctx.Locale.Tr "repo.settings.tracker_issue_style.regexp_pattern_desc" | Str2html}}</p>
  415. </div>
  416. </div>
  417. </div>
  418. <div class="divider"></div>
  419. {{$isProjectsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeProjects}}
  420. {{$isProjectsGlobalDisabled := .UnitTypeProjects.UnitGlobalDisabled}}
  421. <div class="inline field">
  422. <label>{{ctx.Locale.Tr "repo.project_board"}}</label>
  423. <div class="ui checkbox{{if $isProjectsGlobalDisabled}} disabled{{end}}"{{if $isProjectsGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  424. <input class="enable-system" name="enable_projects" type="checkbox" {{if $isProjectsEnabled}}checked{{end}}>
  425. <label>{{ctx.Locale.Tr "repo.settings.projects_desc"}}</label>
  426. </div>
  427. </div>
  428. {{$isReleasesEnabled := .Repository.UnitEnabled $.Context $.UnitTypeReleases}}
  429. {{$isReleasesGlobalDisabled := .UnitTypeReleases.UnitGlobalDisabled}}
  430. <div class="inline field">
  431. <label>{{ctx.Locale.Tr "repo.releases"}}</label>
  432. <div class="ui checkbox{{if $isReleasesGlobalDisabled}} disabled{{end}}"{{if $isReleasesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  433. <input class="enable-system" name="enable_releases" type="checkbox" {{if $isReleasesEnabled}}checked{{end}}>
  434. <label>{{ctx.Locale.Tr "repo.settings.releases_desc"}}</label>
  435. </div>
  436. </div>
  437. {{$isPackagesEnabled := .Repository.UnitEnabled $.Context $.UnitTypePackages}}
  438. {{$isPackagesGlobalDisabled := .UnitTypePackages.UnitGlobalDisabled}}
  439. <div class="inline field">
  440. <label>{{ctx.Locale.Tr "repo.packages"}}</label>
  441. <div class="ui checkbox{{if $isPackagesGlobalDisabled}} disabled{{end}}"{{if $isPackagesGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  442. <input class="enable-system" name="enable_packages" type="checkbox" {{if $isPackagesEnabled}}checked{{end}}>
  443. <label>{{ctx.Locale.Tr "repo.settings.packages_desc"}}</label>
  444. </div>
  445. </div>
  446. {{if .EnableActions}}
  447. {{$isActionsEnabled := .Repository.UnitEnabled $.Context $.UnitTypeActions}}
  448. {{$isActionsGlobalDisabled := .UnitTypeActions.UnitGlobalDisabled}}
  449. <div class="inline field">
  450. <label>{{ctx.Locale.Tr "actions.actions"}}</label>
  451. <div class="ui checkbox{{if $isActionsGlobalDisabled}} disabled{{end}}"{{if $isActionsGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  452. <input class="enable-system" name="enable_actions" type="checkbox" {{if $isActionsEnabled}}checked{{end}}>
  453. <label>{{ctx.Locale.Tr "repo.settings.actions_desc"}}</label>
  454. </div>
  455. </div>
  456. {{end}}
  457. {{if not .IsMirror}}
  458. <div class="divider"></div>
  459. {{$pullRequestEnabled := .Repository.UnitEnabled $.Context $.UnitTypePullRequests}}
  460. {{$pullRequestGlobalDisabled := .UnitTypePullRequests.UnitGlobalDisabled}}
  461. {{$prUnit := .Repository.MustGetUnit $.Context $.UnitTypePullRequests}}
  462. <div class="inline field">
  463. <label>{{ctx.Locale.Tr "repo.pulls"}}</label>
  464. <div class="ui checkbox{{if $pullRequestGlobalDisabled}} disabled{{end}}"{{if $pullRequestGlobalDisabled}} data-tooltip-content="{{ctx.Locale.Tr "repo.unit_disabled"}}"{{end}}>
  465. <input class="enable-system" name="enable_pulls" type="checkbox" data-target="#pull_box" {{if $pullRequestEnabled}}checked{{end}}>
  466. <label>{{ctx.Locale.Tr "repo.settings.pulls_desc"}}</label>
  467. </div>
  468. </div>
  469. <div class="field{{if not $pullRequestEnabled}} disabled{{end}}" id="pull_box">
  470. <div class="field">
  471. <p>
  472. {{ctx.Locale.Tr "repo.settings.merge_style_desc"}}
  473. </p>
  474. </div>
  475. <div class="field">
  476. <div class="ui checkbox">
  477. <input name="pulls_allow_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowMerge)}}checked{{end}}>
  478. <label>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</label>
  479. </div>
  480. </div>
  481. <div class="field">
  482. <div class="ui checkbox">
  483. <input name="pulls_allow_rebase" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebase)}}checked{{end}}>
  484. <label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</label>
  485. </div>
  486. </div>
  487. <div class="field">
  488. <div class="ui checkbox">
  489. <input name="pulls_allow_rebase_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseMerge)}}checked{{end}}>
  490. <label>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</label>
  491. </div>
  492. </div>
  493. <div class="field">
  494. <div class="ui checkbox">
  495. <input name="pulls_allow_squash" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowSquash)}}checked{{end}}>
  496. <label>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</label>
  497. </div>
  498. </div>
  499. <div class="field">
  500. <div class="ui checkbox">
  501. <input name="pulls_allow_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowManualMerge)}}checked{{end}}>
  502. <label>{{ctx.Locale.Tr "repo.pulls.merge_manually"}}</label>
  503. </div>
  504. </div>
  505. <div class="field">
  506. <p>
  507. {{ctx.Locale.Tr "repo.settings.default_merge_style_desc"}}
  508. </p>
  509. <div class="ui dropdown selection">
  510. <select name="pulls_default_merge_style">
  511. <option value="merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</option>
  512. <option value="rebase" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</option>
  513. <option value="rebase-merge" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</option>
  514. <option value="squash" {{if or (not $pullRequestEnabled) (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}selected{{end}}>{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</option>
  515. </select>{{svg "octicon-triangle-down" 14 "dropdown icon"}}
  516. <div class="default text">
  517. {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "merge")}}
  518. {{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}
  519. {{end}}
  520. {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase")}}
  521. {{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}
  522. {{end}}
  523. {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "rebase-merge")}}
  524. {{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}
  525. {{end}}
  526. {{if (eq $prUnit.PullRequestsConfig.DefaultMergeStyle "squash")}}
  527. {{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}
  528. {{end}}
  529. </div>
  530. <div class="menu">
  531. <div class="item" data-value="merge">{{ctx.Locale.Tr "repo.pulls.merge_pull_request"}}</div>
  532. <div class="item" data-value="rebase">{{ctx.Locale.Tr "repo.pulls.rebase_merge_pull_request"}}</div>
  533. <div class="item" data-value="rebase-merge">{{ctx.Locale.Tr "repo.pulls.rebase_merge_commit_pull_request"}}</div>
  534. <div class="item" data-value="squash">{{ctx.Locale.Tr "repo.pulls.squash_merge_pull_request"}}</div>
  535. </div>
  536. </div>
  537. </div>
  538. <div class="field">
  539. <div class="ui checkbox">
  540. <input name="default_allow_maintainer_edit" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultAllowMaintainerEdit)}}checked{{end}}>
  541. <label>{{ctx.Locale.Tr "repo.settings.pulls.default_allow_edits_from_maintainers"}}</label>
  542. </div>
  543. </div>
  544. <div class="field">
  545. <div class="ui checkbox">
  546. <input name="pulls_allow_rebase_update" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AllowRebaseUpdate)}}checked{{end}}>
  547. <label>{{ctx.Locale.Tr "repo.settings.pulls.allow_rebase_update"}}</label>
  548. </div>
  549. </div>
  550. <div class="field">
  551. <div class="ui checkbox">
  552. <input name="default_delete_branch_after_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.DefaultDeleteBranchAfterMerge)}}checked{{end}}>
  553. <label>{{ctx.Locale.Tr "repo.settings.pulls.default_delete_branch_after_merge"}}</label>
  554. </div>
  555. </div>
  556. <div class="field">
  557. <div class="ui checkbox">
  558. <input name="enable_autodetect_manual_merge" type="checkbox" {{if or (not $pullRequestEnabled) ($prUnit.PullRequestsConfig.AutodetectManualMerge)}}checked{{end}}>
  559. <label>{{ctx.Locale.Tr "repo.settings.pulls.enable_autodetect_manual_merge"}}</label>
  560. </div>
  561. </div>
  562. <div class="field">
  563. <div class="ui checkbox">
  564. <input name="pulls_ignore_whitespace" type="checkbox" {{if and $pullRequestEnabled ($prUnit.PullRequestsConfig.IgnoreWhitespaceConflicts)}}checked{{end}}>
  565. <label>{{ctx.Locale.Tr "repo.settings.pulls.ignore_whitespace"}}</label>
  566. </div>
  567. </div>
  568. </div>
  569. {{end}}
  570. <div class="divider"></div>
  571. <div class="field">
  572. <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
  573. </div>
  574. </form>
  575. </div>
  576. <h4 class="ui top attached header">
  577. {{ctx.Locale.Tr "repo.settings.signing_settings"}}
  578. </h4>
  579. <div class="ui attached segment">
  580. <form class="ui form" method="post">
  581. {{.CsrfTokenHtml}}
  582. <input type="hidden" name="action" value="signing">
  583. <div class="field">
  584. <label>{{ctx.Locale.Tr "repo.settings.trust_model"}}</label><br>
  585. <div class="field">
  586. <div class="ui radio checkbox">
  587. <input type="radio" id="trust_model_default" name="trust_model" {{if eq .Repository.TrustModel.String "default"}}checked="checked"{{end}} value="default">
  588. <label for="trust_model_default">{{ctx.Locale.Tr "repo.settings.trust_model.default"}}</label>
  589. <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.default.desc"}}</p>
  590. </div>
  591. </div>
  592. <div class="field">
  593. <div class="ui radio checkbox">
  594. <input type="radio" id="trust_model_collaborator" name="trust_model" {{if eq .Repository.TrustModel.String "collaborator"}}checked="checked"{{end}} value="collaborator">
  595. <label for="trust_model_collaborator">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.long"}}</label>
  596. <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaborator.desc"}}</p>
  597. </div>
  598. </div>
  599. <div class="field">
  600. <div class="ui radio checkbox">
  601. <input type="radio" name="trust_model" id="trust_model_committer" {{if eq .Repository.TrustModel.String "committer"}}checked="checked"{{end}} value="committer">
  602. <label for="trust_model_committer">{{ctx.Locale.Tr "repo.settings.trust_model.committer.long"}}</label>
  603. <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.committer.desc"}}</p>
  604. </div>
  605. </div>
  606. <div class="field">
  607. <div class="ui radio checkbox">
  608. <input type="radio" name="trust_model" id="trust_model_collaboratorcommitter" {{if eq .Repository.TrustModel.String "collaboratorcommitter"}}checked="checked"{{end}} value="collaboratorcommitter">
  609. <label for="trust_model_collaboratorcommitter">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.long"}}</label>
  610. <p class="help">{{ctx.Locale.Tr "repo.settings.trust_model.collaboratorcommitter.desc"}}</p>
  611. </div>
  612. </div>
  613. </div>
  614. <div class="divider"></div>
  615. <div class="field">
  616. <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
  617. </div>
  618. </form>
  619. </div>
  620. {{if .IsAdmin}}
  621. <h4 class="ui top attached header">
  622. {{ctx.Locale.Tr "repo.settings.admin_settings"}}
  623. </h4>
  624. <div class="ui attached segment">
  625. <form class="ui form" method="post">
  626. {{.CsrfTokenHtml}}
  627. <input type="hidden" name="action" value="admin">
  628. <div class="field">
  629. <div class="ui checkbox">
  630. <input name="enable_health_check" type="checkbox" {{if .Repository.IsFsckEnabled}}checked{{end}}>
  631. <label>{{ctx.Locale.Tr "repo.settings.admin_enable_health_check"}}</label>
  632. </div>
  633. </div>
  634. <div class="field">
  635. <button class="ui primary button">{{ctx.Locale.Tr "repo.settings.update_settings"}}</button>
  636. </div>
  637. </form>
  638. <div class="divider"></div>
  639. <form class="ui form" method="post">
  640. {{.CsrfTokenHtml}}
  641. <input type="hidden" name="action" value="admin_index">
  642. {{if .CodeIndexerEnabled}}
  643. <h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_code_indexer"}}</h4>
  644. <div class="inline fields">
  645. <label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label>
  646. <span class="field">
  647. {{if .CodeIndexerStatus}}
  648. <a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.CodeIndexerStatus.CommitSha}}">
  649. <span class="shortsha">{{ShortSha .CodeIndexerStatus.CommitSha}}</span>
  650. </a>
  651. {{else}}
  652. <span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span>
  653. {{end}}
  654. </span>
  655. <div class="field">
  656. <button class="ui primary button" name="request_reindex_type" value="code">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button>
  657. </div>
  658. </div>
  659. {{end}}
  660. <h4 class="ui header">{{ctx.Locale.Tr "repo.settings.admin_stats_indexer"}}</h4>
  661. <div class="inline fields">
  662. {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}}
  663. <label>{{ctx.Locale.Tr "repo.settings.admin_indexer_commit_sha"}}</label>
  664. {{end}}
  665. <span class="field">
  666. {{if and .StatsIndexerStatus .StatsIndexerStatus.CommitSha}}
  667. <a rel="nofollow" class="ui sha label" href="{{.RepoLink}}/commit/{{.StatsIndexerStatus.CommitSha}}">
  668. <span class="shortsha">{{ShortSha .StatsIndexerStatus.CommitSha}}</span>
  669. </a>
  670. {{else}}
  671. <span>{{ctx.Locale.Tr "repo.settings.admin_indexer_unindexed"}}</span>
  672. {{end}}
  673. </span>
  674. <div class="field">
  675. <button class="ui primary button" name="request_reindex_type" value="stats">{{ctx.Locale.Tr "repo.settings.reindex_button"}}</button>
  676. </div>
  677. </div>
  678. </form>
  679. </div>
  680. {{end}}
  681. {{if .Permission.IsOwner}}
  682. <h4 class="ui top attached error header">
  683. {{ctx.Locale.Tr "repo.settings.danger_zone"}}
  684. </h4>
  685. <div class="ui attached error danger segment">
  686. <div class="flex-list">
  687. {{if .Repository.IsMirror}}
  688. <div class="flex-item">
  689. <div class="flex-item-main">
  690. <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert"}}</div>
  691. <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_desc"}}</div>
  692. </div>
  693. <div class="flex-item-trailing">
  694. <button class="ui basic red show-modal button" data-modal="#convert-mirror-repo-modal">{{ctx.Locale.Tr "repo.settings.convert"}}</button>
  695. </div>
  696. </div>
  697. {{end}}
  698. {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
  699. <div class="flex-item">
  700. <div class="flex-item-main">
  701. <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</div>
  702. <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.convert_fork_desc"}}</div>
  703. </div>
  704. <div class="flex-item-trailing">
  705. <button class="ui basic red show-modal button" data-modal="#convert-fork-repo-modal">{{ctx.Locale.Tr "repo.settings.convert_fork"}}</button>
  706. </div>
  707. </div>
  708. {{end}}
  709. <div class="flex-item">
  710. <div class="flex-item-main">
  711. <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.transfer"}}</div>
  712. <div class="flex-item-body">
  713. {{if .RepoTransfer}}
  714. {{ctx.Locale.Tr "repo.settings.transfer_started" .RepoTransfer.Recipient.DisplayName}}
  715. {{else}}
  716. {{ctx.Locale.Tr "repo.settings.transfer_desc"}}
  717. {{end}}
  718. </div>
  719. </div>
  720. <div class="flex-item-trailing">
  721. {{if .RepoTransfer}}
  722. <form class="ui form" action="{{.Link}}" method="post">
  723. {{.CsrfTokenHtml}}
  724. <input type="hidden" name="action" value="cancel_transfer">
  725. <button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_abort"}}</button>
  726. </form>
  727. {{else}}
  728. <button class="ui basic red show-modal button" data-modal="#transfer-repo-modal">{{ctx.Locale.Tr "repo.settings.transfer"}}</button>
  729. {{end}}
  730. </div>
  731. </div>
  732. {{if .Permission.CanRead $.UnitTypeWiki}}
  733. <div class="flex-item">
  734. <div class="flex-item-main">
  735. <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</div>
  736. <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.wiki_delete_desc"}}</div>
  737. </div>
  738. <div class="flex-item-trailing">
  739. <button class="ui basic red show-modal button" data-modal="#delete-wiki-modal">{{ctx.Locale.Tr "repo.settings.wiki_delete"}}</button>
  740. </div>
  741. </div>
  742. {{end}}
  743. <div class="flex-item">
  744. <div class="flex-item-main">
  745. <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.delete"}}</div>
  746. <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.delete_desc"}}</div>
  747. </div>
  748. <div class="flex-item-trailing">
  749. <button class="ui basic red show-modal button" data-modal="#delete-repo-modal">{{ctx.Locale.Tr "repo.settings.delete"}}</button>
  750. </div>
  751. </div>
  752. {{if not .Repository.IsMirror}}
  753. <div class="flex-item gt-ac">
  754. <div class="flex-item-main">
  755. {{if .Repository.IsArchived}}
  756. <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.unarchive.header"}}</div>
  757. <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.unarchive.text"}}</div>
  758. {{else}}
  759. <div class="flex-item-title">{{ctx.Locale.Tr "repo.settings.archive.header"}}</div>
  760. <div class="flex-item-body">{{ctx.Locale.Tr "repo.settings.archive.text"}}</div>
  761. {{end}}
  762. </div>
  763. <div class="flex-item-trailing">
  764. <button class="ui basic red show-modal button" data-modal="#archive-repo-modal">
  765. {{if .Repository.IsArchived}}
  766. {{ctx.Locale.Tr "repo.settings.unarchive.button"}}
  767. {{else}}
  768. {{ctx.Locale.Tr "repo.settings.archive.button"}}
  769. {{end}}
  770. </button>
  771. </div>
  772. </div>
  773. {{end}}
  774. </div>
  775. </div>
  776. {{end}}
  777. </div>
  778. {{template "repo/settings/layout_footer" .}}
  779. {{if .Permission.IsOwner}}
  780. {{if .Repository.IsMirror}}
  781. <div class="ui small modal" id="convert-mirror-repo-modal">
  782. <div class="header">
  783. {{ctx.Locale.Tr "repo.settings.convert"}}
  784. </div>
  785. <div class="content">
  786. <div class="ui warning message">
  787. {{ctx.Locale.Tr "repo.settings.convert_notices_1"}}
  788. </div>
  789. <form class="ui form" action="{{.Link}}" method="post">
  790. {{.CsrfTokenHtml}}
  791. <input type="hidden" name="action" value="convert">
  792. <div class="field">
  793. <label>
  794. {{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
  795. <span class="text red">{{.Repository.Name}}</span>
  796. </label>
  797. </div>
  798. <div class="required field">
  799. <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label>
  800. <input id="repo_name" name="repo_name" required maxlength="100">
  801. </div>
  802. <div class="text right actions">
  803. <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  804. <button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_confirm"}}</button>
  805. </div>
  806. </form>
  807. </div>
  808. </div>
  809. {{end}}
  810. {{if and .Repository.IsFork .Repository.Owner.CanCreateRepo}}
  811. <div class="ui small modal" id="convert-fork-repo-modal">
  812. <div class="header">
  813. {{ctx.Locale.Tr "repo.settings.convert_fork"}}
  814. </div>
  815. <div class="content">
  816. <div class="ui warning message">
  817. {{ctx.Locale.Tr "repo.settings.convert_fork_notices_1"}}
  818. </div>
  819. <form class="ui form" action="{{.Link}}" method="post">
  820. {{.CsrfTokenHtml}}
  821. <input type="hidden" name="action" value="convert_fork">
  822. <div class="field">
  823. <label>
  824. {{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
  825. <span class="text red">{{.Repository.Name}}</span>
  826. </label>
  827. </div>
  828. <div class="required field">
  829. <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label>
  830. <input id="repo_name" name="repo_name" required>
  831. </div>
  832. <div class="text right actions">
  833. <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  834. <button class="ui red button">{{ctx.Locale.Tr "repo.settings.convert_fork_confirm"}}</button>
  835. </div>
  836. </form>
  837. </div>
  838. </div>
  839. {{end}}
  840. <div class="ui small modal" id="transfer-repo-modal">
  841. <div class="header">
  842. {{ctx.Locale.Tr "repo.settings.transfer"}}
  843. </div>
  844. <div class="content">
  845. <div class="ui warning message">
  846. {{ctx.Locale.Tr "repo.settings.transfer_notices_1"}} <br>
  847. {{ctx.Locale.Tr "repo.settings.transfer_notices_2"}} <br>
  848. {{ctx.Locale.Tr "repo.settings.transfer_notices_3"}}
  849. </div>
  850. <form class="ui form" action="{{.Link}}" method="post">
  851. {{.CsrfTokenHtml}}
  852. <input type="hidden" name="action" value="transfer">
  853. <div class="field">
  854. <label>
  855. {{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
  856. <span class="text red">{{.Repository.Name}}</span>
  857. </label>
  858. </div>
  859. <div class="required field">
  860. <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label>
  861. <input id="repo_name" name="repo_name" required>
  862. </div>
  863. <div class="required field">
  864. <label for="new_owner_name">{{ctx.Locale.Tr "repo.settings.transfer_owner"}}</label>
  865. <input id="new_owner_name" name="new_owner_name" required>
  866. </div>
  867. <div class="text right actions">
  868. <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  869. <button class="ui red button">{{ctx.Locale.Tr "repo.settings.transfer_perform"}}</button>
  870. </div>
  871. </form>
  872. </div>
  873. </div>
  874. <div class="ui small modal" id="delete-repo-modal">
  875. <div class="header">
  876. {{ctx.Locale.Tr "repo.settings.delete"}}
  877. </div>
  878. <div class="content">
  879. <div class="ui warning message">
  880. {{ctx.Locale.Tr "repo.settings.delete_notices_1" | Safe}}<br>
  881. {{ctx.Locale.Tr "repo.settings.delete_notices_2" .Repository.FullName | Safe}}
  882. {{if .Repository.NumForks}}<br>
  883. {{ctx.Locale.Tr "repo.settings.delete_notices_fork_1"}}
  884. {{end}}
  885. </div>
  886. <form class="ui form" action="{{.Link}}" method="post">
  887. {{.CsrfTokenHtml}}
  888. <input type="hidden" name="action" value="delete">
  889. <div class="field">
  890. <label>
  891. {{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
  892. <span class="text red">{{.Repository.Name}}</span>
  893. </label>
  894. </div>
  895. <div class="required field">
  896. <label for="repo_name_to_delete">{{ctx.Locale.Tr "repo.repo_name"}}</label>
  897. <input id="repo_name_to_delete" name="repo_name" required>
  898. </div>
  899. <div class="text right actions">
  900. <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  901. <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_delete"}}</button>
  902. </div>
  903. </form>
  904. </div>
  905. </div>
  906. {{if .Repository.UnitEnabled $.Context $.UnitTypeWiki}}
  907. <div class="ui small modal" id="delete-wiki-modal">
  908. <div class="header">
  909. {{ctx.Locale.Tr "repo.settings.wiki_delete"}}
  910. </div>
  911. <div class="content">
  912. <div class="ui warning message">
  913. {{ctx.Locale.Tr "repo.settings.delete_notices_1" | Safe}}<br>
  914. {{ctx.Locale.Tr "repo.settings.wiki_delete_notices_1" .Repository.Name | Safe}}
  915. </div>
  916. <form class="ui form" action="{{.Link}}" method="post">
  917. {{.CsrfTokenHtml}}
  918. <input type="hidden" name="action" value="delete-wiki">
  919. <div class="field">
  920. <label>
  921. {{ctx.Locale.Tr "repo.settings.transfer_form_title"}}
  922. <span class="text red">{{.Repository.Name}}</span>
  923. </label>
  924. </div>
  925. <div class="required field">
  926. <label for="repo_name">{{ctx.Locale.Tr "repo.repo_name"}}</label>
  927. <input id="repo_name" name="repo_name" required>
  928. </div>
  929. <div class="text right actions">
  930. <button class="ui cancel button">{{ctx.Locale.Tr "settings.cancel"}}</button>
  931. <button class="ui red button">{{ctx.Locale.Tr "repo.settings.confirm_wiki_delete"}}</button>
  932. </div>
  933. </form>
  934. </div>
  935. </div>
  936. {{end}}
  937. {{if not .Repository.IsMirror}}
  938. <div class="ui g-modal-confirm modal" id="archive-repo-modal">
  939. <div class="header">
  940. {{if .Repository.IsArchived}}
  941. {{ctx.Locale.Tr "repo.settings.unarchive.header"}}
  942. {{else}}
  943. {{ctx.Locale.Tr "repo.settings.archive.header"}}
  944. {{end}}
  945. </div>
  946. <div class="content">
  947. <p>
  948. {{if .Repository.IsArchived}}
  949. {{ctx.Locale.Tr "repo.settings.unarchive.text"}}
  950. {{else}}
  951. {{ctx.Locale.Tr "repo.settings.archive.text"}}
  952. {{end}}
  953. </p>
  954. </div>
  955. <form action="{{.Link}}" method="post">
  956. {{.CsrfTokenHtml}}
  957. <input type="hidden" name="action" value="{{if .Repository.IsArchived}}unarchive{{else}}archive{{end}}">
  958. <input type="hidden" name="repo_id" value="{{.Repository.ID}}">
  959. {{template "base/modal_actions_confirm" .}}
  960. </form>
  961. </div>
  962. {{end}}
  963. {{end}}
  964. {{template "repo/settings/push_mirror_sync_modal" .}}