Perform changes to Project Overview menu

In this commit we perform several changes to the
Project Overview menu:
- First we are renaming it to `Project information`
- We're changing the sprite icon to `project`
- We're also removing the `Details` menu
parent b723f517
...@@ -116,6 +116,16 @@ RSpec.describe 'Project navbar' do ...@@ -116,6 +116,16 @@ RSpec.describe 'Project navbar' do
] ]
end end
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Releases')
]
}
end
before do before do
stub_feature_flags(sidebar_refactor: true) stub_feature_flags(sidebar_refactor: true)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Sidebars module Sidebars
module Projects module Projects
module Menus module Menus
class ProjectOverviewMenu < ::Sidebars::Menu class ProjectInformationMenu < ::Sidebars::Menu
override :configure_menu_items override :configure_menu_items
def configure_menu_items def configure_menu_items
add_item(details_menu_item) add_item(details_menu_item)
...@@ -32,17 +32,34 @@ module Sidebars ...@@ -32,17 +32,34 @@ module Sidebars
override :title override :title
def title def title
if Feature.enabled?(:sidebar_refactor, context.current_user)
_('Project information')
else
_('Project overview') _('Project overview')
end end
end
override :sprite_icon override :sprite_icon
def sprite_icon def sprite_icon
if Feature.enabled?(:sidebar_refactor, context.current_user)
'project'
else
'home' 'home'
end end
end
override :active_routes
def active_routes
return {} if Feature.disabled?(:sidebar_refactor, context.current_user)
{ path: 'projects#show' }
end
private private
def details_menu_item def details_menu_item
return if Feature.enabled?(:sidebar_refactor, context.current_user)
::Sidebars::MenuItem.new( ::Sidebars::MenuItem.new(
title: _('Details'), title: _('Details'),
link: project_path(context.project), link: project_path(context.project),
......
...@@ -7,7 +7,7 @@ module Sidebars ...@@ -7,7 +7,7 @@ module Sidebars
def configure_menus def configure_menus
set_scope_menu(Sidebars::Projects::Menus::ScopeMenu.new(context)) 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::LearnGitlabMenu.new(context))
add_menu(Sidebars::Projects::Menus::RepositoryMenu.new(context)) add_menu(Sidebars::Projects::Menus::RepositoryMenu.new(context))
add_menu(Sidebars::Projects::Menus::IssuesMenu.new(context)) add_menu(Sidebars::Projects::Menus::IssuesMenu.new(context))
......
...@@ -25129,6 +25129,9 @@ msgstr "" ...@@ -25129,6 +25129,9 @@ msgstr ""
msgid "Project info:" msgid "Project info:"
msgstr "" msgstr ""
msgid "Project information"
msgstr ""
msgid "Project is required when cluster_type is :project" msgid "Project is required when cluster_type is :project"
msgstr "" msgstr ""
......
...@@ -378,11 +378,11 @@ RSpec.describe 'Group' do ...@@ -378,11 +378,11 @@ RSpec.describe 'Group' do
expect(page).to have_link('Subgroup information') expect(page).to have_link('Subgroup information')
end 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) visit project_path(project)
wait_for_requests wait_for_requests
expect(page).to have_link('Project overview') expect(page).to have_link('Project information')
end end
end end
......
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe 'Project active tab' do RSpec.describe 'Project active tab' do
let(:user) { create :user } let_it_be(:project) { create(:project, :repository) }
let(:project) { create(:project, :repository) }
let(:user) { project.owner }
before do before do
project.add_maintainer(user)
sign_in(user) sign_in(user)
end end
...@@ -18,15 +18,28 @@ RSpec.describe 'Project active tab' do ...@@ -18,15 +18,28 @@ RSpec.describe 'Project active tab' do
end end
context 'on project Home' do context 'on project Home' do
context 'when feature flag :sidebar_refactor is enabled' do
before do before do
visit project_path(project) visit project_path(project)
end end
it_behaves_like 'page has active tab', 'Project'
end
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 tab', 'Project'
it_behaves_like 'page has active sub tab', 'Details' it_behaves_like 'page has active sub tab', 'Details'
end
context 'on project Home/Activity' do context 'on project Home/Activity' do
before do before do
visit project_path(project)
click_tab('Activity') click_tab('Activity')
end end
......
...@@ -86,6 +86,16 @@ RSpec.describe 'Project navbar' do ...@@ -86,6 +86,16 @@ RSpec.describe 'Project navbar' do
] ]
end end
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
nav_sub_items: [
_('Activity'),
_('Releases')
]
}
end
before do before do
stub_feature_flags(sidebar_refactor: true) stub_feature_flags(sidebar_refactor: true)
stub_config(registry: { enabled: true }) stub_config(registry: { enabled: true })
......
...@@ -68,7 +68,19 @@ RSpec.describe 'User uses shortcuts', :js do ...@@ -68,7 +68,19 @@ RSpec.describe 'User uses shortcuts', :js do
end end
context 'when navigating to the Project pages' do context 'when navigating to the Project pages' 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')
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'redirects to the details page' do it 'redirects to the details page' do
stub_feature_flags(sidebar_refactor: false)
visit project_issues_path(project) visit project_issues_path(project)
find('body').native.send_key('g') find('body').native.send_key('g')
...@@ -77,6 +89,7 @@ RSpec.describe 'User uses shortcuts', :js do ...@@ -77,6 +89,7 @@ RSpec.describe 'User uses shortcuts', :js do
expect(page).to have_active_navigation('Project') expect(page).to have_active_navigation('Project')
expect(page).to have_active_sub_navigation('Details') expect(page).to have_active_sub_navigation('Details')
end end
end
it 'redirects to the activity page' do it 'redirects to the activity page' do
find('body').native.send_key('g') find('body').native.send_key('g')
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' 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_it_be(:project) { create(:project, :repository) }
let(:user) { project.owner } let(:user) { project.owner }
......
...@@ -41,8 +41,7 @@ RSpec.shared_context 'project navbar structure' do ...@@ -41,8 +41,7 @@ RSpec.shared_context 'project navbar structure' do
] ]
end end
let(:structure) do let(:project_information_nav_item) do
[
{ {
nav_item: _('Project overview'), nav_item: _('Project overview'),
nav_sub_items: [ nav_sub_items: [
...@@ -50,7 +49,12 @@ RSpec.shared_context 'project navbar structure' do ...@@ -50,7 +49,12 @@ RSpec.shared_context 'project navbar structure' do
_('Activity'), _('Activity'),
_('Releases') _('Releases')
] ]
}, }
end
let(:structure) do
[
project_information_nav_item,
{ {
nav_item: _('Repository'), nav_item: _('Repository'),
nav_sub_items: [ nav_sub_items: [
......
...@@ -19,22 +19,43 @@ RSpec.describe 'layouts/nav/sidebar/_project' do ...@@ -19,22 +19,43 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it_behaves_like 'has nav sidebar' it_behaves_like 'has nav sidebar'
describe 'Project Overview' do describe 'Project information' do
it 'has a link to the project path' do it 'has a link to the project path' do
render render
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_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_selector('[aria-label="Project overview"]')
end end
end
describe 'Details' do describe 'Details' do
it 'does not have a link to the details menu' do
render
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 it 'has a link to the projects path' do
stub_feature_flags(sidebar_refactor: false)
render render
expect(rendered).to have_link('Details', href: project_path(project), class: 'shortcuts-project') expect(rendered).to have_link('Details', href: project_path(project), class: 'shortcuts-project')
expect(rendered).to have_selector('[aria-label="Project details"]') expect(rendered).to have_selector('[aria-label="Project details"]')
end end
end end
end
describe 'Activity' do describe 'Activity' do
it 'has a link to the project activity path' do it 'has a link to the project activity path' 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