Commit 8c70700a authored by Martin Wortschack's avatar Martin Wortschack Committed by Phil Hughes

Resolve "Choosing “Initialize repo with a README” breaks project created from template"

parent 38707042
...@@ -63,4 +63,4 @@ ...@@ -63,4 +63,4 @@
= form_for @project, html: { class: 'new_project' } do |f| = form_for @project, html: { class: 'new_project' } do |f|
%hr %hr
= render "shared/import_form", f: f = render "shared/import_form", f: f
= render 'new_project_fields', f: f, project_name_id: "import-url-name" = render 'new_project_fields', f: f, project_name_id: "import-url-name", hide_init_with_readme: true
- visibility_level = params.dig(:project, :visibility_level) || default_project_visibility - visibility_level = params.dig(:project, :visibility_level) || default_project_visibility
- ci_cd_only = local_assigns.fetch(:ci_cd_only, false) - ci_cd_only = local_assigns.fetch(:ci_cd_only, false)
- hide_init_with_readme = local_assigns.fetch(:hide_init_with_readme, false)
.row{ id: project_name_id } .row{ id: project_name_id }
= f.hidden_field :ci_cd_only, value: ci_cd_only = f.hidden_field :ci_cd_only, value: ci_cd_only
...@@ -48,7 +49,8 @@ ...@@ -48,7 +49,8 @@
= link_to icon('question-circle'), help_page_path("public_access/public_access"), aria: { label: 'Documentation for Visibility Level' }, target: '_blank', rel: 'noopener noreferrer' = link_to icon('question-circle'), help_page_path("public_access/public_access"), aria: { label: 'Documentation for Visibility Level' }, target: '_blank', rel: 'noopener noreferrer'
= render 'shared/visibility_level', f: f, visibility_level: visibility_level.to_i, can_change_visibility_level: true, form_model: @project, with_label: false = render 'shared/visibility_level', f: f, visibility_level: visibility_level.to_i, can_change_visibility_level: true, form_model: @project, with_label: false
.form-group.row.initialize-with-readme-setting - if !hide_init_with_readme
.form-group.row.initialize-with-readme-setting
%div{ :class => "col-sm-12" } %div{ :class => "col-sm-12" }
.form-check .form-check
= check_box_tag 'project[initialize_with_readme]', '1', false, class: 'form-check-input' = check_box_tag 'project[initialize_with_readme]', '1', false, class: 'form-check-input'
......
...@@ -5,4 +5,4 @@ ...@@ -5,4 +5,4 @@
.project-fields-form .project-fields-form
= render 'projects/project_templates/project_fields_form' = render 'projects/project_templates/project_fields_form'
= render 'projects/new_project_fields', f: f, project_name_id: "template-project-name" = render 'projects/new_project_fields', f: f, project_name_id: "template-project-name", hide_init_with_readme: true
---
title: 'create from template: hide checkbox for initializing repository with readme'
merge_request: 21646
author:
type: other
...@@ -66,12 +66,34 @@ describe 'New project' do ...@@ -66,12 +66,34 @@ describe 'New project' do
end end
context 'Readme selector' do context 'Readme selector' do
it 'shows the initialize with Readme checkbox' do it 'shows the initialize with Readme checkbox on "Blank project" tab' do
visit new_project_path visit new_project_path
expect(page).to have_css('input#project_initialize_with_readme') expect(page).to have_css('input#project_initialize_with_readme')
expect(page).to have_content('Initialize repository with a README') expect(page).to have_content('Initialize repository with a README')
end end
it 'does not show the initialize with Readme checkbox on "Create from template" tab' do
visit new_project_path
find('#create-from-template-pane').click
first('.choose-template').click
page.within '.project-fields-form' do
expect(page).not_to have_css('input#project_initialize_with_readme')
expect(page).not_to have_content('Initialize repository with a README')
end
end
it 'does not show the initialize with Readme checkbox on "Import project" tab' do
visit new_project_path
find('#import-project-tab').click
first('.js-import-git-toggle-button').click
page.within '.toggle-import-form' do
expect(page).not_to have_css('input#project_initialize_with_readme')
expect(page).not_to have_content('Initialize repository with a README')
end
end
end end
context 'Namespace selector' do context 'Namespace selector' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment