Commit 17342953 authored by Mike Greiling's avatar Mike Greiling

Merge branch '34060-simplified-general-project-settings' into 'master'

34060 Simply general project settings to use expanded panels

Closes #34060

See merge request !12620
parents 017550d4 6ec561a2
...@@ -348,6 +348,8 @@ import GpgBadges from './gpg_badges'; ...@@ -348,6 +348,8 @@ import GpgBadges from './gpg_badges';
break; break;
case 'projects:edit': case 'projects:edit':
setupProjectEdit(); setupProjectEdit();
// Initialize expandable settings panels
initSettingsPanels();
break; break;
case 'projects:imports:show': case 'projects:imports:show':
new ProjectImport(); new ProjectImport();
......
...@@ -36,7 +36,6 @@ ...@@ -36,7 +36,6 @@
} }
select { select {
background: transparent;
transition: background 2s ease-out; transition: background 2s ease-out;
&.highlight-changes { &.highlight-changes {
......
...@@ -54,8 +54,7 @@ ...@@ -54,8 +54,7 @@
.settings-content { .settings-content {
max-height: 1px; max-height: 1px;
overflow-y: scroll; overflow-y: scroll;
margin-right: -20px; padding-right: 110px;
padding-right: 130px;
animation: collapseMaxHeight 300ms ease-out; animation: collapseMaxHeight 300ms ease-out;
&.expanded { &.expanded {
...@@ -87,6 +86,23 @@ ...@@ -87,6 +86,23 @@
overflow: hidden; overflow: hidden;
margin-top: 20px; margin-top: 20px;
} }
.sub-section {
margin-bottom: 32px;
padding: 16px;
border: 1px solid $border-color;
background-color: $gray-light;
}
.bs-callout,
.checkbox:first-child,
.help-block {
margin-top: 0;
}
.label-light {
margin-bottom: 0;
}
} }
.settings-list-icon { .settings-list-icon {
......
- form = local_assigns.fetch(:form) - form = local_assigns.fetch(:form)
%fieldset.features.merge-requests-feature.append-bottom-default = render 'projects/merge_request_merge_settings', form: form
%hr
%h5.prepend-top-0
Merge Requests
= render 'projects/merge_request_merge_settings', form: form
This diff is collapsed.
...@@ -10,7 +10,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -10,7 +10,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps
end end
step 'I save project' do step 'I save project' do
click_button 'Save changes' page.within '.general-settings' do
click_button 'Save changes'
end
end end
step 'I should see project with new settings' do step 'I should see project with new settings' do
...@@ -31,7 +33,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -31,7 +33,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps
:project_avatar, :project_avatar,
File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif') File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
) )
click_button 'Save changes' page.within '.general-settings' do
click_button 'Save changes'
end
@project.reload @project.reload
end end
...@@ -50,7 +54,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -50,7 +54,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps
:project_avatar, :project_avatar,
File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif') File.join(Rails.root, 'spec', 'fixtures', 'banana_sample.gif')
) )
click_button 'Save changes' page.within '.general-settings' do
click_button 'Save changes'
end
@project.reload @project.reload
end end
...@@ -69,7 +75,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps ...@@ -69,7 +75,9 @@ class Spinach::Features::Project < Spinach::FeatureSteps
step 'change project default branch' do step 'change project default branch' do
select 'fix', from: 'project_default_branch' select 'fix', from: 'project_default_branch'
click_button 'Save changes' page.within '.general-settings' do
click_button 'Save changes'
end
end end
step 'I should see project default branch changed' do step 'I should see project default branch changed' do
......
...@@ -103,7 +103,7 @@ module SharedProject ...@@ -103,7 +103,7 @@ module SharedProject
step 'I should see project settings' do step 'I should see project settings' do
expect(current_path).to eq edit_project_path(@project) expect(current_path).to eq edit_project_path(@project)
expect(page).to have_content("Project name") expect(page).to have_content("Project name")
expect(page).to have_content("Sharing & Permissions") expect(page).to have_content("Sharing and permissions")
end end
def current_project def current_project
......
...@@ -20,21 +20,25 @@ describe 'Edit Project Settings' do ...@@ -20,21 +20,25 @@ describe 'Edit Project Settings' do
visit edit_project_path(project) visit edit_project_path(project)
select 'Disabled', from: "project_project_feature_attributes_#{tool_name}_access_level" select 'Disabled', from: "project_project_feature_attributes_#{tool_name}_access_level"
click_button 'Save changes' page.within('.sharing-permissions') do
click_button 'Save changes'
end
wait_for_requests wait_for_requests
expect(page).not_to have_selector(".shortcuts-#{shortcut_name}") expect(page).not_to have_selector(".shortcuts-#{shortcut_name}")
select 'Everyone with access', from: "project_project_feature_attributes_#{tool_name}_access_level" select 'Everyone with access', from: "project_project_feature_attributes_#{tool_name}_access_level"
click_button 'Save changes' page.within('.sharing-permissions') do
click_button 'Save changes'
end
wait_for_requests wait_for_requests
expect(page).to have_selector(".shortcuts-#{shortcut_name}") expect(page).to have_selector(".shortcuts-#{shortcut_name}")
select 'Only team members', from: "project_project_feature_attributes_#{tool_name}_access_level" select 'Only team members', from: "project_project_feature_attributes_#{tool_name}_access_level"
click_button 'Save changes' page.within('.sharing-permissions') do
click_button 'Save changes'
end
wait_for_requests wait_for_requests
expect(page).to have_selector(".shortcuts-#{shortcut_name}") expect(page).to have_selector(".shortcuts-#{shortcut_name}")
sleep 0.1
end end
end end
end end
...@@ -174,7 +178,11 @@ describe 'Edit Project Settings' do ...@@ -174,7 +178,11 @@ describe 'Edit Project Settings' do
it "disables repository related features" do it "disables repository related features" do
select "Disabled", from: "project_project_feature_attributes_repository_access_level" select "Disabled", from: "project_project_feature_attributes_repository_access_level"
expect(find(".edit-project")).to have_selector("select.disabled", count: 2) page.within('.sharing-permissions') do
click_button "Save changes"
end
expect(find(".sharing-permissions")).to have_selector("select.disabled", count: 2)
end end
it "shows empty features project homepage" do it "shows empty features project homepage" do
...@@ -182,7 +190,9 @@ describe 'Edit Project Settings' do ...@@ -182,7 +190,9 @@ describe 'Edit Project Settings' do
select "Disabled", from: "project_project_feature_attributes_issues_access_level" select "Disabled", from: "project_project_feature_attributes_issues_access_level"
select "Disabled", from: "project_project_feature_attributes_wiki_access_level" select "Disabled", from: "project_project_feature_attributes_wiki_access_level"
click_button "Save changes" page.within('.sharing-permissions') do
click_button "Save changes"
end
wait_for_requests wait_for_requests
visit project_path(project) visit project_path(project)
...@@ -195,7 +205,9 @@ describe 'Edit Project Settings' do ...@@ -195,7 +205,9 @@ describe 'Edit Project Settings' do
select "Disabled", from: "project_project_feature_attributes_issues_access_level" select "Disabled", from: "project_project_feature_attributes_issues_access_level"
select "Disabled", from: "project_project_feature_attributes_wiki_access_level" select "Disabled", from: "project_project_feature_attributes_wiki_access_level"
click_button "Save changes" page.within('.sharing-permissions') do
click_button "Save changes"
end
wait_for_requests wait_for_requests
visit activity_project_path(project) visit activity_project_path(project)
...@@ -236,7 +248,9 @@ describe 'Edit Project Settings' do ...@@ -236,7 +248,9 @@ describe 'Edit Project Settings' do
end end
def save_changes_and_check_activity_tab def save_changes_and_check_activity_tab
click_button "Save changes" page.within('.sharing-permissions') do
click_button "Save changes"
end
wait_for_requests wait_for_requests
visit activity_project_path(project) visit activity_project_path(project)
......
...@@ -14,7 +14,9 @@ describe 'Edit Project Settings' do ...@@ -14,7 +14,9 @@ describe 'Edit Project Settings' do
it 'shows errors for invalid project name' do it 'shows errors for invalid project name' do
visit edit_project_path(project) visit edit_project_path(project)
fill_in 'project_name_edit', with: 'foo&bar' fill_in 'project_name_edit', with: 'foo&bar'
click_button 'Save changes' page.within('.general-settings') do
click_button 'Save changes'
end
expect(page).to have_field 'project_name_edit', with: 'foo&bar' expect(page).to have_field 'project_name_edit', with: 'foo&bar'
expect(page).to have_content "Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'." expect(page).to have_content "Name can contain only letters, digits, emojis, '_', '.', dash, space. It must start with letter, digit, emoji or '_'."
expect(page).to have_button 'Save changes' expect(page).to have_button 'Save changes'
...@@ -23,7 +25,9 @@ describe 'Edit Project Settings' do ...@@ -23,7 +25,9 @@ describe 'Edit Project Settings' do
it 'shows a successful notice when the project is updated' do it 'shows a successful notice when the project is updated' do
visit edit_project_path(project) visit edit_project_path(project)
fill_in 'project_name_edit', with: 'hello world' fill_in 'project_name_edit', with: 'hello world'
click_button 'Save changes' page.within('.general-settings') do
click_button 'Save changes'
end
expect(page).to have_content "Project 'hello world' was successfully updated." expect(page).to have_content "Project 'hello world' was successfully updated."
end end
end end
......
...@@ -20,6 +20,9 @@ feature 'Project settings > Merge Requests', :js do ...@@ -20,6 +20,9 @@ feature 'Project settings > Merge Requests', :js do
expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved')
select 'Disabled', from: "project_project_feature_attributes_merge_requests_access_level" select 'Disabled', from: "project_project_feature_attributes_merge_requests_access_level"
within('.sharing-permissions-form') do
click_on('Save changes')
end
expect(page).not_to have_content('Only allow merge requests to be merged if the pipeline succeeds') expect(page).not_to have_content('Only allow merge requests to be merged if the pipeline succeeds')
expect(page).not_to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).not_to have_content('Only allow merge requests to be merged if all discussions are resolved')
...@@ -37,6 +40,9 @@ feature 'Project settings > Merge Requests', :js do ...@@ -37,6 +40,9 @@ feature 'Project settings > Merge Requests', :js do
expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved')
select 'Everyone with access', from: "project_project_feature_attributes_builds_access_level" select 'Everyone with access', from: "project_project_feature_attributes_builds_access_level"
within('.sharing-permissions-form') do
click_on('Save changes')
end
expect(page).to have_content('Only allow merge requests to be merged if the pipeline succeeds') expect(page).to have_content('Only allow merge requests to be merged if the pipeline succeeds')
expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved')
...@@ -55,6 +61,9 @@ feature 'Project settings > Merge Requests', :js do ...@@ -55,6 +61,9 @@ feature 'Project settings > Merge Requests', :js do
expect(page).not_to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).not_to have_content('Only allow merge requests to be merged if all discussions are resolved')
select 'Everyone with access', from: "project_project_feature_attributes_merge_requests_access_level" select 'Everyone with access', from: "project_project_feature_attributes_merge_requests_access_level"
within('.sharing-permissions-form') do
click_on('Save changes')
end
expect(page).to have_content('Only allow merge requests to be merged if the pipeline succeeds') expect(page).to have_content('Only allow merge requests to be merged if the pipeline succeeds')
expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved') expect(page).to have_content('Only allow merge requests to be merged if all discussions are resolved')
...@@ -73,7 +82,9 @@ feature 'Project settings > Merge Requests', :js do ...@@ -73,7 +82,9 @@ feature 'Project settings > Merge Requests', :js do
scenario 'when unchecked sets :printing_merge_request_link_enabled to false' do scenario 'when unchecked sets :printing_merge_request_link_enabled to false' do
uncheck('project_printing_merge_request_link_enabled') uncheck('project_printing_merge_request_link_enabled')
click_on('Save') within('.merge-request-settings-form') do
click_on('Save changes')
end
# Wait for save to complete and page to reload # Wait for save to complete and page to reload
checkbox = find_field('project_printing_merge_request_link_enabled') checkbox = find_field('project_printing_merge_request_link_enabled')
......
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