Commit e4aeca5e authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'ee-revert-sidebar-title-attribute' into 'master'

EE port of revert-sidebar-title-attribute

See merge request gitlab-org/gitlab-ee!2917
parents e121718a 3228183f
......@@ -15,7 +15,6 @@ export default class NewNavSidebar {
this.$openSidebar = $('.toggle-mobile-nav');
this.$closeSidebar = $('.close-nav-button');
this.$sidebarToggle = $('.js-toggle-sidebar');
this.$topLevelLinks = $('.sidebar-top-level-items > li > a');
}
bindEvents() {
......@@ -51,10 +50,6 @@ export default class NewNavSidebar {
this.$page.toggleClass('page-with-icon-sidebar', breakpoint === 'sm' ? true : collapsed);
}
NewNavSidebar.setCollapsedCookie(collapsed);
this.$topLevelLinks.attr('title', function updateTopLevelTitle() {
return collapsed ? this.getAttribute('aria-label') : '';
});
}
render() {
......
......@@ -119,8 +119,4 @@ module TabHelper
'active' if current_controller?('oauth/applications')
end
def sidebar_link(href, title: nil, css: nil, &block)
link_to capture(&block), href, title: (title if collapsed_sidebar?), class: css, aria: { label: title }
end
end
......@@ -7,7 +7,7 @@
.sidebar-context-title Admin Area
%ul.sidebar-top-level-items
= nav_link(controller: %w(dashboard admin projects users groups jobs runners cohorts), html_options: {class: 'home'}) do
= sidebar_link admin_root_path, title: _('Overview'), css: 'shortcuts-tree' do
= link_to admin_root_path, class: 'shortcuts-tree' do
.nav-icon-container
= custom_icon('overview')
%span.nav-item-name
......@@ -53,7 +53,7 @@
ConvDev Index
= nav_link(controller: %w(conversational_development_index system_info background_jobs logs health_check requests_profiles audit_logs)) do
= sidebar_link admin_conversational_development_index_path, title: _('Monitoring') do
= link_to admin_system_info_path do
.nav-icon-container
= custom_icon('monitoring')
%span.nav-item-name
......@@ -61,7 +61,7 @@
%ul.sidebar-sub-level-items
= nav_link(controller: %w(conversational_development_index system_info background_jobs logs health_check requests_profiles), html_options: { class: "fly-out-top-item" } ) do
= link_to admin_conversational_development_index_path do
= link_to admin_system_info_path do
%strong.fly-out-top-item-name
#{ _('Monitoring') }
%li.divider.fly-out-top-item
......@@ -88,7 +88,7 @@
= render 'layouts/nav/ee/new_admin_monitoring_sidebar'
= nav_link(controller: :broadcast_messages) do
= sidebar_link admin_broadcast_messages_path, title: _('Messages') do
= link_to admin_broadcast_messages_path do
.nav-icon-container
= custom_icon('messages')
%span.nav-item-name
......@@ -100,7 +100,7 @@
#{ _('Messages') }
= nav_link(controller: [:hooks, :hook_logs]) do
= sidebar_link admin_hooks_path, title: _('Hooks') do
= link_to admin_hooks_path do
.nav-icon-container
= custom_icon('system_hooks')
%span.nav-item-name
......@@ -112,7 +112,7 @@
#{ _('System Hooks') }
= nav_link(controller: :applications) do
= sidebar_link admin_applications_path, title: _('Applications') do
= link_to admin_applications_path do
.nav-icon-container
= custom_icon('applications')
%span.nav-item-name
......@@ -124,7 +124,7 @@
#{ _('Applications') }
= nav_link(controller: :abuse_reports) do
= sidebar_link admin_abuse_reports_path, title: _("Abuse Reports") do
= link_to admin_abuse_reports_path do
.nav-icon-container
= custom_icon('abuse_reports')
%span.nav-item-name
......@@ -138,7 +138,7 @@
%span.badge.count.merge_counter.js-merge-counter.fly-out-badge= number_with_delimiter(AbuseReport.count(:all))
= nav_link(controller: :licenses) do
= sidebar_link admin_license_path, title: _('License') do
= link_to admin_license_path do
.nav-icon-container
= custom_icon('license')
%span.nav-item-name
......@@ -151,7 +151,7 @@
- if akismet_enabled?
= nav_link(controller: :spam_logs) do
= sidebar_link admin_spam_logs_path, title: _("Spam Logs") do
= link_to admin_spam_logs_path do
.nav-icon-container
= custom_icon('spam_logs')
%span.nav-item-name
......@@ -163,7 +163,7 @@
#{ _('Spam Logs') }
= nav_link(controller: :push_rules) do
= sidebar_link admin_push_rule_path, title: _('Push Rules') do
= link_to admin_push_rule_path do
.nav-icon-container
= custom_icon('push_rules')
%span.nav-item-name
......@@ -175,7 +175,7 @@
#{ _('Push Rules') }
= nav_link(controller: :geo_nodes) do
= sidebar_link admin_geo_nodes_path, title: _('Geo Nodes') do
= link_to admin_geo_nodes_path do
.nav-icon-container
= custom_icon('geo_nodes')
%span.nav-item-name
......@@ -187,7 +187,7 @@
#{ _('Geo Nodes') }
= nav_link(controller: :deploy_keys) do
= sidebar_link admin_deploy_keys_path, title: _('Deploy Keys') do
= link_to admin_deploy_keys_path do
.nav-icon-container
= custom_icon('key')
%span.nav-item-name
......@@ -199,7 +199,7 @@
#{ _('Deploy Keys') }
= nav_link(controller: :services) do
= sidebar_link admin_application_settings_services_path, title: _('Service Templates') do
= link_to admin_application_settings_services_path do
.nav-icon-container
= custom_icon('service_templates')
%span.nav-item-name
......@@ -211,7 +211,7 @@
#{ _('Service Templates') }
= nav_link(controller: :labels) do
= sidebar_link admin_labels_path, title: _('Labels') do
= link_to admin_labels_path do
.nav-icon-container
= custom_icon('labels')
%span.nav-item-name
......@@ -223,7 +223,7 @@
#{ _('Labels') }
= nav_link(controller: :appearances) do
= sidebar_link admin_appearances_path, title: _('Appearances') do
= link_to admin_appearances_path do
.nav-icon-container
= custom_icon('appearance')
%span.nav-item-name
......@@ -235,7 +235,7 @@
#{ _('Appearance') }
= nav_link(controller: :application_settings) do
= sidebar_link admin_application_settings_path, title: _('Settings') do
= link_to admin_application_settings_path do
.nav-icon-container
= custom_icon('settings')
%span.nav-item-name
......
......@@ -15,7 +15,7 @@
= @group.name
%ul.sidebar-top-level-items
= nav_link(path: ['groups#show', 'groups#activity', 'groups#subgroups', 'analytics#show'], html_options: { class: 'home' }) do
= sidebar_link group_path(@group), title: _('Group overview') do
= link_to group_path(@group) do
.nav-icon-container
= custom_icon('project')
%span.nav-item-name
......@@ -44,7 +44,7 @@
Contribution Analytics
= nav_link(path: issues_sub_menu_items) do
= sidebar_link issues_group_path(@group), title: _('Issues') do
= link_to issues_group_path(@group) do
.nav-icon-container
= custom_icon('issues')
%span.nav-item-name
......@@ -80,7 +80,7 @@
Milestones
= nav_link(path: 'groups#merge_requests') do
= sidebar_link merge_requests_group_path(@group), title: _('Merge Requests') do
= link_to merge_requests_group_path(@group) do
.nav-icon-container
= custom_icon('mr_bold')
%span.nav-item-name
......@@ -93,7 +93,7 @@
#{ _('Merge Requests') }
%span.badge.count.merge_counter.js-merge-counter.fly-out-badge= number_with_delimiter(merge_requests.count)
= nav_link(path: 'group_members#index') do
= sidebar_link group_group_members_path(@group), title: _('Members') do
= link_to group_group_members_path(@group) do
.nav-icon-container
= custom_icon('members')
%span.nav-item-name
......@@ -105,7 +105,7 @@
#{ _('Members') }
- if current_user && can?(current_user, :admin_group, @group)
= nav_link(path: %w[groups#projects groups#edit ci_cd#show ldap_group_links#index hooks#index audit_events#index pipeline_quota#index]) do
= sidebar_link edit_group_path(@group), title: _('Settings') do
= link_to edit_group_path(@group) do
.nav-icon-container
= custom_icon('settings')
%span.nav-item-name
......
......@@ -7,7 +7,7 @@
.sidebar-context-title User Settings
%ul.sidebar-top-level-items
= nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
= sidebar_link profile_path, title: _('Profile Settings') do
= link_to profile_path do
.nav-icon-container
= custom_icon('profile')
%span.nav-item-name
......@@ -18,7 +18,7 @@
%strong.fly-out-top-item-name
#{ _('Profile') }
= nav_link(controller: [:accounts, :two_factor_auths]) do
= sidebar_link profile_account_path, title: _('Account') do
= link_to profile_account_path do
.nav-icon-container
= custom_icon('account')
%span.nav-item-name
......@@ -30,7 +30,7 @@
#{ _('Account') }
- if current_application_settings.should_check_namespace_plan?
= nav_link(controller: :billings) do
= sidebar_link profile_billings_path, title: _('Billing') do
= link_to profile_billings_path do
.nav-icon-container
= custom_icon('credit_card')
%span.nav-item-name
......@@ -42,7 +42,7 @@
#{ _('Billing') }
- if current_application_settings.user_oauth_applications?
= nav_link(controller: 'oauth/applications') do
= sidebar_link applications_profile_path, title: _('Applications') do
= link_to applications_profile_path do
.nav-icon-container
= custom_icon('applications')
%span.nav-item-name
......@@ -53,7 +53,7 @@
%strong.fly-out-top-item-name
#{ _('Applications') }
= nav_link(controller: :chat_names) do
= sidebar_link profile_chat_names_path, title: _('Chat') do
= link_to profile_chat_names_path do
.nav-icon-container
= custom_icon('chat')
%span.nav-item-name
......@@ -64,7 +64,7 @@
%strong.fly-out-top-item-name
#{ _('Chat') }
= nav_link(controller: :personal_access_tokens) do
= sidebar_link profile_personal_access_tokens_path, title: _('Access Tokens') do
= link_to profile_personal_access_tokens_path do
.nav-icon-container
= custom_icon('access_tokens')
%span.nav-item-name
......@@ -75,7 +75,7 @@
%strong.fly-out-top-item-name
#{ _('Access Tokens') }
= nav_link(controller: :emails) do
= sidebar_link profile_emails_path, title: _('Emails') do
= link_to profile_emails_path do
.nav-icon-container
= custom_icon('emails')
%span.nav-item-name
......@@ -87,7 +87,7 @@
#{ _('Emails') }
- unless current_user.ldap_user?
= nav_link(controller: :passwords) do
= sidebar_link edit_profile_password_path, title: _('Password') do
= link_to edit_profile_password_path do
.nav-icon-container
= custom_icon('lock')
%span.nav-item-name
......@@ -98,7 +98,7 @@
%strong.fly-out-top-item-name
#{ _('Password') }
= nav_link(controller: :notifications) do
= sidebar_link profile_notifications_path, title: _('Notifications') do
= link_to profile_notifications_path do
.nav-icon-container
= custom_icon('notifications')
%span.nav-item-name
......@@ -109,7 +109,7 @@
%strong.fly-out-top-item-name
#{ _('Notifications') }
= nav_link(controller: :keys) do
= sidebar_link profile_keys_path, title: _('SSH Keys') do
= link_to profile_keys_path do
.nav-icon-container
= custom_icon('key')
%span.nav-item-name
......@@ -120,7 +120,7 @@
%strong.fly-out-top-item-name
#{ _('SSH Keys') }
= nav_link(controller: :gpg_keys) do
= sidebar_link profile_gpg_keys_path, title: _('GPG Keys') do
= link_to profile_gpg_keys_path do
.nav-icon-container
= custom_icon('key_2')
%span.nav-item-name
......@@ -131,7 +131,7 @@
%strong.fly-out-top-item-name
#{ _('GPG Keys') }
= nav_link(controller: :preferences) do
= sidebar_link profile_preferences_path, title: _('Preferences') do
= link_to profile_preferences_path do
.nav-icon-container
= custom_icon('preferences')
%span.nav-item-name
......@@ -142,7 +142,7 @@
%strong.fly-out-top-item-name
#{ _('Preferences') }
= nav_link(path: 'profiles#audit_log') do
= sidebar_link audit_log_profile_path, title: _('Authentication log') do
= link_to audit_log_profile_path do
.nav-icon-container
= custom_icon('authentication_log')
%span.nav-item-name
......@@ -153,7 +153,7 @@
%strong.fly-out-top-item-name
#{ _('Authentication Log') }
= nav_link(path: 'profiles#pipeline_quota') do
= sidebar_link profile_pipeline_quota_path, title: _('Pipeline quota') do
= link_to profile_pipeline_quota_path do
.nav-icon-container
= custom_icon('pipeline')
%span.nav-item-name
......
......@@ -9,7 +9,7 @@
= @project.name
%ul.sidebar-top-level-items
= nav_link(path: ['projects#show', 'projects#activity', 'cycle_analytics#show'], html_options: { class: 'home' }) do
= sidebar_link project_path(@project), title: _('Project overview'), css: 'shortcuts-project' do
= link_to project_path(@project), class: 'shortcuts-project' do
.nav-icon-container
= custom_icon('project')
%span.nav-item-name
......@@ -36,7 +36,7 @@
- if project_nav_tab? :files
= nav_link(controller: %w(tree blob blame edit_tree new_tree find_file commit commits compare projects/repositories tags branches releases graphs network path_locks)) do
= sidebar_link project_tree_path(@project), title: _('Repository'), css: 'shortcuts-tree' do
= link_to project_tree_path(@project), class: 'shortcuts-tree' do
.nav-icon-container
= custom_icon('doc_text')
%span.nav-item-name
......@@ -87,7 +87,7 @@
- if project_nav_tab? :container_registry
= nav_link(controller: %w[projects/registry/repositories]) do
= sidebar_link project_container_registry_index_path(@project), title: _('Container Registry'), css: 'shortcuts-container-registry' do
= link_to project_container_registry_index_path(@project), class: 'shortcuts-container-registry' do
.nav-icon-container
= custom_icon('container_registry')
%span.nav-item-name
......@@ -100,7 +100,7 @@
- if project_nav_tab? :issues
= nav_link(controller: @project.issues_enabled? ? [:issues, :labels, :milestones, :boards] : :issues) do
= sidebar_link project_issues_path(@project), title: _('Issues'), css: 'shortcuts-issues' do
= link_to project_issues_path(@project), class: 'shortcuts-issues' do
.nav-icon-container
= custom_icon('issues')
%span.nav-item-name
......@@ -159,7 +159,7 @@
- if project_nav_tab? :merge_requests
= nav_link(controller: @project.issues_enabled? ? :merge_requests : [:merge_requests, :labels, :milestones]) do
= sidebar_link project_merge_requests_path(@project), title: _('Merge Requests'), css: 'shortcuts-merge_requests' do
= link_to project_merge_requests_path(@project), class: 'shortcuts-merge_requests' do
.nav-icon-container
= custom_icon('mr_bold')
%span.nav-item-name
......@@ -176,7 +176,7 @@
- if project_nav_tab? :pipelines
= nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :environments, :artifacts]) do
= sidebar_link project_pipelines_path(@project), title: _('CI / CD'), css: 'shortcuts-pipelines' do
= link_to project_pipelines_path(@project), class: 'shortcuts-pipelines' do
.nav-icon-container
= custom_icon('pipeline')
%span.nav-item-name
......@@ -220,7 +220,7 @@
- if project_nav_tab? :wiki
= nav_link(controller: :wikis) do
= sidebar_link get_project_wiki_path(@project), title: _('Wiki'), css: 'shortcuts-wiki' do
= link_to get_project_wiki_path(@project), class: 'shortcuts-wiki' do
.nav-icon-container
= custom_icon('wiki')
%span.nav-item-name
......@@ -233,7 +233,7 @@
- if project_nav_tab? :snippets
= nav_link(controller: :snippets) do
= sidebar_link project_snippets_path(@project), title: _('Snippets'), css: 'shortcuts-snippets' do
= link_to project_snippets_path(@project), class: 'shortcuts-snippets' do
.nav-icon-container
= custom_icon('snippets')
%span.nav-item-name
......@@ -246,7 +246,7 @@
- if project_nav_tab? :settings
= nav_link(path: %w[projects#edit project_members#index integrations#show services#edit repository#show ci_cd#show pages#show audit_events#index]) do
= sidebar_link edit_project_path(@project), title: _('Settings'), css: 'shortcuts-tree' do
= link_to edit_project_path(@project), class: 'shortcuts-tree' do
.nav-icon-container
= custom_icon('settings')
%span.nav-item-name
......
......@@ -47,7 +47,7 @@ feature 'Groups > Audit Events', :js do
end
# This is to avoid a Capybara::Poltergeist::MouseEventFailed error
find('a[aria-label=Settings]').trigger('click')
find(:link, text: 'Settings').trigger('click')
click_link 'Audit Events'
......
......@@ -25,7 +25,7 @@ feature 'Group merge requests page' do
end
it 'ignores archived merge request count badges in navbar' do
expect( page.find('[aria-label="Merge Requests"] span.badge.count').text).to eq("1")
expect(first(:link, text: 'Merge Requests').find('.badge').text).to eq("1")
end
it 'ignores archived merge request count badges in state-filters' do
......
......@@ -98,7 +98,7 @@ feature 'Projects > Audit Events', :js do
end
# This is to avoid a Capybara::Poltergeist::MouseEventFailed error
find('a[aria-label=Settings]').trigger('click')
find(:link, text: 'Settings').trigger('click')
click_link 'Audit Events'
......
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