Migrate GitLab UI checkbox to `gitlab_ui_checkbox_component` in `app/views/groups/settings/_two_factor_auth.html.haml`
Instructions
-
Find the form_for
block that encompasses the checkbox field you are changing. Change it togitlab_ui_form_for
-
The HAML partial may be used in multiple forms. Make sure you change all of the
form_for
blocks that encompass the checkbox.
-
The HAML partial may be used in multiple forms. Make sure you change all of the
-
Change f.check_box
tof.gitlab_ui_checkbox_component
-
Remove f.label
and instead pass the label as the second argument inf.gitlab_ui_checkbox_component
See https://docs.gitlab.com/ee/development/fe_guide/haml.html#gitlab-ui-form-builder for more information.
Examples
Before
= form_for @group do |f|
.form-group.gl-mb-3
.gl-form-checkbox.custom-control.custom-checkbox
= f.check_box :prevent_sharing_groups_outside_hierarchy, disabled: !can_change_prevent_sharing_groups_outside_hierarchy?(@group), class: 'custom-control-input'
= f.label :prevent_sharing_groups_outside_hierarchy, class: 'custom-control-label' do
%span
= s_('GroupSettings|Prevent members from sending invitations to groups outside of %{group} and its subgroups.').html_safe % { group: link_to_group(@group) }
%p.help-text= prevent_sharing_groups_outside_hierarchy_help_text(@group)
After
= gitlab_ui_form_for @group do |f|
.form-group.gl-mb-3
= f.gitlab_ui_checkbox_component :prevent_sharing_groups_outside_hierarchy,
s_('GroupSettings|Prevent members from sending invitations to groups outside of %{group} and its subgroups.').html_safe % { group: link_to_group(@group) },
help_text: prevent_sharing_groups_outside_hierarchy_help_text(@group),
checkbox_options: { disabled: !can_change_prevent_sharing_groups_outside_hierarchy?(@group) }