Commit eb10ec1a authored by David O'Regan's avatar David O'Regan Committed by Kushal Pandya

Resolve "Add tooltip to sidebar title menu item"

parent 10e8074a
%aside.nav-sidebar.qa-admin-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), 'aria-label': _('Admin navigation') } %aside.nav-sidebar.qa-admin-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), 'aria-label': _('Admin navigation') }
.nav-sidebar-inner-scroll .nav-sidebar-inner-scroll
.context-header .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'] } %span{ class: ['avatar-container', 'settings-avatar', 'rect-avatar', 's32'] }
= sprite_icon('admin', size: 18) = sprite_icon('admin', size: 18)
%span.sidebar-context-title %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') } %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 .nav-sidebar-inner-scroll
.context-header .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'] } %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' } = 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') %span.sidebar-context-title= _('User Settings')
......
%aside.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), 'aria-label': _('Security navigation') } %aside.nav-sidebar{ class: ("sidebar-collapsed-desktop" if collapsed_sidebar?), 'aria-label': _('Security navigation') }
.nav-sidebar-inner-scroll .nav-sidebar-inner-scroll
.context-header .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'] } %span{ class: ['avatar-container', 'rect-avatar', 'settings-avatar', 's32'] }
= brand_header_logo = brand_header_logo
%span.sidebar-context-title %span.sidebar-context-title
......
...@@ -21,7 +21,11 @@ module Sidebars ...@@ -21,7 +21,11 @@ module Sidebars
override :extra_nav_link_html_options override :extra_nav_link_html_options
def 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 end
override :render? override :render?
......
...@@ -28,7 +28,11 @@ module Sidebars ...@@ -28,7 +28,11 @@ module Sidebars
override :extra_nav_link_html_options override :extra_nav_link_html_options
def 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 end
override :render? 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 ...@@ -12,4 +12,10 @@ RSpec.describe Sidebars::Projects::Menus::ScopeMenu do
specify { is_expected.to match(hash_including(class: 'shortcuts-project rspec-project-link')) } specify { is_expected.to match(hash_including(class: 'shortcuts-project rspec-project-link')) }
end 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 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