本站源代码
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

198 Zeilen
8.0KB

  1. {{template "base/head" .}}
  2. <div class="repository settings branches">
  3. {{template "repo/header" .}}
  4. {{template "repo/settings/navbar" .}}
  5. <div class="ui container">
  6. {{template "base/alert" .}}
  7. <h4 class="ui top attached header">
  8. {{.i18n.Tr "repo.settings.branch_protection" .Branch.BranchName | Str2html}}
  9. </h4>
  10. <div class="ui attached segment branch-protection">
  11. <form class="ui form" action="{{.Link}}" method="post">
  12. {{.CsrfTokenHtml}}
  13. <div class="inline field">
  14. <div class="ui checkbox">
  15. <input class="enable-protection" name="protected" type="checkbox" data-target="#protection_box" {{if .Branch.IsProtected}}checked{{end}}>
  16. <label>{{.i18n.Tr "repo.settings.protect_this_branch"}}</label>
  17. <p class="help">{{.i18n.Tr "repo.settings.protect_this_branch_desc"}}</p>
  18. </div>
  19. </div>
  20. <div id="protection_box" class="fields {{if not .Branch.IsProtected}}disabled{{end}}">
  21. <div class="field">
  22. <div class="ui checkbox">
  23. <input class="enable-whitelist" name="enable_whitelist" type="checkbox" data-target="#whitelist_box" {{if .Branch.EnableWhitelist}}checked{{end}}>
  24. <label>{{.i18n.Tr "repo.settings.protect_whitelist_committers"}}</label>
  25. <p class="help">{{.i18n.Tr "repo.settings.protect_whitelist_committers_desc"}}</p>
  26. </div>
  27. </div>
  28. <div id="whitelist_box" class="fields {{if not .Branch.EnableWhitelist}}disabled{{end}}">
  29. <div class="whitelist field">
  30. <label>{{.i18n.Tr "repo.settings.protect_whitelist_users"}}</label>
  31. <div class="ui multiple search selection dropdown">
  32. <input type="hidden" name="whitelist_users" value="{{.whitelist_users}}">
  33. <div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_users"}}</div>
  34. <div class="menu">
  35. {{range .Users}}
  36. <div class="item" data-value="{{.ID}}">
  37. <img class="ui mini image" src="{{.RelAvatarLink}}">
  38. {{.Name}}
  39. </div>
  40. {{end}}
  41. </div>
  42. </div>
  43. </div>
  44. {{if .Owner.IsOrganization}}
  45. <br>
  46. <div class="whitelist field">
  47. <label>{{.i18n.Tr "repo.settings.protect_whitelist_teams"}}</label>
  48. <div class="ui multiple search selection dropdown">
  49. <input type="hidden" name="whitelist_teams" value="{{.whitelist_teams}}">
  50. <div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
  51. <div class="menu">
  52. {{range .Teams}}
  53. <div class="item" data-value="{{.ID}}">
  54. <i class="octicon octicon-jersey"></i>
  55. {{.Name}}
  56. </div>
  57. {{end}}
  58. </div>
  59. </div>
  60. </div>
  61. {{end}}
  62. <br>
  63. <div class="whitelist field">
  64. <div class="ui checkbox">
  65. <input type="checkbox" name="whitelist_deploy_keys" {{if .Branch.WhitelistDeployKeys}}checked{{end}}>
  66. <label for="whitelist_deploy_keys">{{.i18n.Tr "repo.settings.protect_whitelist_deploy_keys"}}</label>
  67. </div>
  68. </div>
  69. </div>
  70. <div class="field">
  71. <div class="ui checkbox">
  72. <input class="enable-whitelist" name="enable_merge_whitelist" type="checkbox" data-target="#merge_whitelist_box" {{if .Branch.EnableMergeWhitelist}}checked{{end}}>
  73. <label>{{.i18n.Tr "repo.settings.protect_merge_whitelist_committers"}}</label>
  74. <p class="help">{{.i18n.Tr "repo.settings.protect_merge_whitelist_committers_desc"}}</p>
  75. </div>
  76. </div>
  77. <div id="merge_whitelist_box" class="fields {{if not .Branch.EnableMergeWhitelist}}disabled{{end}}">
  78. <div class="whitelist field">
  79. <label>{{.i18n.Tr "repo.settings.protect_merge_whitelist_users"}}</label>
  80. <div class="ui multiple search selection dropdown">
  81. <input type="hidden" name="merge_whitelist_users" value="{{.merge_whitelist_users}}">
  82. <div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_users"}}</div>
  83. <div class="menu">
  84. {{range .Users}}
  85. <div class="item" data-value="{{.ID}}">
  86. <img class="ui mini image" src="{{.RelAvatarLink}}">
  87. {{.Name}}
  88. </div>
  89. {{end}}
  90. </div>
  91. </div>
  92. </div>
  93. {{if .Owner.IsOrganization}}
  94. <br>
  95. <div class="whitelist field">
  96. <label>{{.i18n.Tr "repo.settings.protect_merge_whitelist_teams"}}</label>
  97. <div class="ui multiple search selection dropdown">
  98. <input type="hidden" name="merge_whitelist_teams" value="{{.merge_whitelist_teams}}">
  99. <div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
  100. <div class="menu">
  101. {{range .Teams}}
  102. <div class="item" data-value="{{.ID}}">
  103. <i class="octicon octicon-jersey"></i>
  104. {{.Name}}
  105. </div>
  106. {{end}}
  107. </div>
  108. </div>
  109. </div>
  110. {{end}}
  111. </div>
  112. <div class="field">
  113. <div class="ui checkbox">
  114. <input class="enable-statuscheck" name="enable_status_check" type="checkbox" data-target="#statuscheck_contexts_box" {{if .Branch.EnableStatusCheck}}checked{{end}}>
  115. <label>{{.i18n.Tr "repo.settings.protect_check_status_contexts"}}</label>
  116. <p class="help">{{.i18n.Tr "repo.settings.protect_check_status_contexts_desc"}}</p>
  117. </div>
  118. </div>
  119. <div id="statuscheck_contexts_box" class="fields {{if not .Branch.EnableStatusCheck}}disabled{{end}}">
  120. <div class="field">
  121. <table class="ui celled table six column">
  122. <thead>
  123. <tr><th>
  124. {{.i18n.Tr "repo.settings.protect_check_status_contexts_list"}}
  125. </th>
  126. </tr>
  127. </thead>
  128. <tbody>
  129. {{range $.branch_status_check_contexts}}
  130. <tr><td>
  131. <span class="ui checkbox">
  132. <input class="enable-whitelist" name="status_check_contexts" value="{{.}}" type="checkbox" {{if $.is_context_require}}{{if call $.is_context_required .}}checked{{end}}{{end}}>
  133. </span>
  134. {{.}}
  135. {{if $.is_context_required}}{{if call $.is_context_required .}}<div class="ui label right">Required</div>{{end}}{{end}}
  136. </td></tr>
  137. {{end}}
  138. </tbody>
  139. </table>
  140. </div>
  141. </div>
  142. <div class="field">
  143. <label for="required-approvals">{{.i18n.Tr "repo.settings.protect_required_approvals"}}</label>
  144. <input name="required_approvals" id="required-approvals" type="number" value="{{.Branch.RequiredApprovals}}">
  145. <p class="help">{{.i18n.Tr "repo.settings.protect_required_approvals_desc"}}</p>
  146. </div>
  147. <div class="fields">
  148. <div class="whitelist field">
  149. <label>{{.i18n.Tr "repo.settings.protect_approvals_whitelist_users"}}</label>
  150. <div class="ui multiple search selection dropdown">
  151. <input type="hidden" name="approvals_whitelist_users" value="{{.approvals_whitelist_users}}">
  152. <div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_users"}}</div>
  153. <div class="menu">
  154. {{range .Users}}
  155. <div class="item" data-value="{{.ID}}">
  156. <img class="ui mini image" src="{{.RelAvatarLink}}">
  157. {{.Name}}
  158. </div>
  159. {{end}}
  160. </div>
  161. </div>
  162. </div>
  163. {{if .Owner.IsOrganization}}
  164. <br>
  165. <div class="whitelist field">
  166. <label>{{.i18n.Tr "repo.settings.protect_approvals_whitelist_teams"}}</label>
  167. <div class="ui multiple search selection dropdown">
  168. <input type="hidden" name="approvals_whitelist_teams" value="{{.approvals_whitelist_teams}}">
  169. <div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
  170. <div class="menu">
  171. {{range .Teams}}
  172. <div class="item" data-value="{{.ID}}">
  173. <i class="octicon octicon-jersey"></i>
  174. {{.Name}}
  175. </div>
  176. {{end}}
  177. </div>
  178. </div>
  179. </div>
  180. {{end}}
  181. </div>
  182. </div>
  183. <div class="ui divider"></div>
  184. <div class="field">
  185. <button class="ui green button">{{$.i18n.Tr "repo.settings.update_settings"}}</button>
  186. </div>
  187. </form>
  188. </div>
  189. </div>
  190. </div>
  191. {{template "base/footer" .}}
上海开阖软件有限公司 沪ICP备12045867号-1