diff options
author | Samantha Ming <sming@gitlab.com> | 2019-09-13 12:30:47 -0700 |
---|---|---|
committer | Samantha Ming <sming@gitlab.com> | 2019-09-13 19:33:51 -0700 |
commit | 2b80d3d0a724fd81a18b3d57f7c29557413b2e8f (patch) | |
tree | 4e5dbbfef97a6ddbd8883bcb7f892c2fd2c3f4f8 | |
parent | cd1e0ca404429db12e134b91188abf487752c91a (diff) | |
download | gitlab-ce-13251-fe-require-approval-from-code-owners.tar.gz |
Move haml files to EE render partials13251-fe-require-approval-from-code-owners
- create partials for code owner form, table, & table headers
7 files changed, 29 insertions, 29 deletions
diff --git a/app/views/projects/protected_branches/shared/_branches_list.html.haml b/app/views/projects/protected_branches/shared/_branches_list.html.haml index f41e20e873d..47eac175c93 100644 --- a/app/views/projects/protected_branches/shared/_branches_list.html.haml +++ b/app/views/projects/protected_branches/shared/_branches_list.html.haml @@ -23,9 +23,9 @@ = s_("ProtectedBranch|Allowed to merge") %th = s_("ProtectedBranch|Allowed to push") - - if @project.merge_requests_require_code_owner_approval - %th - = s_("ProtectedBranch|Code owner approval") + + = render_if_exists 'shared/projects/code_owner_approval_table_head' + - if can_admin_project %th %tbody diff --git a/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml b/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml index b1d8d423e90..95b3e49f3c4 100644 --- a/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml +++ b/app/views/projects/protected_branches/shared/_create_protected_branch.html.haml @@ -24,19 +24,6 @@ = s_("ProtectedBranch|Allowed to push:") .col-md-10 = yield :push_access_levels - - - if @project.merge_requests_require_code_owner_approval - .form-group.row - %label.col-md-2.text-right{ for: 'code_owner_approval_required' } - = s_("ProtectedBranch|Require approval from code owners:") - .col-md-10 - %button{ type: 'button', - class: "js-project-feature-toggle project-feature-toggle is-checked", - "aria-label": s_("ProtectedBranch|Toggle code owner approval") } - %span.toggle-icon - = sprite_icon('status_success_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-checked') - = sprite_icon('status_failed_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-unchecked') - .form-text.text-muted - = s_("ProtectedBranch|Pushes that change filenames matched by the CODEOWNERS file will be rejected") + = render_if_exists 'shared/projects/code_owner_approval_form' .card-footer = f.submit s_('ProtectedBranch|Protect'), class: 'btn-success btn', disabled: true diff --git a/app/views/projects/protected_branches/shared/_protected_branch.html.haml b/app/views/projects/protected_branches/shared/_protected_branch.html.haml index 71c8d616eb9..53c16392357 100644 --- a/app/views/projects/protected_branches/shared/_protected_branch.html.haml +++ b/app/views/projects/protected_branches/shared/_protected_branch.html.haml @@ -19,14 +19,7 @@ = yield - - if @project.merge_requests_require_code_owner_approval - %td - %button{ type: 'button', - class: "js-project-feature-toggle project-feature-toggle mr-5 #{'is-checked' if protected_branch.code_owner_approval_required}", - "aria-label": s_("ProtectedBranch|Toggle code owner approval") } - %span.toggle-icon - = sprite_icon('status_success_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-checked') - = sprite_icon('status_failed_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-unchecked') + = render_if_exists 'shared/projects/code_owner_approval_table', protected_branch: protected_branch - if can_admin_project %td diff --git a/doc/user/project/protected_branches.md b/doc/user/project/protected_branches.md index ff47aea43d9..3d0486daa05 100644 --- a/doc/user/project/protected_branches.md +++ b/doc/user/project/protected_branches.md @@ -87,11 +87,7 @@ Click **Protect** and the branch will appear in the "Protected branch" list. ## Code Owners approvals **(PREMIUM)** It is possible to require at least one approval for each entry in the -<<<<<<< HEAD [`CODEOWNERS` file](code_owners.md) that matches a file changed in -======= -[`CODEOWNERS` file](../code_owners.md) that matches a file changed in ->>>>>>> Update docs to reflect changes to API and UI the merge request. To enable this feature: 1. Toggle the **Require approval from code owners** slider. diff --git a/ee/app/views/shared/projects/_code_owner_approval_form.html.haml b/ee/app/views/shared/projects/_code_owner_approval_form.html.haml new file mode 100644 index 00000000000..a504cac457a --- /dev/null +++ b/ee/app/views/shared/projects/_code_owner_approval_form.html.haml @@ -0,0 +1,13 @@ +- if @project.merge_requests_require_code_owner_approval + .form-group.row + %label.col-md-2.text-right{ for: 'code_owner_approval_required' } + = s_("ProtectedBranch|Require approval from code owners:") + .col-md-10 + %button{ type: 'button', + class: "js-project-feature-toggle project-feature-toggle is-checked", + "aria-label": s_("ProtectedBranch|Toggle code owner approval") } + %span.toggle-icon + = sprite_icon('status_success_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-checked') + = sprite_icon('status_failed_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-unchecked') + .form-text.text-muted + = s_("ProtectedBranch|Pushes that change filenames matched by the CODEOWNERS file will be rejected") diff --git a/ee/app/views/shared/projects/_code_owner_approval_table.html.haml b/ee/app/views/shared/projects/_code_owner_approval_table.html.haml new file mode 100644 index 00000000000..5d135e9f8da --- /dev/null +++ b/ee/app/views/shared/projects/_code_owner_approval_table.html.haml @@ -0,0 +1,8 @@ +- if @project.merge_requests_require_code_owner_approval + %td + %button{ type: 'button', + class: "js-project-feature-toggle project-feature-toggle mr-5 #{'is-checked' if protected_branch.code_owner_approval_required}", + "aria-label": s_("ProtectedBranch|Toggle code owner approval") } + %span.toggle-icon + = sprite_icon('status_success_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-checked') + = sprite_icon('status_failed_borderless', size: 16, css_class: 'toggle-icon-svg toggle-status-unchecked') diff --git a/ee/app/views/shared/projects/_code_owner_approval_table_head.html.haml b/ee/app/views/shared/projects/_code_owner_approval_table_head.html.haml new file mode 100644 index 00000000000..017058ee981 --- /dev/null +++ b/ee/app/views/shared/projects/_code_owner_approval_table_head.html.haml @@ -0,0 +1,3 @@ +- if @project.merge_requests_require_code_owner_approval + %th + = s_("ProtectedBranch|Code owner approval") |