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.

options.tmpl 56KB

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