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.

409 lines
17 KiB

  1. {{template "base/head" .}}
  2. <div class="repository settings options">
  3. {{template "repo/header" .}}
  4. <div class="ui container">
  5. <div class="ui grid">
  6. {{template "repo/settings/navbar" .}}
  7. <div class="twelve wide column content">
  8. {{template "base/alert" .}}
  9. <h4 class="ui top attached header">
  10. {{.i18n.Tr "repo.settings.basic_settings"}}
  11. </h4>
  12. <div class="ui attached segment">
  13. <form class="ui form" action="{{.Link}}" method="post">
  14. {{.CsrfTokenHtml}}
  15. <input type="hidden" name="action" value="update">
  16. <div class="required field {{if .Err_RepoName}}error{{end}}">
  17. <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}<span class="text red hide" id="repo-name-change-prompt"> {{.i18n.Tr "repo.settings.change_reponame_prompt"}}</span></label>
  18. <input id="repo_name" name="repo_name" value="{{.Repository.Name}}" data-repo-name="{{.Repository.Name}}" autofocus required>
  19. </div>
  20. <div class="field {{if .Err_Description}}error{{end}}">
  21. <label for="description">{{$.i18n.Tr "repo.repo_desc"}}</label>
  22. <textarea id="description" name="description" rows="2">{{.Repository.Description}}</textarea>
  23. </div>
  24. <div class="field {{if .Err_Website}}error{{end}}">
  25. <label for="website">{{.i18n.Tr "repo.settings.site"}}</label>
  26. <input id="website" name="website" type="url" value="{{.Repository.Website}}">
  27. </div>
  28. {{if not .Repository.IsBare}}
  29. <div class="required inline field">
  30. <label>{{.i18n.Tr "repo.default_branch"}}</label>
  31. <div class="ui selection dropdown">
  32. <input type="hidden" id="branch" name="branch" value="{{.Repository.DefaultBranch}}">
  33. <div class="text">{{.Repository.DefaultBranch}}</div>
  34. <i class="dropdown icon"></i>
  35. <div class="menu">
  36. {{range .Branches}}
  37. <div class="item" data-value="{{.}}">{{.}}</div>
  38. {{end}}
  39. </div>
  40. </div>
  41. </div>
  42. {{end}}
  43. {{if not .Repository.IsFork}}
  44. <div class="inline field">
  45. <label>{{.i18n.Tr "repo.visibility"}}</label>
  46. <div class="ui checkbox">
  47. <input name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}}>
  48. <label>{{.i18n.Tr "repo.visiblity_helper" | Safe}} {{if .Repository.NumForks}}<span class="text red">{{.i18n.Tr "repo.visiblity_fork_helper"}}</span>{{end}}</label>
  49. </div>
  50. </div>
  51. {{end}}
  52. <div class="field">
  53. <button class="ui green button">{{$.i18n.Tr "repo.settings.update_settings"}}</button>
  54. </div>
  55. </form>
  56. </div>
  57. {{if .Repository.IsMirror}}
  58. <h4 class="ui top attached header">
  59. {{.i18n.Tr "repo.settings.mirror_settings"}}
  60. </h4>
  61. <div class="ui attached segment">
  62. <form class="ui form" method="post">
  63. {{.CsrfTokenHtml}}
  64. <input type="hidden" name="action" value="mirror">
  65. <div class="inline field {{if .Err_EnablePrune}}error{{end}}">
  66. <label>{{.i18n.Tr "repo.mirror_prune"}}</label>
  67. <div class="ui checkbox">
  68. <input id="enable_prune" name="enable_prune" type="checkbox" {{if .MirrorEnablePrune}}checked{{end}}>
  69. <label>{{.i18n.Tr "repo.mirror_prune_desc"}}</label>
  70. </div>
  71. </div>
  72. <div class="inline field {{if .Err_Interval}}error{{end}}">
  73. <label for="interval">{{.i18n.Tr "repo.mirror_interval"}}</label>
  74. <input id="interval" name="interval" type="number" value="{{.MirrorInterval}}">
  75. </div>
  76. <div class="field">
  77. <label for="mirror_address">{{.i18n.Tr "repo.mirror_address"}}</label>
  78. <input id="mirror_address" name="mirror_address" value="{{.Mirror.FullAddress}}" required>
  79. <p class="help">{{.i18n.Tr "repo.mirror_address_desc"}}</p>
  80. </div>
  81. <div class="field">
  82. <button class="ui green button">{{$.i18n.Tr "repo.settings.update_settings"}}</button>
  83. </div>
  84. </form>
  85. <div class="ui divider"></div>
  86. <form class="ui form" method="post">
  87. {{.CsrfTokenHtml}}
  88. <input type="hidden" name="action" value="mirror-sync">
  89. <div class="inline field">
  90. <label>{{.i18n.Tr "repo.mirror_last_synced"}}</label>
  91. <span>{{.Mirror.Updated}}</span>
  92. </div>
  93. <div class="field">
  94. <button class="ui blue button">{{$.i18n.Tr "repo.settings.sync_mirror"}}</button>
  95. </div>
  96. </form>
  97. </div>
  98. {{end}}
  99. <h4 class="ui top attached header">
  100. {{.i18n.Tr "repo.settings.advanced_settings"}}
  101. </h4>
  102. <div class="ui attached segment">
  103. <form class="ui form" method="post">
  104. {{.CsrfTokenHtml}}
  105. <input type="hidden" name="action" value="advanced">
  106. <div class="inline field">
  107. <label>{{.i18n.Tr "repo.wiki"}}</label>
  108. <div class="ui checkbox">
  109. <input class="enable-system" name="enable_wiki" type="checkbox" data-target="#wiki_box" {{if or (.Repository.EnableUnit $.UnitTypeWiki) (.Repository.EnableUnit $.UnitTypeExternalWiki)}}checked{{end}}>
  110. <label>{{.i18n.Tr "repo.settings.wiki_desc"}}</label>
  111. </div>
  112. </div>
  113. <div class="field {{if not (.Repository.EnableUnit $.UnitTypeWiki)}}disabled{{end}}" id="wiki_box">
  114. <div class="field">
  115. <div class="ui radio checkbox">
  116. <input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="false" data-target="#external_wiki_box" {{if not (.Repository.EnableUnit $.UnitTypeExternalWiki)}}checked{{end}}/>
  117. <label>{{.i18n.Tr "repo.settings.use_internal_wiki"}}</label>
  118. </div>
  119. </div>
  120. <div class="field">
  121. <div class="ui radio checkbox">
  122. <input class="hidden enable-system-radio" tabindex="0" name="enable_external_wiki" type="radio" value="true" data-target="#external_wiki_box" {{if .Repository.EnableUnit $.UnitTypeExternalWiki}}checked{{end}}/>
  123. <label>{{.i18n.Tr "repo.settings.use_external_wiki"}}</label>
  124. </div>
  125. </div>
  126. <div class="field {{if not (.Repository.EnableUnit $.UnitTypeExternalWiki)}}disabled{{end}}" id="external_wiki_box">
  127. <label for="external_wiki_url">{{.i18n.Tr "repo.settings.external_wiki_url"}}</label>
  128. <input id="external_wiki_url" name="external_wiki_url" type="url" value="{{(.Repository.MustGetUnit $.UnitTypeExternalWiki).ExternalWikiConfig.ExternalWikiURL}}">
  129. <p class="help">{{.i18n.Tr "repo.settings.external_wiki_url_desc"}}</p>
  130. </div>
  131. </div>
  132. <div class="ui divider"></div>
  133. <div class="inline field">
  134. <label>{{.i18n.Tr "repo.issues"}}</label>
  135. <div class="ui checkbox">
  136. <input class="enable-system" name="enable_issues" type="checkbox" data-target="#issue_box" {{if or (.Repository.EnableUnit $.UnitTypeIssues) (.Repository.EnableUnit $.UnitTypeExternalTracker)}}checked{{end}}>
  137. <label>{{.i18n.Tr "repo.settings.issues_desc"}}</label>
  138. </div>
  139. </div>
  140. <div class="field {{if not (.Repository.EnableUnit $.UnitTypeIssues)}}disabled{{end}}" id="issue_box">
  141. <div class="field">
  142. <div class="ui radio checkbox">
  143. <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="false" data-target="#external_issue_box" {{if not (.Repository.EnableUnit $.UnitTypeExternalTracker)}}checked{{end}}/>
  144. <label>{{.i18n.Tr "repo.settings.use_internal_issue_tracker"}}</label>
  145. </div>
  146. </div>
  147. <div class="field">
  148. <div class="ui radio checkbox">
  149. <input class="hidden enable-system-radio" tabindex="0" name="enable_external_tracker" type="radio" value="true" data-target="#external_issue_box" {{if .Repository.EnableUnit $.UnitTypeExternalTracker}}checked{{end}}/>
  150. <label>{{.i18n.Tr "repo.settings.use_external_issue_tracker"}}</label>
  151. </div>
  152. </div>
  153. <div class="field {{if not (.Repository.EnableUnit $.UnitTypeExternalTracker)}}disabled{{end}}" id="external_issue_box">
  154. <div class="field">
  155. <label for="external_tracker_url">{{.i18n.Tr "repo.settings.external_tracker_url"}}</label>
  156. <input id="external_tracker_url" name="external_tracker_url" type="url" value="{{(.Repository.MustGetUnit $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerURL}}">
  157. <p class="help">{{.i18n.Tr "repo.settings.external_tracker_url_desc"}}</p>
  158. </div>
  159. <div class="field">
  160. <label for="tracker_url_format">{{.i18n.Tr "repo.settings.tracker_url_format"}}</label>
  161. <input id="tracker_url_format" name="tracker_url_format" type="url" value="{{(.Repository.MustGetUnit $.UnitTypeExternalTracker).ExternalTrackerConfig.ExternalTrackerFormat}}" placeholder="e.g. https://github.com/{user}/{repo}/issues/{index}">
  162. <p class="help">{{.i18n.Tr "repo.settings.tracker_url_format_desc" | Str2html}}</p>
  163. </div>
  164. <div class="inline fields">
  165. <label for="issue_style">{{.i18n.Tr "repo.settings.tracker_issue_style"}}</label>
  166. <div class="field">
  167. <div class="ui radio checkbox">
  168. {{$externalTracker := (.Repository.MustGetUnit $.UnitTypeExternalTracker)}}
  169. {{$externalTrackerStyle := $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle}}
  170. <input class="hidden" tabindex="0" name="tracker_issue_style" type="radio" value="numeric" {{if $externalTrackerStyle}}{{if eq $externalTrackerStyle "numeric"}}checked=""{{end}}{{end}}/>
  171. <label>{{.i18n.Tr "repo.settings.tracker_issue_style.numeric"}} <span class="ui light grey text">(#1234)</span></label>
  172. </div>
  173. </div>
  174. <div class="field">
  175. <div class="ui radio checkbox">
  176. <input class="hidden" tabindex="0" name="tracker_issue_style" type="radio" value="alphanumeric" {{if $externalTrackerStyle}}{{if eq $externalTracker.ExternalTrackerConfig.ExternalTrackerStyle "alphanumeric"}}checked=""{{end}}{{end}} />
  177. <label>{{.i18n.Tr "repo.settings.tracker_issue_style.alphanumeric"}} <span class="ui light grey text">(ABC-123, DEFG-234)</span></label>
  178. </div>
  179. </div>
  180. </div>
  181. </div>
  182. </div>
  183. {{if .Repository.CanEnablePulls}}
  184. <div class="ui divider"></div>
  185. <div class="inline field">
  186. <label>{{.i18n.Tr "repo.pulls"}}</label>
  187. <div class="ui checkbox">
  188. <input name="enable_pulls" type="checkbox" {{if .Repository.EnableUnit $.UnitTypePullRequests}}checked{{end}}>
  189. <label>{{.i18n.Tr "repo.settings.pulls_desc"}}</label>
  190. </div>
  191. </div>
  192. {{end}}
  193. <div class="ui divider"></div>
  194. <div class="field">
  195. <button class="ui green button">{{$.i18n.Tr "repo.settings.update_settings"}}</button>
  196. </div>
  197. </form>
  198. </div>
  199. {{if .IsRepositoryOwner}}
  200. <h4 class="ui top attached warning header">
  201. {{.i18n.Tr "repo.settings.danger_zone"}}
  202. </h4>
  203. <div class="ui attached warning table danger segment">
  204. {{if .Repository.IsMirror}}
  205. <div class="item">
  206. <div class="ui right">
  207. <button class="ui basic red show-modal button" data-modal="#convert-repo-modal">{{.i18n.Tr "repo.settings.convert"}}</button>
  208. </div>
  209. <div>
  210. <h5>{{.i18n.Tr "repo.settings.convert"}}</h5>
  211. <p>{{.i18n.Tr "repo.settings.convert_desc"}}</p>
  212. </div>
  213. </div>
  214. <div class="ui divider"></div>
  215. {{end}}
  216. <div class="item">
  217. <div class="ui right">
  218. <button class="ui basic red show-modal button" data-modal="#transfer-repo-modal">{{.i18n.Tr "repo.settings.transfer"}}</button>
  219. </div>
  220. <div>
  221. <h5>{{.i18n.Tr "repo.settings.transfer"}}</h5>
  222. <p>{{.i18n.Tr "repo.settings.transfer_desc"}}</p>
  223. </div>
  224. </div>
  225. {{if .Repository.EnableUnit $.UnitTypeWiki}}
  226. <div class="ui divider"></div>
  227. <div class="item">
  228. <div class="ui right">
  229. <button class="ui basic red show-modal button" data-modal="#delete-wiki-modal">{{.i18n.Tr "repo.settings.wiki_delete"}}</button>
  230. </div>
  231. <div>
  232. <h5>{{.i18n.Tr "repo.settings.wiki_delete"}}</h5>
  233. <p>{{.i18n.Tr "repo.settings.wiki_delete_desc"}}</p>
  234. </div>
  235. </div>
  236. {{end}}
  237. <div class="ui divider"></div>
  238. <div class="item">
  239. <div class="ui right">
  240. <button class="ui basic red show-modal button" data-modal="#delete-repo-modal">{{.i18n.Tr "repo.settings.delete"}}</button>
  241. </div>
  242. <div>
  243. <h5>{{.i18n.Tr "repo.settings.delete"}}</h5>
  244. <p>{{.i18n.Tr "repo.settings.delete_desc"}}</p>
  245. </div>
  246. </div>
  247. </div>
  248. {{end}}
  249. </div>
  250. </div>
  251. </div>
  252. </div>
  253. {{if .IsRepositoryOwner}}
  254. {{if .Repository.IsMirror}}
  255. <div class="ui small modal" id="convert-repo-modal">
  256. <div class="header">
  257. {{.i18n.Tr "repo.settings.convert"}}
  258. </div>
  259. <div class="content">
  260. <div class="ui warning message text left">
  261. {{.i18n.Tr "repo.settings.convert_notices_1" | Safe}}
  262. </div>
  263. <form class="ui form" action="{{.Link}}" method="post">
  264. {{.CsrfTokenHtml}}
  265. <input type="hidden" name="action" value="convert">
  266. <div class="field">
  267. <label>
  268. {{.i18n.Tr "repo.settings.transfer_form_title"}}
  269. <span class="text red">{{.Repository.Name}}</span>
  270. </label>
  271. </div>
  272. <div class="required field">
  273. <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
  274. <input id="repo_name" name="repo_name" required>
  275. </div>
  276. <div class="text right actions">
  277. <div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
  278. <button class="ui red button">{{.i18n.Tr "repo.settings.convert_confirm"}}</button>
  279. </div>
  280. </form>
  281. </div>
  282. </div>
  283. {{end}}
  284. <div class="ui small modal" id="transfer-repo-modal">
  285. <div class="header">
  286. {{.i18n.Tr "repo.settings.transfer"}}
  287. </div>
  288. <div class="content">
  289. <div class="ui warning message text left">
  290. {{.i18n.Tr "repo.settings.transfer_notices_1" | Safe}} <br>
  291. {{.i18n.Tr "repo.settings.transfer_notices_2" | Safe}}
  292. </div>
  293. <form class="ui form" action="{{.Link}}" method="post">
  294. {{.CsrfTokenHtml}}
  295. <input type="hidden" name="action" value="transfer">
  296. <div class="field">
  297. <label>
  298. {{.i18n.Tr "repo.settings.transfer_form_title"}}
  299. <span class="text red">{{.Repository.Name}}</span>
  300. </label>
  301. </div>
  302. <div class="required field">
  303. <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
  304. <input id="repo_name" name="repo_name" required>
  305. </div>
  306. <div class="required field">
  307. <label for="new_owner_name">{{.i18n.Tr "repo.settings.transfer_owner"}}</label>
  308. <input id="new_owner_name" name="new_owner_name" required>
  309. </div>
  310. <div class="text right actions">
  311. <div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
  312. <button class="ui red button">{{.i18n.Tr "repo.settings.make_transfer"}}</button>
  313. </div>
  314. </form>
  315. </div>
  316. </div>
  317. <div class="ui small modal" id="delete-repo-modal">
  318. <div class="header">
  319. {{.i18n.Tr "repo.settings.delete"}}
  320. </div>
  321. <div class="content">
  322. <div class="ui warning message text left">
  323. {{.i18n.Tr "repo.settings.delete_notices_1" | Safe}}<br>
  324. {{.i18n.Tr "repo.settings.delete_notices_2" | Safe}}
  325. {{if .Repository.NumForks}}<br>
  326. {{.i18n.Tr "repo.settings.delete_notices_fork_1" | Safe}}
  327. {{end}}
  328. </div>
  329. <form class="ui form" action="{{.Link}}" method="post">
  330. {{.CsrfTokenHtml}}
  331. <input type="hidden" name="action" value="delete">
  332. <div class="field">
  333. <label>
  334. {{.i18n.Tr "repo.settings.transfer_form_title"}}
  335. <span class="text red">{{.Repository.Name}}</span>
  336. </label>
  337. </div>
  338. <div class="required field">
  339. <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
  340. <input id="repo_name" name="repo_name" required>
  341. </div>
  342. <div class="text right actions">
  343. <div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
  344. <button class="ui red button">{{.i18n.Tr "repo.settings.confirm_delete"}}</button>
  345. </div>
  346. </form>
  347. </div>
  348. </div>
  349. {{if .Repository.EnableUnit $.UnitTypeWiki}}
  350. <div class="ui small modal" id="delete-wiki-modal">
  351. <div class="header">
  352. {{.i18n.Tr "repo.settings.wiki-delete"}}
  353. </div>
  354. <div class="content">
  355. <div class="ui warning message text left">
  356. {{.i18n.Tr "repo.settings.delete_notices_1" | Safe}}<br>
  357. {{.i18n.Tr "repo.settings.wiki_delete_notices_1" .Repository.Name | Safe}}
  358. </div>
  359. <form class="ui form" action="{{.Link}}" method="post">
  360. {{.CsrfTokenHtml}}
  361. <input type="hidden" name="action" value="delete-wiki">
  362. <div class="field">
  363. <label>
  364. {{.i18n.Tr "repo.settings.transfer_form_title"}}
  365. <span class="text red">{{.Repository.Name}}</span>
  366. </label>
  367. </div>
  368. <div class="required field">
  369. <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label>
  370. <input id="repo_name" name="repo_name" required>
  371. </div>
  372. <div class="text right actions">
  373. <div class="ui cancel button">{{.i18n.Tr "settings.cancel"}}</div>
  374. <button class="ui red button">{{.i18n.Tr "repo.settings.confirm_delete"}}</button>
  375. </div>
  376. </form>
  377. </div>
  378. </div>
  379. {{end}}
  380. {{end}}
  381. {{template "base/footer" .}}