protected_branch.tmpl 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. {{template "base/head" .}}
  2. <div class="repository settings branches">
  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.branch_protection"}}
  11. </h4>
  12. <div class="ui attached segment branch-protection">
  13. <p>{{.i18n.Tr "repo.settings.branch_protection_desc" .Branch.Name | Str2HTML}}</p>
  14. <form class="ui form" action="{{.Link}}" method="post">
  15. {{.CSRFTokenHTML}}
  16. <div class="inline field">
  17. <div class="ui checkbox">
  18. <input class="enable-protection" name="protected" type="checkbox" data-target="#protection_box" {{if .Branch.Protected}}checked{{end}}>
  19. <label>{{.i18n.Tr "repo.settings.protect_this_branch"}}</label>
  20. <p class="help">{{.i18n.Tr "repo.settings.protect_this_branch_desc"}}</p>
  21. </div>
  22. </div>
  23. <div id="protection_box" class="fields {{if not .Branch.Protected}}disabled{{end}}">
  24. <div class="field">
  25. <div class="ui checkbox">
  26. <input name="require_pull_request" type="checkbox" {{if .Branch.RequirePullRequest}}checked{{end}}>
  27. <label>{{.i18n.Tr "repo.settings.protect_require_pull_request"}}</label>
  28. <p class="help">{{.i18n.Tr "repo.settings.protect_require_pull_request_desc"}}</p>
  29. </div>
  30. </div>
  31. {{if .Owner.IsOrganization}}
  32. <div class="field">
  33. <div class="ui checkbox">
  34. <input class="enable-whitelist" name="enable_whitelist" type="checkbox" data-target="#whitelist_box" {{if .Branch.EnableWhitelist}}checked{{end}}>
  35. <label>{{.i18n.Tr "repo.settings.protect_whitelist_committers"}}</label>
  36. <p class="help">{{.i18n.Tr "repo.settings.protect_whitelist_committers_desc"}}</p>
  37. </div>
  38. </div>
  39. <div id="whitelist_box" class="field {{if not .Branch.EnableWhitelist}}disabled{{end}}">
  40. <div class="whitelist field">
  41. <label>{{.i18n.Tr "repo.settings.protect_whitelist_users"}}</label>
  42. <div class="ui multiple search selection dropdown">
  43. <input type="hidden" name="whitelist_users" value="{{.whitelist_users}}">
  44. <div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_users"}}</div>
  45. <div class="menu">
  46. {{range .Users}}
  47. <div class="item" data-value="{{.ID}}">
  48. <img class="ui mini image" src="{{.RelAvatarLink}}">
  49. {{.Name}}
  50. </div>
  51. {{end}}
  52. </div>
  53. </div>
  54. </div>
  55. <br>
  56. <div class="whitelist field">
  57. <label>{{.i18n.Tr "repo.settings.protect_whitelist_teams"}}</label>
  58. <div class="ui multiple search selection dropdown">
  59. <input type="hidden" name="whitelist_teams" value="{{.whitelist_teams}}">
  60. <div class="default text">{{.i18n.Tr "repo.settings.protect_whitelist_search_teams"}}</div>
  61. <div class="menu">
  62. {{range .Teams}}
  63. <div class="item" data-value="{{.ID}}">
  64. <i class="octicon octicon-jersey"></i>
  65. {{.Name}}
  66. </div>
  67. {{end}}
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. {{end}}
  73. </div>
  74. <div class="ui divider"></div>
  75. <div class="field">
  76. <button class="ui green button">{{$.i18n.Tr "repo.settings.update_settings"}}</button>
  77. </div>
  78. </form>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </div>
  84. {{template "base/footer" .}}