Commit 004baec9 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '322687-fj-change-project-overview-details' into 'master'

Perform changes to Project Overview menu

See merge request gitlab-org/gitlab!60840
parents 2e6d3d9c 9e328c6d
......@@ -116,6 +116,16 @@ RSpec.describe 'Project navbar' do
]
end
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Releases')
]
}
end
before do
stub_feature_flags(sidebar_refactor: true)
......
......@@ -3,7 +3,7 @@
module Sidebars
module Projects
module Menus
class ProjectOverviewMenu < ::Sidebars::Menu
class ProjectInformationMenu < ::Sidebars::Menu
override :configure_menu_items
def configure_menu_items
add_item(details_menu_item)
......@@ -32,17 +32,34 @@ module Sidebars
override :title
def title
_('Project overview')
if Feature.enabled?(:sidebar_refactor, context.current_user)
_('Project information')
else
_('Project overview')
end
end
override :sprite_icon
def sprite_icon
'home'
if Feature.enabled?(:sidebar_refactor, context.current_user)
'project'
else
'home'
end
end
override :active_routes
def active_routes
return {} if Feature.disabled?(:sidebar_refactor, context.current_user)
{ path: 'projects#show' }
end
private
def details_menu_item
return if Feature.enabled?(:sidebar_refactor, context.current_user)
::Sidebars::MenuItem.new(
title: _('Details'),
link: project_path(context.project),
......
......@@ -7,7 +7,7 @@ module Sidebars
def configure_menus
set_scope_menu(Sidebars::Projects::Menus::ScopeMenu.new(context))
add_menu(Sidebars::Projects::Menus::ProjectOverviewMenu.new(context))
add_menu(Sidebars::Projects::Menus::ProjectInformationMenu.new(context))
add_menu(Sidebars::Projects::Menus::LearnGitlabMenu.new(context))
add_menu(Sidebars::Projects::Menus::RepositoryMenu.new(context))
add_menu(Sidebars::Projects::Menus::IssuesMenu.new(context))
......
......@@ -25162,6 +25162,9 @@ msgstr ""
msgid "Project info:"
msgstr ""
msgid "Project information"
msgstr ""
msgid "Project is required when cluster_type is :project"
msgstr ""
......
......@@ -378,11 +378,11 @@ RSpec.describe 'Group' do
expect(page).to have_link('Subgroup information')
end
it 'renders project page with the text "Project overview"' do
it 'renders project page with the text "Project information"' do
visit project_path(project)
wait_for_requests
expect(page).to have_link('Project overview')
expect(page).to have_link('Project information')
end
end
......
......@@ -3,11 +3,11 @@
require 'spec_helper'
RSpec.describe 'Project active tab' do
let(:user) { create :user }
let(:project) { create(:project, :repository) }
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner }
before do
project.add_maintainer(user)
sign_in(user)
end
......@@ -18,15 +18,28 @@ RSpec.describe 'Project active tab' do
end
context 'on project Home' do
before do
visit project_path(project)
context 'when feature flag :sidebar_refactor is enabled' do
before do
visit project_path(project)
end
it_behaves_like 'page has active tab', 'Project'
end
it_behaves_like 'page has active tab', 'Project'
it_behaves_like 'page has active sub tab', 'Details'
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
visit project_path(project)
end
it_behaves_like 'page has active tab', 'Project'
it_behaves_like 'page has active sub tab', 'Details'
end
context 'on project Home/Activity' do
before do
visit project_path(project)
click_tab('Activity')
end
......
......@@ -86,6 +86,16 @@ RSpec.describe 'Project navbar' do
]
end
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Releases')
]
}
end
before do
stub_feature_flags(sidebar_refactor: true)
stub_config(registry: { enabled: true })
......
......@@ -68,14 +68,27 @@ RSpec.describe 'User uses shortcuts', :js do
end
context 'when navigating to the Project pages' do
it 'redirects to the details page' do
it 'redirects to the project page' do
visit project_issues_path(project)
find('body').native.send_key('g')
find('body').native.send_key('p')
expect(page).to have_active_navigation('Project')
expect(page).to have_active_sub_navigation('Details')
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'redirects to the details page' do
stub_feature_flags(sidebar_refactor: false)
visit project_issues_path(project)
find('body').native.send_key('g')
find('body').native.send_key('p')
expect(page).to have_active_navigation('Project')
expect(page).to have_active_sub_navigation('Details')
end
end
it 'redirects to the activity page' do
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Sidebars::Projects::Menus::ProjectOverviewMenu do
RSpec.describe Sidebars::Projects::Menus::ProjectInformationMenu do
let_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner }
......
......@@ -41,16 +41,20 @@ RSpec.shared_context 'project navbar structure' do
]
end
let(:project_information_nav_item) do
{
nav_item: _('Project overview'),
nav_sub_items: [
_('Details'),
_('Activity'),
_('Releases')
]
}
end
let(:structure) do
[
{
nav_item: _('Project overview'),
nav_sub_items: [
_('Details'),
_('Activity'),
_('Releases')
]
},
project_information_nav_item,
{
nav_item: _('Repository'),
nav_sub_items: [
......
......@@ -19,20 +19,41 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it_behaves_like 'has nav sidebar'
describe 'Project Overview' do
describe 'Project information' do
it 'has a link to the project path' do
render
expect(rendered).to have_link('Project overview', href: project_path(project), class: %w(shortcuts-project rspec-project-link))
expect(rendered).to have_selector('[aria-label="Project overview"]')
expect(rendered).to have_link('Project information', href: project_path(project), class: %w(shortcuts-project rspec-project-link))
expect(rendered).to have_selector('[aria-label="Project information"]')
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'has a link to the project path' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).to have_link('Project overview', href: project_path(project), class: %w(shortcuts-project rspec-project-link))
expect(rendered).to have_selector('[aria-label="Project overview"]')
end
end
describe 'Details' do
it 'has a link to the projects path' do
it 'does not have a link to the details menu' do
render
expect(rendered).to have_link('Details', href: project_path(project), class: 'shortcuts-project')
expect(rendered).to have_selector('[aria-label="Project details"]')
expect(rendered).not_to have_link('Details', href: project_path(project))
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'has a link to the projects path' do
stub_feature_flags(sidebar_refactor: false)
render
expect(rendered).to have_link('Details', href: project_path(project), class: 'shortcuts-project')
expect(rendered).to have_selector('[aria-label="Project details"]')
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