Commit ddce3855 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '333346-tooltip-sidebar-title' into 'master'

Resolve "Add tooltip to sidebar title menu item"

See merge request gitlab-org/gitlab!70951
parents 34503642 eb10ec1a
%aside.nav-sidebar.qa-admin-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), 'aria-label': _('Admin navigation') }
.nav-sidebar-inner-scroll
.context-header
= link_to admin_root_path, title: _('Admin Overview') do
= link_to admin_root_path, title: _('Admin Overview'), class: 'has-tooltip', data: { container: 'body', placement: 'right' } do
%span{ class: ['avatar-container', 'settings-avatar', 'rect-avatar', 's32'] }
= sprite_icon('admin', size: 18)
%span.sidebar-context-title
......
%aside.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), **sidebar_tracking_attributes_by_object(current_user), 'aria-label': _('User settings') }
.nav-sidebar-inner-scroll
.context-header
= link_to profile_path, title: _('Profile Settings') do
= link_to profile_path, title: _('Profile Settings'), class: 'has-tooltip', data: { container: 'body', placement: 'right' } do
%span{ class: ['avatar-container', 'settings-avatar', 's32'] }
= image_tag avatar_icon_for_user(current_user, 32), class: ['avatar', 'avatar-tile', 'js-sidebar-user-avatar', 's32'], alt: current_user.name, data: { testid: 'sidebar-user-avatar' }
%span.sidebar-context-title= _('User Settings')
......
%aside.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), 'aria-label': _('Security navigation') }
.nav-sidebar-inner-scroll
.context-header
= link_to security_dashboard_path, title: _('Security Dashboard'), id: 'logo' do
= link_to security_dashboard_path, title: _('Security Dashboard'), id: 'logo', class: 'has-tooltip', data: { container: 'body', placement: 'right' } do
%span{ class: ['avatar-container', 'rect-avatar', 'settings-avatar', 's32'] }
= brand_header_logo
%span.sidebar-context-title
......
......@@ -21,7 +21,11 @@ module Sidebars
override :extra_nav_link_html_options
def extra_nav_link_html_options
{ class: 'context-header' }
{
class: 'context-header has-tooltip',
title: context.group.name,
data: { container: 'body', placement: 'right' }
}
end
override :render?
......
......@@ -28,7 +28,11 @@ module Sidebars
override :extra_nav_link_html_options
def extra_nav_link_html_options
{ class: 'context-header' }
{
class: 'context-header has-tooltip',
title: context.project.name,
data: { container: 'body', placement: 'right' }
}
end
override :render?
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Sidebars::Groups::Menus::ScopeMenu do
let(:group) { build(:group) }
let(:user) { group.owner }
let(:context) { Sidebars::Groups::Context.new(current_user: user, container: group) }
describe '#extra_nav_link_html_options' do
subject { described_class.new(context).extra_nav_link_html_options }
specify { is_expected.to match(hash_including(class: 'context-header has-tooltip', title: context.group.name)) }
end
end
......@@ -12,4 +12,10 @@ RSpec.describe Sidebars::Projects::Menus::ScopeMenu do
specify { is_expected.to match(hash_including(class: 'shortcuts-project rspec-project-link')) }
end
describe '#extra_nav_link_html_options' do
subject { described_class.new(context).extra_nav_link_html_options }
specify { is_expected.to match(hash_including(class: 'context-header has-tooltip', title: context.project.name)) }
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