Commit d2d121d5 authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '219241-refine-group-creation-form' into 'master'

Refine group creation form

See merge request gitlab-org/gitlab!48490
parents 2d0d5704 d9da46c5
= form_for [:admin, @group] do |f| = form_for [:admin, @group] do |f|
= form_errors(@group) = form_errors(@group)
= render 'shared/group_form', f: f = render 'shared/group_form', f: f
= render 'shared/group_form_description', f: f
= render_if_exists 'shared/old_repository_size_limit_setting', form: f, type: :group = render_if_exists 'shared/old_repository_size_limit_setting', form: f, type: :group
= render_if_exists 'admin/namespace_plan', f: f = render_if_exists 'admin/namespace_plan', f: f
......
...@@ -2,11 +2,6 @@ ...@@ -2,11 +2,6 @@
= render 'shared/group_form', f: f, autofocus: true = render 'shared/group_form', f: f, autofocus: true
.row .row
.form-group.group-description-holder.col-sm-12
= f.label :avatar, _("Group avatar"), class: 'label-bold'
%div
= render 'shared/choose_avatar_button', f: f
.form-group.col-sm-12 .form-group.col-sm-12
%label.label-bold %label.label-bold
= _('Visibility level') = _('Visibility level')
......
...@@ -47,11 +47,3 @@ ...@@ -47,11 +47,3 @@
= f.label :id, class: 'label-bold' do = f.label :id, class: 'label-bold' do
= _("Group ID") = _("Group ID")
= f.text_field :id, class: 'form-control', readonly: true = f.text_field :id, class: 'form-control', readonly: true
.row
.form-group.group-description-holder.col-sm-8
= f.label :description, class: 'label-bold' do
= _("Group description")
%span (optional)
= f.text_area :description, maxlength: 250,
class: 'form-control js-gfm-input', rows: 4
.row
.form-group.group-description-holder.col-sm-8
= f.label :description, _('Group description (optional)'), class: 'label-bold'
= f.text_area :description, maxlength: 250,
class: 'form-control js-gfm-input', rows: 4
---
title: Refine group creation form
merge_request: 48490
author:
type: changed
...@@ -13241,9 +13241,6 @@ msgstr "" ...@@ -13241,9 +13241,6 @@ msgstr ""
msgid "Group by" msgid "Group by"
msgstr "" msgstr ""
msgid "Group description"
msgstr ""
msgid "Group description (optional)" msgid "Group description (optional)"
msgstr "" msgstr ""
......
...@@ -7,7 +7,6 @@ module QA ...@@ -7,7 +7,6 @@ module QA
view 'app/views/shared/_group_form.html.haml' do view 'app/views/shared/_group_form.html.haml' do
element :group_path_field, 'text_field :path' # rubocop:disable QA/ElementWithPattern element :group_path_field, 'text_field :path' # rubocop:disable QA/ElementWithPattern
element :group_name_field, 'text_field :name' # rubocop:disable QA/ElementWithPattern element :group_name_field, 'text_field :name' # rubocop:disable QA/ElementWithPattern
element :group_description_field, 'text_area :description' # rubocop:disable QA/ElementWithPattern
end end
view 'app/views/groups/_new_group_fields.html.haml' do view 'app/views/groups/_new_group_fields.html.haml' do
...@@ -20,10 +19,6 @@ module QA ...@@ -20,10 +19,6 @@ module QA
fill_in 'group_name', with: path fill_in 'group_name', with: path
end end
def set_description(description)
fill_in 'group_description', with: description
end
def set_visibility(visibility) def set_visibility(visibility)
choose visibility choose visibility
end end
......
...@@ -36,7 +36,6 @@ module QA ...@@ -36,7 +36,6 @@ module QA
Page::Group::New.perform do |group_new| Page::Group::New.perform do |group_new|
group_new.set_path(path) group_new.set_path(path)
group_new.set_description(description)
group_new.set_visibility('Public') group_new.set_visibility('Public')
group_new.create group_new.create
end end
......
...@@ -31,7 +31,6 @@ module QA ...@@ -31,7 +31,6 @@ module QA
Page::Group::New.perform do |group| Page::Group::New.perform do |group|
group.set_path(path) group.set_path(path)
group.set_description('GitLab QA Sandbox Group')
group.set_visibility('Public') group.set_visibility('Public')
group.create group.create
end end
......
...@@ -7,9 +7,10 @@ RSpec.describe 'Admin Groups' do ...@@ -7,9 +7,10 @@ RSpec.describe 'Admin Groups' do
include Spec::Support::Helpers::Features::MembersHelpers include Spec::Support::Helpers::Features::MembersHelpers
let(:internal) { Gitlab::VisibilityLevel::INTERNAL } let(:internal) { Gitlab::VisibilityLevel::INTERNAL }
let(:user) { create :user }
let!(:group) { create :group } let_it_be(:user) { create :user }
let!(:current_user) { create(:admin) } let_it_be(:group) { create :group }
let_it_be(:current_user) { create(:admin) }
before do before do
sign_in(current_user) sign_in(current_user)
...@@ -26,6 +27,17 @@ RSpec.describe 'Admin Groups' do ...@@ -26,6 +27,17 @@ RSpec.describe 'Admin Groups' do
end end
describe 'create a group' do describe 'create a group' do
describe 'with expected fields' do
it 'renders from as expected', :aggregate_failures do
visit new_admin_group_path
expect(page).to have_field('name')
expect(page).to have_field('group_path')
expect(page).to have_field('group_visibility_level_0')
expect(page).to have_field('description')
end
end
it 'creates new group' do it 'creates new group' do
visit admin_groups_path visit admin_groups_path
......
...@@ -17,14 +17,11 @@ RSpec.describe 'Dashboard Group' do ...@@ -17,14 +17,11 @@ RSpec.describe 'Dashboard Group' do
visit dashboard_groups_path visit dashboard_groups_path
find('.btn-success').click find('.btn-success').click
new_name = 'Samurai' new_name = 'Samurai'
new_description = 'Tokugawa Shogunate'
fill_in 'group_name', with: new_name fill_in 'group_name', with: new_name
fill_in 'group_description', with: new_description
click_button 'Create group' click_button 'Create group'
expect(current_path).to eq group_path(Group.find_by(name: new_name)) expect(current_path).to eq group_path(Group.find_by(name: new_name))
expect(page).to have_content(new_name) expect(page).to have_content(new_name)
expect(page).to have_content(new_description)
end end
end end
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Group' do RSpec.describe 'Group' do
let(:user) { create(:user) } let_it_be(:user) { create(:user) }
before do before do
sign_in(user) sign_in(user)
...@@ -36,6 +36,15 @@ RSpec.describe 'Group' do ...@@ -36,6 +36,15 @@ RSpec.describe 'Group' do
end end
end end
describe 'with expected fields' do
it 'renders from as expected', :aggregate_failures do
expect(page).to have_field('name')
expect(page).to have_field('group_path')
expect(page).to have_field('group_visibility_level_0')
expect(page).not_to have_field('description')
end
end
describe 'with space in group path' do describe 'with space in group path' do
it 'renders new group form with validation errors' do it 'renders new group form with validation errors' do
fill_in 'Group URL', with: 'space group' fill_in 'Group URL', with: 'space group'
...@@ -135,7 +144,7 @@ RSpec.describe 'Group' do ...@@ -135,7 +144,7 @@ RSpec.describe 'Group' do
end end
describe 'create a nested group', :js do describe 'create a nested group', :js do
let(:group) { create(:group, path: 'foo') } let_it_be(:group) { create(:group, path: 'foo') }
context 'as admin' do context 'as admin' do
let(:user) { create(:admin) } let(:user) { create(:admin) }
...@@ -185,7 +194,7 @@ RSpec.describe 'Group' do ...@@ -185,7 +194,7 @@ RSpec.describe 'Group' do
end end
describe 'group edit', :js do describe 'group edit', :js do
let(:group) { create(:group, :public) } let_it_be(:group) { create(:group, :public) }
let(:path) { edit_group_path(group) } let(:path) { edit_group_path(group) }
let(:new_name) { 'new-name' } let(:new_name) { 'new-name' }
...@@ -230,7 +239,7 @@ RSpec.describe 'Group' do ...@@ -230,7 +239,7 @@ RSpec.describe 'Group' do
end end
describe 'group page with markdown description' do describe 'group page with markdown description' do
let(:group) { create(:group) } let_it_be(:group) { create(:group) }
let(:path) { group_path(group) } let(:path) { group_path(group) }
before do before do
...@@ -271,9 +280,9 @@ RSpec.describe 'Group' do ...@@ -271,9 +280,9 @@ RSpec.describe 'Group' do
end end
describe 'group page with nested groups', :js do describe 'group page with nested groups', :js do
let!(:group) { create(:group) } let_it_be(:group) { create(:group) }
let!(:nested_group) { create(:group, parent: group) } let_it_be(:nested_group) { create(:group, parent: group) }
let!(:project) { create(:project, namespace: group) } let_it_be(:project) { create(:project, namespace: group) }
before do before do
group.add_owner(user) group.add_owner(user)
...@@ -304,7 +313,11 @@ RSpec.describe 'Group' do ...@@ -304,7 +313,11 @@ RSpec.describe 'Group' do
end end
describe 'new subgroup / project button' do describe 'new subgroup / project button' do
let(:group) { create(:group, project_creation_level: Gitlab::Access::NO_ONE_PROJECT_ACCESS, subgroup_creation_level: Gitlab::Access::OWNER_SUBGROUP_ACCESS) } let_it_be(:group, reload: true) do
create(:group,
project_creation_level: Gitlab::Access::NO_ONE_PROJECT_ACCESS,
subgroup_creation_level: Gitlab::Access::OWNER_SUBGROUP_ACCESS)
end
before do before do
group.add_owner(user) group.add_owner(user)
...@@ -341,6 +354,7 @@ RSpec.describe 'Group' do ...@@ -341,6 +354,7 @@ RSpec.describe 'Group' do
context 'when user has project and subgroup creation permissions' do context 'when user has project and subgroup creation permissions' do
it 'displays "New subgroup" and "New project" buttons' do it 'displays "New subgroup" and "New project" buttons' do
group.update!(project_creation_level: Gitlab::Access::MAINTAINER_PROJECT_ACCESS) group.update!(project_creation_level: Gitlab::Access::MAINTAINER_PROJECT_ACCESS)
visit group_path(group) visit group_path(group)
page.within '[data-testid="group-buttons"]' do page.within '[data-testid="group-buttons"]' 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