diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a75c1b161451012d1fac1b79472112e7a2a80226..e897054e74a2bba7df9b25793df8915fea61f8d6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -448,6 +448,10 @@ def gitlab_ui_form_for(record, *args, &block) form_for(record, *(args << options.merge({ builder: ::Gitlab::FormBuilders::GitlabUiFormBuilder })), &block) end + def gitlab_ui_form_with(**args, &block) + form_with(**args.merge({ builder: ::Gitlab::FormBuilders::GitlabUiFormBuilder }), &block) + end + private def appearance diff --git a/app/views/groups/_import_group_from_another_instance_panel.html.haml b/app/views/groups/_import_group_from_another_instance_panel.html.haml index a9234753aa2370bda6b41dacf0a7fcf186fc9391..d48bf0173a4ced43a03a1ea7e9775340c084b085 100644 --- a/app/views/groups/_import_group_from_another_instance_panel.html.haml +++ b/app/views/groups/_import_group_from_another_instance_panel.html.haml @@ -1,5 +1,5 @@ -= form_with url: configure_import_bulk_imports_path(namespace_id: params[:parent_id]), class: 'group-form gl-show-field-errors' do |f| - .gl-border-l-solid.gl-border-r-solid.gl-border-gray-100.gl-border-1.gl-p-5 += gitlab_ui_form_with url: configure_import_bulk_imports_path(namespace_id: params[:parent_id]), class: 'gl-show-field-errors' do |f| + .gl-border-l-solid.gl-border-r-solid.gl-border-t-solid.gl-border-gray-100.gl-border-1.gl-p-5.gl-mt-4 .gl-display-flex.gl-align-items-center %h4.gl-display-flex = s_('GroupsNew|Import groups from another instance of GitLab') @@ -32,4 +32,4 @@ id: 'import_gitlab_token', data: { qa_selector: 'import_gitlab_token' } .gl-border-gray-100.gl-border-solid.gl-border-1.gl-bg-gray-10.gl-p-5 - = f.submit s_('GroupsNew|Connect instance'), class: 'btn gl-button btn-confirm', data: { qa_selector: 'connect_instance_button' } + = f.submit s_('GroupsNew|Connect instance'), pajamas_button: true, data: { qa_selector: 'connect_instance_button' } diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 264431b1bb55fe5829a6cff0bcbbf9cffc51ceb8..a4b2c963c74ec14cfb59b9143d6d4d971fb86649 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -486,6 +486,25 @@ def stub_controller_method(method_name, value) end end + describe '#gitlab_ui_form_with' do + let_it_be(:user) { build(:user) } + + before do + allow(helper).to receive(:users_path).and_return('/root') + allow(helper).to receive(:form_with).and_call_original + end + + it 'adds custom form builder to options and calls `form_with`' do + options = { model: user, html: { class: 'foo-bar' } } + expected_options = options.merge({ builder: ::Gitlab::FormBuilders::GitlabUiFormBuilder }) + + expect do |b| + helper.gitlab_ui_form_with(**options, &b) + end.to yield_with_args(::Gitlab::FormBuilders::GitlabUiFormBuilder) + expect(helper).to have_received(:form_with).with(expected_options) + end + end + describe '#page_class' do context 'when logged_out_marketing_header experiment is enabled' do let_it_be(:expected_class) { 'logged-out-marketing-header-candidate' }