Move Members menu item to group information menu

In this commit we're moving the `Members` menu to
the `Group information` menu.
parent 33114d58
...@@ -8,7 +8,9 @@ module GroupsHelper ...@@ -8,7 +8,9 @@ module GroupsHelper
groups#activity groups#activity
groups#subgroups groups#subgroups
].tap do |paths| ].tap do |paths|
paths << 'labels#index' if Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml) break paths if Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
paths.concat(['labels#index', 'group_members#index'])
end end
end end
......
...@@ -48,6 +48,13 @@ ...@@ -48,6 +48,13 @@
%span %span
= _('Labels') = _('Labels')
- if Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
- if group_sidebar_link?(:group_members)
= nav_link(path: 'group_members#index') do
= link_to group_group_members_path(@group), title: _('Members'), data: { qa_selector: 'group_members_item' } do
%span
= _('Members')
= render_if_exists "layouts/nav/ee/epic_link", group: @group = render_if_exists "layouts/nav/ee/epic_link", group: @group
- if group_sidebar_link?(:issues) - if group_sidebar_link?(:issues)
...@@ -131,6 +138,7 @@ ...@@ -131,6 +138,7 @@
- if group_sidebar_link?(:wiki) - if group_sidebar_link?(:wiki)
= render 'layouts/nav/sidebar/wiki_link', wiki_url: @group.wiki.web_url = render 'layouts/nav/sidebar/wiki_link', wiki_url: @group.wiki.web_url
- if Feature.disabled?(:sidebar_refactor, current_user, default_enabled: :yaml)
- if group_sidebar_link?(:group_members) - if group_sidebar_link?(:group_members)
= nav_link(path: 'group_members#index') do = nav_link(path: 'group_members#index') do
= link_to group_group_members_path(@group) do = link_to group_group_members_path(@group) do
......
...@@ -127,7 +127,7 @@ RSpec.describe 'Group navbar' do ...@@ -127,7 +127,7 @@ RSpec.describe 'Group navbar' do
before do before do
group.add_owner(user) group.add_owner(user)
insert_after_nav_item(_('Members'), new_nav_item: settings_nav_item) insert_after_nav_item(_('Analytics'), new_nav_item: settings_nav_item)
insert_after_nav_item(_('Settings'), new_nav_item: administration_nav_item) insert_after_nav_item(_('Settings'), new_nav_item: administration_nav_item)
visit group_path(group) visit group_path(group)
...@@ -142,7 +142,7 @@ RSpec.describe 'Group navbar' do ...@@ -142,7 +142,7 @@ RSpec.describe 'Group navbar' do
group.add_owner(user) group.add_owner(user)
insert_after_nav_item(_('Members'), new_nav_item: settings_nav_item) insert_after_nav_item(_('Analytics'), new_nav_item: settings_nav_item)
insert_after_nav_item( insert_after_nav_item(
_('Settings'), _('Settings'),
new_nav_item: { new_nav_item: {
...@@ -178,7 +178,7 @@ RSpec.describe 'Group navbar' do ...@@ -178,7 +178,7 @@ RSpec.describe 'Group navbar' do
stub_licensed_features(security_dashboard: true, group_level_compliance_dashboard: true) stub_licensed_features(security_dashboard: true, group_level_compliance_dashboard: true)
insert_after_nav_item(_('Members'), new_nav_item: settings_nav_item) insert_after_nav_item(_('Analytics'), new_nav_item: settings_nav_item)
insert_after_nav_item(_('Settings'), new_nav_item: administration_nav_item) insert_after_nav_item(_('Settings'), new_nav_item: administration_nav_item)
visit group_path(group) visit group_path(group)
......
...@@ -16,11 +16,7 @@ RSpec.describe 'Group navbar' do ...@@ -16,11 +16,7 @@ RSpec.describe 'Group navbar' do
group_information_nav_item, group_information_nav_item,
{ {
nav_item: _('Issues'), nav_item: _('Issues'),
nav_sub_items: [ nav_sub_items: issues_nav_items
_('List'),
_('Board'),
_('Milestones')
]
}, },
{ {
nav_item: _('Merge requests'), nav_item: _('Merge requests'),
...@@ -33,11 +29,12 @@ RSpec.describe 'Group navbar' do ...@@ -33,11 +29,12 @@ RSpec.describe 'Group navbar' do
nav_sub_items: [] nav_sub_items: []
}, },
(analytics_nav_item if Gitlab.ee?), (analytics_nav_item if Gitlab.ee?),
{ members_nav_item
nav_item: _('Members'), ].compact
nav_sub_items: [] end
}
] let(:members_nav_item) do
nil
end end
before do before do
...@@ -80,4 +77,40 @@ RSpec.describe 'Group navbar' do ...@@ -80,4 +77,40 @@ RSpec.describe 'Group navbar' do
it_behaves_like 'verified navigation bar' it_behaves_like 'verified navigation bar'
end end
context 'when feature flag :sidebar_refactor is disabled' do
let(:group_information_nav_item) do
{
nav_item: _('Group overview'),
nav_sub_items: [
_('Details'),
_('Activity')
]
}
end
let(:members_nav_item) do
{
nav_item: _('Members'),
nav_sub_items: []
}
end
let(:issues_nav_items) do
[
_('List'),
_('Board'),
_('Labels'),
_('Milestones')
]
end
before do
stub_feature_flags(sidebar_refactor: false)
visit group_path(group)
end
it_behaves_like 'verified navigation bar'
end
end end
...@@ -182,21 +182,26 @@ RSpec.shared_context 'group navbar structure' do ...@@ -182,21 +182,26 @@ RSpec.shared_context 'group navbar structure' do
nav_item: _('Group information'), nav_item: _('Group information'),
nav_sub_items: [ nav_sub_items: [
_('Activity'), _('Activity'),
_('Labels') _('Labels'),
_('Members')
] ]
} }
end end
let(:structure) do let(:issues_nav_items) do
[ [
group_information_nav_item,
{
nav_item: _('Issues'),
nav_sub_items: [
_('List'), _('List'),
_('Board'), _('Board'),
_('Milestones') _('Milestones')
] ]
end
let(:structure) do
[
group_information_nav_item,
{
nav_item: _('Issues'),
nav_sub_items: issues_nav_items
}, },
{ {
nav_item: _('Merge requests'), nav_item: _('Merge requests'),
...@@ -208,11 +213,7 @@ RSpec.shared_context 'group navbar structure' do ...@@ -208,11 +213,7 @@ RSpec.shared_context 'group navbar structure' do
nav_item: _('Kubernetes'), nav_item: _('Kubernetes'),
nav_sub_items: [] nav_sub_items: []
}, },
(analytics_nav_item if Gitlab.ee?), (analytics_nav_item if Gitlab.ee?)
{
nav_item: _('Members'),
nav_sub_items: []
}
] ]
end end
end end
...@@ -25,6 +25,13 @@ RSpec.describe 'layouts/nav/sidebar/_group' do ...@@ -25,6 +25,13 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
expect(rendered).not_to have_link('Details', href: details_group_path(group)) expect(rendered).not_to have_link('Details', href: details_group_path(group))
end end
it 'has a link to the members page' do
render
expect(rendered).to have_selector('.sidebar-top-level-items > li.home a[title="Members"]')
expect(rendered).to have_link('Members', href: group_group_members_path(group))
end
context 'when feature flag :sidebar_refactor is disabled' do context 'when feature flag :sidebar_refactor is disabled' do
before do before do
stub_feature_flags(sidebar_refactor: false) stub_feature_flags(sidebar_refactor: false)
...@@ -41,6 +48,33 @@ RSpec.describe 'layouts/nav/sidebar/_group' do ...@@ -41,6 +48,33 @@ RSpec.describe 'layouts/nav/sidebar/_group' do
expect(rendered).to have_link('Details', href: details_group_path(group)) expect(rendered).to have_link('Details', href: details_group_path(group))
end end
it 'does not have a link to the members page' do
render
expect(rendered).not_to have_selector('.sidebar-top-level-items > li.home a[title="Members"]')
end
end
end
describe 'Members' do
it 'does not have a Members menu' do
render
expect(rendered).not_to have_selector('.nav-item-name', text: 'Members')
end
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
it 'has a Member menu' do
render
expect(rendered).to have_selector('.nav-item-name', text: 'Members')
expect(rendered).to have_link('Members', href: group_group_members_path(group))
end
end end
end end
end end
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