Commit b5a77392 authored by Phil Hughes's avatar Phil Hughes

Fix the fly-out menu in the sidebar not displaying in Safari

parent de0d0e4e
...@@ -15,6 +15,10 @@ export const setOpenMenu = (menu = null) => { currentOpenMenu = menu; }; ...@@ -15,6 +15,10 @@ export const setOpenMenu = (menu = null) => { currentOpenMenu = menu; };
export const slope = (a, b) => (b.y - a.y) / (b.x - a.x); export const slope = (a, b) => (b.y - a.y) / (b.x - a.x);
let headerHeight = 50;
export const getHeaderHeight = () => headerHeight;
export const canShowActiveSubItems = (el) => { export const canShowActiveSubItems = (el) => {
const isHiddenByMedia = bp.getBreakpointSize() === 'sm' || bp.getBreakpointSize() === 'md'; const isHiddenByMedia = bp.getBreakpointSize() === 'sm' || bp.getBreakpointSize() === 'md';
...@@ -74,7 +78,7 @@ export const moveSubItemsToPosition = (el, subItems) => { ...@@ -74,7 +78,7 @@ export const moveSubItemsToPosition = (el, subItems) => {
const isAbove = top < boundingRect.top; const isAbove = top < boundingRect.top;
subItems.classList.add('fly-out-list'); subItems.classList.add('fly-out-list');
subItems.style.transform = `translate3d(0, ${Math.floor(top)}px, 0)`; // eslint-disable-line no-param-reassign subItems.style.transform = `translate3d(0, ${Math.floor(top) - headerHeight}px, 0)`; // eslint-disable-line no-param-reassign
const subItemsRect = subItems.getBoundingClientRect(); const subItemsRect = subItems.getBoundingClientRect();
...@@ -153,6 +157,8 @@ export default () => { ...@@ -153,6 +157,8 @@ export default () => {
}, getHideSubItemsInterval()); }, getHideSubItemsInterval());
}); });
headerHeight = document.querySelector('.nav-sidebar').offsetTop;
items.forEach((el) => { items.forEach((el) => {
const subItems = el.querySelector('.sidebar-sub-level-items'); const subItems = el.querySelector('.sidebar-sub-level-items');
......
...@@ -97,9 +97,9 @@ $new-sidebar-collapsed-width: 50px; ...@@ -97,9 +97,9 @@ $new-sidebar-collapsed-width: 50px;
top: $header-height; top: $header-height;
bottom: 0; bottom: 0;
left: 0; left: 0;
overflow: auto;
background-color: $gray-normal; background-color: $gray-normal;
box-shadow: inset -2px 0 0 $border-color; box-shadow: inset -2px 0 0 $border-color;
transform: translate3d(0, 0, 0);
&.sidebar-icons-only { &.sidebar-icons-only {
width: $new-sidebar-collapsed-width; width: $new-sidebar-collapsed-width;
...@@ -176,6 +176,12 @@ $new-sidebar-collapsed-width: 50px; ...@@ -176,6 +176,12 @@ $new-sidebar-collapsed-width: 50px;
} }
} }
.nav-sidebar-inner-scroll {
height: 100%;
width: 100%;
overflow: auto;
}
.with-performance-bar .nav-sidebar { .with-performance-bar .nav-sidebar {
top: $header-height + $performance-bar-height; top: $header-height + $performance-bar-height;
} }
......
.nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) } .nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) }
.context-header .nav-sidebar-inner-scroll
= link_to admin_root_path, title: 'Admin Overview' do .context-header
.avatar-container.s40.settings-avatar = link_to admin_root_path, title: 'Admin Overview' do
= icon('wrench') .avatar-container.s40.settings-avatar
.project-title Admin Area = icon('wrench')
%ul.sidebar-top-level-items .project-title Admin Area
= nav_link(controller: %w(dashboard admin projects users groups jobs runners cohorts), html_options: {class: 'home'}) do %ul.sidebar-top-level-items
= link_to admin_root_path, title: 'Overview', class: 'shortcuts-tree' do = nav_link(controller: %w(dashboard admin projects users groups jobs runners cohorts), html_options: {class: 'home'}) do
.nav-icon-container = link_to admin_root_path, title: 'Overview', class: 'shortcuts-tree' do
= custom_icon('overview') .nav-icon-container
%span.nav-item-name = custom_icon('overview')
Overview %span.nav-item-name
Overview
%ul.sidebar-sub-level-items
= nav_link(controller: :dashboard, html_options: {class: 'home'}) do
= link_to admin_root_path, title: 'Overview' do
%span
Dashboard
= nav_link(controller: [:admin, :projects]) do
= link_to admin_projects_path, title: 'Projects' do
%span
Projects
= nav_link(controller: :users) do
= link_to admin_users_path, title: 'Users' do
%span
Users
= nav_link(controller: :groups) do
= link_to admin_groups_path, title: 'Groups' do
%span
Groups
= nav_link path: 'jobs#index' do
= link_to admin_jobs_path, title: 'Jobs' do
%span
Jobs
= nav_link path: ['runners#index', 'runners#show'] do
= link_to admin_runners_path, title: 'Runners' do
%span
Runners
= nav_link path: 'cohorts#index' do
= link_to admin_cohorts_path, title: 'Cohorts' do
%span
Cohorts
= nav_link(controller: %w(conversational_development_index system_info background_jobs logs health_check requests_profiles)) do %ul.sidebar-sub-level-items
= link_to admin_conversational_development_index_path, title: 'Monitoring' do = nav_link(controller: :dashboard, html_options: {class: 'home'}) do
.nav-icon-container = link_to admin_root_path, title: 'Overview' do
= custom_icon('monitoring') %span
%span.nav-item-name Dashboard
Monitoring = nav_link(controller: [:admin, :projects]) do
= link_to admin_projects_path, title: 'Projects' do
%span
Projects
= nav_link(controller: :users) do
= link_to admin_users_path, title: 'Users' do
%span
Users
= nav_link(controller: :groups) do
= link_to admin_groups_path, title: 'Groups' do
%span
Groups
= nav_link path: 'jobs#index' do
= link_to admin_jobs_path, title: 'Jobs' do
%span
Jobs
= nav_link path: ['runners#index', 'runners#show'] do
= link_to admin_runners_path, title: 'Runners' do
%span
Runners
= nav_link path: 'cohorts#index' do
= link_to admin_cohorts_path, title: 'Cohorts' do
%span
Cohorts
%ul.sidebar-sub-level-items = nav_link(controller: %w(conversational_development_index system_info background_jobs logs health_check requests_profiles)) do
= nav_link(controller: :conversational_development_index) do = link_to admin_conversational_development_index_path, title: 'Monitoring' do
= link_to admin_conversational_development_index_path, title: 'ConvDev Index' do .nav-icon-container
%span = custom_icon('monitoring')
ConvDev Index %span.nav-item-name
= nav_link(controller: :system_info) do Monitoring
= link_to admin_system_info_path, title: 'System Info' do
%span
System Info
= nav_link(controller: :background_jobs) do
= link_to admin_background_jobs_path, title: 'Background Jobs' do
%span
Background Jobs
= nav_link(controller: :logs) do
= link_to admin_logs_path, title: 'Logs' do
%span
Logs
= nav_link(controller: :health_check) do
= link_to admin_health_check_path, title: 'Health Check' do
%span
Health Check
= nav_link(controller: :requests_profiles) do
= link_to admin_requests_profiles_path, title: 'Requests Profiles' do
%span
Requests Profiles
= nav_link(controller: :broadcast_messages) do %ul.sidebar-sub-level-items
= link_to admin_broadcast_messages_path, title: 'Messages' do = nav_link(controller: :conversational_development_index) do
.nav-icon-container = link_to admin_conversational_development_index_path, title: 'ConvDev Index' do
= custom_icon('messages') %span
%span.nav-item-name ConvDev Index
Messages = nav_link(controller: :system_info) do
= nav_link(controller: [:hooks, :hook_logs]) do = link_to admin_system_info_path, title: 'System Info' do
= link_to admin_hooks_path, title: 'Hooks' do %span
.nav-icon-container System Info
= custom_icon('system_hooks') = nav_link(controller: :background_jobs) do
%span.nav-item-name = link_to admin_background_jobs_path, title: 'Background Jobs' do
System Hooks %span
Background Jobs
= nav_link(controller: :logs) do
= link_to admin_logs_path, title: 'Logs' do
%span
Logs
= nav_link(controller: :health_check) do
= link_to admin_health_check_path, title: 'Health Check' do
%span
Health Check
= nav_link(controller: :requests_profiles) do
= link_to admin_requests_profiles_path, title: 'Requests Profiles' do
%span
Requests Profiles
= nav_link(controller: :applications) do = nav_link(controller: :broadcast_messages) do
= link_to admin_applications_path, title: 'Applications' do = link_to admin_broadcast_messages_path, title: 'Messages' do
.nav-icon-container .nav-icon-container
= custom_icon('applications') = custom_icon('messages')
%span.nav-item-name %span.nav-item-name
Applications Messages
= nav_link(controller: [:hooks, :hook_logs]) do
= link_to admin_hooks_path, title: 'Hooks' do
.nav-icon-container
= custom_icon('system_hooks')
%span.nav-item-name
System Hooks
= nav_link(controller: :abuse_reports) do = nav_link(controller: :applications) do
= link_to admin_abuse_reports_path, title: "Abuse Reports" do = link_to admin_applications_path, title: 'Applications' do
.nav-icon-container .nav-icon-container
= custom_icon('abuse_reports') = custom_icon('applications')
%span.nav-item-name %span.nav-item-name
Abuse Reports Applications
%span.badge.count= number_with_delimiter(AbuseReport.count(:all))
- if akismet_enabled? = nav_link(controller: :abuse_reports) do
= nav_link(controller: :spam_logs) do = link_to admin_abuse_reports_path, title: "Abuse Reports" do
= link_to admin_spam_logs_path, title: "Spam Logs" do
.nav-icon-container .nav-icon-container
= custom_icon('spam_logs') = custom_icon('abuse_reports')
%span.nav-item-name %span.nav-item-name
Spam Logs Abuse Reports
%span.badge.count= number_with_delimiter(AbuseReport.count(:all))
= nav_link(controller: :deploy_keys) do - if akismet_enabled?
= link_to admin_deploy_keys_path, title: 'Deploy Keys' do = nav_link(controller: :spam_logs) do
.nav-icon-container = link_to admin_spam_logs_path, title: "Spam Logs" do
= custom_icon('key') .nav-icon-container
%span.nav-item-name = custom_icon('spam_logs')
Deploy Keys %span.nav-item-name
Spam Logs
= nav_link(controller: :services) do = nav_link(controller: :deploy_keys) do
= link_to admin_application_settings_services_path, title: 'Service Templates' do = link_to admin_deploy_keys_path, title: 'Deploy Keys' do
.nav-icon-container .nav-icon-container
= custom_icon('service_templates') = custom_icon('key')
%span.nav-item-name %span.nav-item-name
Service Templates Deploy Keys
= nav_link(controller: :labels) do = nav_link(controller: :services) do
= link_to admin_labels_path, title: 'Labels' do = link_to admin_application_settings_services_path, title: 'Service Templates' do
.nav-icon-container .nav-icon-container
= custom_icon('labels') = custom_icon('service_templates')
%span.nav-item-name %span.nav-item-name
Labels Service Templates
= nav_link(controller: :appearances) do = nav_link(controller: :labels) do
= link_to admin_appearances_path, title: 'Appearances' do = link_to admin_labels_path, title: 'Labels' do
.nav-icon-container .nav-icon-container
= custom_icon('appearance') = custom_icon('labels')
%span.nav-item-name %span.nav-item-name
Appearance Labels
%li.divider = nav_link(controller: :appearances) do
= nav_link(controller: :application_settings) do = link_to admin_appearances_path, title: 'Appearances' do
= link_to admin_application_settings_path, title: 'Settings' do .nav-icon-container
.nav-icon-container = custom_icon('appearance')
= custom_icon('settings') %span.nav-item-name
%span.nav-item-name Appearance
Settings
%li.divider
= nav_link(controller: :application_settings) do
= link_to admin_application_settings_path, title: 'Settings' do
.nav-icon-container
= custom_icon('settings')
%span.nav-item-name
Settings
= render 'shared/sidebar_toggle_button' = render 'shared/sidebar_toggle_button'
.nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) } .nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) }
.context-header .nav-sidebar-inner-scroll
= link_to group_path(@group), title: @group.name do .context-header
.avatar-container.s40.group-avatar = link_to group_path(@group), title: @group.name do
= image_tag group_icon(@group), class: "avatar s40 avatar-tile" .avatar-container.s40.group-avatar
.group-title = image_tag group_icon(@group), class: "avatar s40 avatar-tile"
= @group.name .group-title
%ul.sidebar-top-level-items = @group.name
= nav_link(path: ['groups#show', 'groups#activity', 'groups#subgroups'], html_options: { class: 'home' }) do %ul.sidebar-top-level-items
= link_to group_path(@group), title: 'Group overview' do = nav_link(path: ['groups#show', 'groups#activity', 'groups#subgroups'], html_options: { class: 'home' }) do
.nav-icon-container = link_to group_path(@group), title: 'Group overview' do
= custom_icon('project') .nav-icon-container
%span.nav-item-name = custom_icon('project')
Overview %span.nav-item-name
Overview
%ul.sidebar-sub-level-items
= nav_link(path: ['groups#show', 'groups#subgroups'], html_options: { class: 'home' }) do
= link_to group_path(@group), title: 'Group details' do
%span
Details
= nav_link(path: 'groups#activity') do
= link_to activity_group_path(@group), title: 'Activity' do
%span
Activity
= nav_link(path: ['groups#issues', 'labels#index', 'milestones#index']) do
= link_to issues_group_path(@group), title: 'Issues' do
.nav-icon-container
= custom_icon('issues')
%span.nav-item-name
- issues = IssuesFinder.new(current_user, group_id: @group.id, state: 'opened').execute
Issues
%span.badge.count= number_with_delimiter(issues.count)
%ul.sidebar-sub-level-items
= nav_link(path: 'groups#issues', html_options: { class: 'home' }) do
= link_to issues_group_path(@group), title: 'List' do
%span
List
= nav_link(path: 'labels#index') do %ul.sidebar-sub-level-items
= link_to group_labels_path(@group), title: 'Labels' do = nav_link(path: ['groups#show', 'groups#subgroups'], html_options: { class: 'home' }) do
%span = link_to group_path(@group), title: 'Group details' do
Labels %span
Details
= nav_link(path: 'milestones#index') do = nav_link(path: 'groups#activity') do
= link_to group_milestones_path(@group), title: 'Milestones' do = link_to activity_group_path(@group), title: 'Activity' do
%span %span
Milestones Activity
= nav_link(path: 'groups#merge_requests') do = nav_link(path: ['groups#issues', 'labels#index', 'milestones#index']) do
= link_to merge_requests_group_path(@group), title: 'Merge Requests' do = link_to issues_group_path(@group), title: 'Issues' do
.nav-icon-container
= custom_icon('mr_bold')
%span.nav-item-name
- merge_requests = MergeRequestsFinder.new(current_user, group_id: @group.id, state: 'opened', non_archived: true).execute
Merge Requests
%span.badge.count= number_with_delimiter(merge_requests.count)
= nav_link(path: 'group_members#index') do
= link_to group_group_members_path(@group), title: 'Members' do
.nav-icon-container
= custom_icon('members')
%span.nav-item-name
Members
- if current_user && can?(current_user, :admin_group, @group)
= nav_link(path: %w[groups#projects groups#edit ci_cd#show]) do
= link_to edit_group_path(@group), title: 'Settings' do
.nav-icon-container .nav-icon-container
= custom_icon('settings') = custom_icon('issues')
%span.nav-item-name %span.nav-item-name
Settings - issues = IssuesFinder.new(current_user, group_id: @group.id, state: 'opened').execute
Issues
%span.badge.count= number_with_delimiter(issues.count)
%ul.sidebar-sub-level-items %ul.sidebar-sub-level-items
= nav_link(path: 'groups#edit') do = nav_link(path: 'groups#issues', html_options: { class: 'home' }) do
= link_to edit_group_path(@group), title: 'General' do = link_to issues_group_path(@group), title: 'List' do
%span %span
General List
= nav_link(path: 'groups#projects') do = nav_link(path: 'labels#index') do
= link_to projects_group_path(@group), title: 'Projects' do = link_to group_labels_path(@group), title: 'Labels' do
%span %span
Projects Labels
= nav_link(controller: :ci_cd) do = nav_link(path: 'milestones#index') do
= link_to group_settings_ci_cd_path(@group), title: 'CI / CD' do = link_to group_milestones_path(@group), title: 'Milestones' do
%span %span
CI / CD Milestones
= nav_link(path: 'groups#merge_requests') do
= link_to merge_requests_group_path(@group), title: 'Merge Requests' do
.nav-icon-container
= custom_icon('mr_bold')
%span.nav-item-name
- merge_requests = MergeRequestsFinder.new(current_user, group_id: @group.id, state: 'opened', non_archived: true).execute
Merge Requests
%span.badge.count= number_with_delimiter(merge_requests.count)
= nav_link(path: 'group_members#index') do
= link_to group_group_members_path(@group), title: 'Members' do
.nav-icon-container
= custom_icon('members')
%span.nav-item-name
Members
- if current_user && can?(current_user, :admin_group, @group)
= nav_link(path: %w[groups#projects groups#edit ci_cd#show]) do
= link_to edit_group_path(@group), title: 'Settings' do
.nav-icon-container
= custom_icon('settings')
%span.nav-item-name
Settings
%ul.sidebar-sub-level-items
= nav_link(path: 'groups#edit') do
= link_to edit_group_path(@group), title: 'General' do
%span
General
= nav_link(path: 'groups#projects') do
= link_to projects_group_path(@group), title: 'Projects' do
%span
Projects
= nav_link(controller: :ci_cd) do
= link_to group_settings_ci_cd_path(@group), title: 'CI / CD' do
%span
CI / CD
= render 'shared/sidebar_toggle_button' = render 'shared/sidebar_toggle_button'
.nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) } .nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) }
.context-header .nav-sidebar-inner-scroll
= link_to profile_path, title: 'Profile Settings' do .context-header
.avatar-container.s40.settings-avatar
= icon('user')
.project-title User Settings
%ul.sidebar-top-level-items
= nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
= link_to profile_path, title: 'Profile Settings' do = link_to profile_path, title: 'Profile Settings' do
.nav-icon-container .avatar-container.s40.settings-avatar
= custom_icon('profile') = icon('user')
%span.nav-item-name .project-title User Settings
Profile %ul.sidebar-top-level-items
= nav_link(controller: [:accounts, :two_factor_auths]) do = nav_link(path: 'profiles#show', html_options: {class: 'home'}) do
= link_to profile_account_path, title: 'Account' do = link_to profile_path, title: 'Profile Settings' do
.nav-icon-container
= custom_icon('account')
%span.nav-item-name
Account
- if current_application_settings.user_oauth_applications?
= nav_link(controller: 'oauth/applications') do
= link_to applications_profile_path, title: 'Applications' do
.nav-icon-container .nav-icon-container
= custom_icon('applications') = custom_icon('profile')
%span.nav-item-name %span.nav-item-name
Applications Profile
= nav_link(controller: :chat_names) do = nav_link(controller: [:accounts, :two_factor_auths]) do
= link_to profile_chat_names_path, title: 'Chat' do = link_to profile_account_path, title: 'Account' do
.nav-icon-container
= custom_icon('chat')
%span.nav-item-name
Chat
= nav_link(controller: :personal_access_tokens) do
= link_to profile_personal_access_tokens_path, title: 'Access Tokens' do
.nav-icon-container
= custom_icon('access_tokens')
%span.nav-item-name
Access Tokens
= nav_link(controller: :emails) do
= link_to profile_emails_path, title: 'Emails' do
.nav-icon-container
= custom_icon('emails')
%span.nav-item-name
Emails
- unless current_user.ldap_user?
= nav_link(controller: :passwords) do
= link_to edit_profile_password_path, title: 'Password' do
.nav-icon-container .nav-icon-container
= custom_icon('lock') = custom_icon('account')
%span.nav-item-name %span.nav-item-name
Password Account
= nav_link(controller: :notifications) do - if current_application_settings.user_oauth_applications?
= link_to profile_notifications_path, title: 'Notifications' do = nav_link(controller: 'oauth/applications') do
.nav-icon-container = link_to applications_profile_path, title: 'Applications' do
= custom_icon('notifications') .nav-icon-container
%span.nav-item-name = custom_icon('applications')
Notifications %span.nav-item-name
Applications
= nav_link(controller: :chat_names) do
= link_to profile_chat_names_path, title: 'Chat' do
.nav-icon-container
= custom_icon('chat')
%span.nav-item-name
Chat
= nav_link(controller: :personal_access_tokens) do
= link_to profile_personal_access_tokens_path, title: 'Access Tokens' do
.nav-icon-container
= custom_icon('access_tokens')
%span.nav-item-name
Access Tokens
= nav_link(controller: :emails) do
= link_to profile_emails_path, title: 'Emails' do
.nav-icon-container
= custom_icon('emails')
%span.nav-item-name
Emails
- unless current_user.ldap_user?
= nav_link(controller: :passwords) do
= link_to edit_profile_password_path, title: 'Password' do
.nav-icon-container
= custom_icon('lock')
%span.nav-item-name
Password
= nav_link(controller: :notifications) do
= link_to profile_notifications_path, title: 'Notifications' do
.nav-icon-container
= custom_icon('notifications')
%span.nav-item-name
Notifications
= nav_link(controller: :keys) do = nav_link(controller: :keys) do
= link_to profile_keys_path, title: 'SSH Keys' do = link_to profile_keys_path, title: 'SSH Keys' do
.nav-icon-container .nav-icon-container
= custom_icon('key') = custom_icon('key')
%span.nav-item-name %span.nav-item-name
SSH Keys SSH Keys
= nav_link(controller: :gpg_keys) do = nav_link(controller: :gpg_keys) do
= link_to profile_gpg_keys_path, title: 'GPG Keys' do = link_to profile_gpg_keys_path, title: 'GPG Keys' do
.nav-icon-container .nav-icon-container
= custom_icon('key_2') = custom_icon('key_2')
%span.nav-item-name %span.nav-item-name
GPG Keys GPG Keys
= nav_link(controller: :preferences) do = nav_link(controller: :preferences) do
= link_to profile_preferences_path, title: 'Preferences' do = link_to profile_preferences_path, title: 'Preferences' do
.nav-icon-container .nav-icon-container
= custom_icon('preferences') = custom_icon('preferences')
%span.nav-item-name %span.nav-item-name
Preferences Preferences
= nav_link(path: 'profiles#audit_log') do = nav_link(path: 'profiles#audit_log') do
= link_to audit_log_profile_path, title: 'Authentication log' do = link_to audit_log_profile_path, title: 'Authentication log' do
.nav-icon-container .nav-icon-container
= custom_icon('authentication_log') = custom_icon('authentication_log')
%span.nav-item-name %span.nav-item-name
Authentication log Authentication log
= render 'shared/sidebar_toggle_button' = render 'shared/sidebar_toggle_button'
.nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) } .nav-sidebar{ class: ("sidebar-icons-only" if collapsed_sidebar?) }
- can_edit = can?(current_user, :admin_project, @project) .nav-sidebar-inner-scroll
.context-header - can_edit = can?(current_user, :admin_project, @project)
= link_to project_path(@project), title: @project.name do .context-header
.avatar-container.s40.project-avatar = link_to project_path(@project), title: @project.name do
= project_icon(@project, alt: @project.name, class: 'avatar s40 avatar-tile') .avatar-container.s40.project-avatar
.project-title = project_icon(@project, alt: @project.name, class: 'avatar s40 avatar-tile')
= @project.name .project-title
%ul.sidebar-top-level-items = @project.name
= nav_link(path: ['projects#show', 'projects#activity', 'cycle_analytics#show'], html_options: { class: 'home' }) do %ul.sidebar-top-level-items
= link_to project_path(@project), title: 'Project overview', class: 'shortcuts-project' do = nav_link(path: ['projects#show', 'projects#activity', 'cycle_analytics#show'], html_options: { class: 'home' }) do
.nav-icon-container = link_to project_path(@project), title: 'Project overview', class: 'shortcuts-project' do
= custom_icon('project')
%span.nav-item-name
Overview
%ul.sidebar-sub-level-items
= nav_link(path: 'projects#show') do
= link_to project_path(@project), title: _('Project details'), class: 'shortcuts-project' do
%span= _('Details')
= nav_link(path: 'projects#activity') do
= link_to activity_project_path(@project), title: _('Activity'), class: 'shortcuts-project-activity' do
%span= _('Activity')
- if can?(current_user, :read_cycle_analytics, @project)
= nav_link(path: 'cycle_analytics#show') do
= link_to project_cycle_analytics_path(@project), title: _('Cycle Analytics'), class: 'shortcuts-project-cycle-analytics' do
%span= _('Cycle Analytics')
- 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)) do
= link_to project_tree_path(@project), title: 'Repository', class: 'shortcuts-tree' do
.nav-icon-container .nav-icon-container
= custom_icon('doc_text') = custom_icon('project')
%span.nav-item-name %span.nav-item-name
Repository Overview
%ul.sidebar-sub-level-items %ul.sidebar-sub-level-items
= nav_link(controller: %w(tree blob blame edit_tree new_tree find_file)) do = nav_link(path: 'projects#show') do
= link_to project_tree_path(@project) do = link_to project_path(@project), title: _('Project details'), class: 'shortcuts-project' do
#{ _('Files') } %span= _('Details')
= nav_link(controller: [:commit, :commits]) do = nav_link(path: 'projects#activity') do
= link_to project_commits_path(@project, current_ref) do = link_to activity_project_path(@project), title: _('Activity'), class: 'shortcuts-project-activity' do
#{ _('Commits') } %span= _('Activity')
= nav_link(html_options: {class: branches_tab_class}) do - if can?(current_user, :read_cycle_analytics, @project)
= link_to project_branches_path(@project) do = nav_link(path: 'cycle_analytics#show') do
#{ _('Branches') } = link_to project_cycle_analytics_path(@project), title: _('Cycle Analytics'), class: 'shortcuts-project-cycle-analytics' do
%span= _('Cycle Analytics')
= nav_link(controller: [:tags, :releases]) do
= link_to project_tags_path(@project) do - if project_nav_tab? :files
#{ _('Tags') } = nav_link(controller: %w(tree blob blame edit_tree new_tree find_file commit commits compare projects/repositories tags branches releases graphs network)) do
= link_to project_tree_path(@project), title: 'Repository', class: 'shortcuts-tree' do
= nav_link(path: 'graphs#show') do .nav-icon-container
= link_to project_graph_path(@project, current_ref) do = custom_icon('doc_text')
#{ _('Contributors') } %span.nav-item-name
Repository
= nav_link(controller: %w(network)) do
= link_to project_network_path(@project, current_ref) do %ul.sidebar-sub-level-items
#{ s_('ProjectNetworkGraph|Graph') } = nav_link(controller: %w(tree blob blame edit_tree new_tree find_file)) do
= link_to project_tree_path(@project) do
= nav_link(controller: :compare) do #{ _('Files') }
= link_to project_compare_index_path(@project, from: @repository.root_ref, to: current_ref) do
#{ _('Compare') } = nav_link(controller: [:commit, :commits]) do
= link_to project_commits_path(@project, current_ref) do
= nav_link(path: 'graphs#charts') do #{ _('Commits') }
= link_to charts_project_graph_path(@project, current_ref) do
#{ _('Charts') } = nav_link(html_options: {class: branches_tab_class}) do
= link_to project_branches_path(@project) do
- if project_nav_tab? :container_registry #{ _('Branches') }
= nav_link(controller: %w[projects/registry/repositories]) do
= link_to project_container_registry_index_path(@project), title: 'Container Registry', class: 'shortcuts-container-registry' do = nav_link(controller: [:tags, :releases]) do
.nav-icon-container = link_to project_tags_path(@project) do
= custom_icon('container_registry') #{ _('Tags') }
%span.nav-item-name
Registry = nav_link(path: 'graphs#show') do
= link_to project_graph_path(@project, current_ref) do
- if project_nav_tab? :issues #{ _('Contributors') }
= nav_link(controller: @project.issues_enabled? ? [:issues, :labels, :milestones, :boards] : :issues) do
= link_to project_issues_path(@project), title: 'Issues', class: 'shortcuts-issues' do = nav_link(controller: %w(network)) do
.nav-icon-container = link_to project_network_path(@project, current_ref) do
= custom_icon('issues') #{ s_('ProjectNetworkGraph|Graph') }
%span.nav-item-name
Issues = nav_link(controller: :compare) do
- if @project.issues_enabled? = link_to project_compare_index_path(@project, from: @repository.root_ref, to: current_ref) do
%span.badge.count.issue_counter= number_with_delimiter(IssuesFinder.new(current_user, project_id: @project.id).execute.opened.count) #{ _('Compare') }
%ul.sidebar-sub-level-items = nav_link(path: 'graphs#charts') do
= nav_link(controller: :issues) do = link_to charts_project_graph_path(@project, current_ref) do
= link_to project_issues_path(@project), title: 'Issues' do #{ _('Charts') }
%span
List - if project_nav_tab? :container_registry
= nav_link(controller: %w[projects/registry/repositories]) do
= nav_link(controller: :boards) do = link_to project_container_registry_index_path(@project), title: 'Container Registry', class: 'shortcuts-container-registry' do
= link_to project_boards_path(@project), title: 'Board' do .nav-icon-container
%span = custom_icon('container_registry')
Board %span.nav-item-name
Registry
= nav_link(controller: :labels) do
= link_to project_labels_path(@project), title: 'Labels' do - if project_nav_tab? :issues
%span = nav_link(controller: @project.issues_enabled? ? [:issues, :labels, :milestones, :boards] : :issues) do
Labels = link_to project_issues_path(@project), title: 'Issues', class: 'shortcuts-issues' do
.nav-icon-container
= nav_link(controller: :milestones) do = custom_icon('issues')
= link_to project_milestones_path(@project), title: 'Milestones' do %span.nav-item-name
%span Issues
Milestones - if @project.issues_enabled?
%span.badge.count.issue_counter= number_with_delimiter(IssuesFinder.new(current_user, project_id: @project.id).execute.opened.count)
- if project_nav_tab? :merge_requests
= nav_link(controller: @project.issues_enabled? ? :merge_requests : [:merge_requests, :labels, :milestones]) do %ul.sidebar-sub-level-items
= link_to project_merge_requests_path(@project), title: 'Merge Requests', class: 'shortcuts-merge_requests' do = nav_link(controller: :issues) do
.nav-icon-container = link_to project_issues_path(@project), title: 'Issues' do
= custom_icon('mr_bold')
%span.nav-item-name
Merge Requests
%span.badge.count.merge_counter.js-merge-counter= number_with_delimiter(MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened.count)
- if project_nav_tab? :pipelines
= nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :environments, :artifacts]) do
= link_to project_pipelines_path(@project), title: 'CI / CD', class: 'shortcuts-pipelines' do
.nav-icon-container
= custom_icon('pipeline')
%span.nav-item-name
CI / CD
%ul.sidebar-sub-level-items
- if project_nav_tab? :pipelines
= nav_link(path: ['pipelines#index', 'pipelines#show']) do
= link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do
%span
Pipelines
- if project_nav_tab? :builds
= nav_link(controller: [:jobs, :artifacts]) do
= link_to project_jobs_path(@project), title: 'Jobs', class: 'shortcuts-builds' do
%span %span
Jobs List
- if project_nav_tab? :pipelines = nav_link(controller: :boards) do
= nav_link(controller: :pipeline_schedules) do = link_to project_boards_path(@project), title: 'Board' do
= link_to pipeline_schedules_path(@project), title: 'Schedules', class: 'shortcuts-builds' do
%span %span
Schedules Board
- if project_nav_tab? :environments = nav_link(controller: :labels) do
= nav_link(controller: :environments) do = link_to project_labels_path(@project), title: 'Labels' do
= link_to project_environments_path(@project), title: 'Environments', class: 'shortcuts-environments' do
%span %span
Environments Labels
- if @project.feature_available?(:builds, current_user) && !@project.empty_repo? = nav_link(controller: :milestones) do
= nav_link(path: 'pipelines#charts') do = link_to project_milestones_path(@project), title: 'Milestones' do
= link_to charts_project_pipelines_path(@project), title: 'Charts', class: 'shortcuts-pipelines-charts' do
%span %span
Charts Milestones
- if project_nav_tab? :merge_requests
= nav_link(controller: @project.issues_enabled? ? :merge_requests : [:merge_requests, :labels, :milestones]) do
= link_to project_merge_requests_path(@project), title: 'Merge Requests', class: 'shortcuts-merge_requests' do
.nav-icon-container
= custom_icon('mr_bold')
%span.nav-item-name
Merge Requests
%span.badge.count.merge_counter.js-merge-counter= number_with_delimiter(MergeRequestsFinder.new(current_user, project_id: @project.id).execute.opened.count)
- if project_nav_tab? :pipelines
= nav_link(controller: [:pipelines, :builds, :jobs, :pipeline_schedules, :environments, :artifacts]) do
= link_to project_pipelines_path(@project), title: 'CI / CD', class: 'shortcuts-pipelines' do
.nav-icon-container
= custom_icon('pipeline')
%span.nav-item-name
CI / CD
%ul.sidebar-sub-level-items
- if project_nav_tab? :pipelines
= nav_link(path: ['pipelines#index', 'pipelines#show']) do
= link_to project_pipelines_path(@project), title: 'Pipelines', class: 'shortcuts-pipelines' do
%span
Pipelines
- if project_nav_tab? :wiki - if project_nav_tab? :builds
= nav_link(controller: :wikis) do = nav_link(controller: [:jobs, :artifacts]) do
= link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do = link_to project_jobs_path(@project), title: 'Jobs', class: 'shortcuts-builds' do
.nav-icon-container %span
= custom_icon('wiki') Jobs
%span.nav-item-name
Wiki
- if project_nav_tab? :snippets - if project_nav_tab? :pipelines
= nav_link(controller: :snippets) do = nav_link(controller: :pipeline_schedules) do
= link_to project_snippets_path(@project), title: 'Snippets', class: 'shortcuts-snippets' do = link_to pipeline_schedules_path(@project), title: 'Schedules', class: 'shortcuts-builds' do
.nav-icon-container %span
= custom_icon('snippets') Schedules
%span.nav-item-name
Snippets
- if project_nav_tab? :settings - if project_nav_tab? :environments
= nav_link(path: %w[projects#edit project_members#index integrations#show services#edit repository#show ci_cd#show pages#show]) do = nav_link(controller: :environments) do
= link_to edit_project_path(@project), title: 'Settings', class: 'shortcuts-tree' do = link_to project_environments_path(@project), title: 'Environments', class: 'shortcuts-environments' do
.nav-icon-container %span
= custom_icon('settings') Environments
%span.nav-item-name
Settings
%ul.sidebar-sub-level-items - if @project.feature_available?(:builds, current_user) && !@project.empty_repo?
- can_edit = can?(current_user, :admin_project, @project) = nav_link(path: 'pipelines#charts') do
- if can_edit = link_to charts_project_pipelines_path(@project), title: 'Charts', class: 'shortcuts-pipelines-charts' do
= nav_link(path: %w[projects#edit]) do %span
= link_to edit_project_path(@project), title: 'General' do Charts
%span
General - if project_nav_tab? :wiki
= nav_link(controller: :project_members) do = nav_link(controller: :wikis) do
= link_to project_project_members_path(@project), title: 'Members' do = link_to get_project_wiki_path(@project), title: 'Wiki', class: 'shortcuts-wiki' do
%span .nav-icon-container
Members = custom_icon('wiki')
- if can_edit %span.nav-item-name
= nav_link(controller: [:integrations, :services, :hooks, :hook_logs]) do Wiki
= link_to project_settings_integrations_path(@project), title: 'Integrations' do
%span - if project_nav_tab? :snippets
Integrations = nav_link(controller: :snippets) do
= nav_link(controller: :repository) do = link_to project_snippets_path(@project), title: 'Snippets', class: 'shortcuts-snippets' do
= link_to project_settings_repository_path(@project), title: 'Repository' do .nav-icon-container
= custom_icon('snippets')
%span.nav-item-name
Snippets
- 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]) do
= link_to edit_project_path(@project), title: 'Settings', class: 'shortcuts-tree' do
.nav-icon-container
= custom_icon('settings')
%span.nav-item-name
Settings
%ul.sidebar-sub-level-items
- can_edit = can?(current_user, :admin_project, @project)
- if can_edit
= nav_link(path: %w[projects#edit]) do
= link_to edit_project_path(@project), title: 'General' do
%span
General
= nav_link(controller: :project_members) do
= link_to project_project_members_path(@project), title: 'Members' do
%span %span
Repository Members
- if @project.feature_available?(:builds, current_user) - if can_edit
= nav_link(controller: :ci_cd) do = nav_link(controller: [:integrations, :services, :hooks, :hook_logs]) do
= link_to project_settings_ci_cd_path(@project), title: 'CI / CD' do = link_to project_settings_integrations_path(@project), title: 'Integrations' do
%span %span
CI / CD Integrations
- if Gitlab.config.pages.enabled = nav_link(controller: :repository) do
= nav_link(controller: :pages) do = link_to project_settings_repository_path(@project), title: 'Repository' do
= link_to project_pages_path(@project), title: 'Pages' do
%span %span
Pages Repository
- if @project.feature_available?(:builds, current_user)
- else = nav_link(controller: :ci_cd) do
= nav_link(path: %w[members#show]) do = link_to project_settings_ci_cd_path(@project), title: 'CI / CD' do
= link_to project_settings_members_path(@project), title: 'Members', class: 'shortcuts-tree' do %span
.nav-icon-container CI / CD
= custom_icon('members') - if Gitlab.config.pages.enabled
%span.nav-item-name = nav_link(controller: :pages) do
Members = link_to project_pages_path(@project), title: 'Pages' do
%span
= render 'shared/sidebar_toggle_button' Pages
-# Shortcut to Project > Activity - else
%li.hidden = nav_link(path: %w[members#show]) do
= link_to activity_project_path(@project), title: 'Activity', class: 'shortcuts-project-activity' do = link_to project_settings_members_path(@project), title: 'Members', class: 'shortcuts-tree' do
%span .nav-icon-container
Activity = custom_icon('members')
%span.nav-item-name
-# Shortcut to Repository > Graph (formerly, Network) Members
- if project_nav_tab? :network
= render 'shared/sidebar_toggle_button'
-# Shortcut to Project > Activity
%li.hidden %li.hidden
= link_to project_network_path(@project, current_ref), title: 'Network', class: 'shortcuts-network' do = link_to activity_project_path(@project), title: 'Activity', class: 'shortcuts-project-activity' do
Graph %span
Activity
-# Shortcut to Repository > Charts (formerly, top-nav item "Graphs")
- unless @project.empty_repo? -# Shortcut to Repository > Graph (formerly, Network)
%li.hidden - if project_nav_tab? :network
= link_to charts_project_graph_path(@project, current_ref), title: 'Charts', class: 'shortcuts-repository-charts' do %li.hidden
Charts = link_to project_network_path(@project, current_ref), title: 'Network', class: 'shortcuts-network' do
Graph
-# Shortcut to Issues > New Issue
%li.hidden -# Shortcut to Repository > Charts (formerly, top-nav item "Graphs")
= link_to new_project_issue_path(@project), class: 'shortcuts-new-issue' do - unless @project.empty_repo?
Create a new issue %li.hidden
= link_to charts_project_graph_path(@project, current_ref), title: 'Charts', class: 'shortcuts-repository-charts' do
-# Shortcut to Pipelines > Jobs Charts
- if project_nav_tab? :builds
-# Shortcut to Issues > New Issue
%li.hidden %li.hidden
= link_to project_jobs_path(@project), title: 'Jobs', class: 'shortcuts-builds' do = link_to new_project_issue_path(@project), class: 'shortcuts-new-issue' do
Jobs Create a new issue
-# Shortcut to commits page -# Shortcut to Pipelines > Jobs
- if project_nav_tab? :commits - if project_nav_tab? :builds
%li.hidden
= link_to project_jobs_path(@project), title: 'Jobs', class: 'shortcuts-builds' do
Jobs
-# Shortcut to commits page
- if project_nav_tab? :commits
%li.hidden
= link_to project_commits_path(@project), title: 'Commits', class: 'shortcuts-commits' do
Commits
-# Shortcut to issue boards
%li.hidden %li.hidden
= link_to project_commits_path(@project), title: 'Commits', class: 'shortcuts-commits' do = link_to 'Issue Boards', project_boards_path(@project), title: 'Issue Boards', class: 'shortcuts-issue-boards'
Commits
-# Shortcut to issue boards
%li.hidden
= link_to 'Issue Boards', project_boards_path(@project), title: 'Issue Boards', class: 'shortcuts-issue-boards'
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
mousePos, mousePos,
getHideSubItemsInterval, getHideSubItemsInterval,
documentMouseMove, documentMouseMove,
getHeaderHeight,
} from '~/fly_out_nav'; } from '~/fly_out_nav';
import bp from '~/breakpoints'; import bp from '~/breakpoints';
...@@ -59,7 +60,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -59,7 +60,7 @@ describe('Fly out sidebar navigation', () => {
describe('getHideSubItemsInterval', () => { describe('getHideSubItemsInterval', () => {
beforeEach(() => { beforeEach(() => {
el.innerHTML = '<div class="sidebar-sub-level-items" style="position: fixed; top: 0; left: 100px; height: 50px;"></div>'; el.innerHTML = '<div class="sidebar-sub-level-items" style="position: fixed; top: 0; left: 100px; height: 150px;"></div>';
}); });
it('returns 0 if currentOpenMenu is nil', () => { it('returns 0 if currentOpenMenu is nil', () => {
...@@ -112,6 +113,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -112,6 +113,7 @@ describe('Fly out sidebar navigation', () => {
clientX: el.getBoundingClientRect().left + 20, clientX: el.getBoundingClientRect().left + 20,
clientY: el.getBoundingClientRect().top + 10, clientY: el.getBoundingClientRect().top + 10,
}); });
console.log(el);
expect( expect(
getHideSubItemsInterval(), getHideSubItemsInterval(),
...@@ -245,7 +247,7 @@ describe('Fly out sidebar navigation', () => { ...@@ -245,7 +247,7 @@ describe('Fly out sidebar navigation', () => {
expect( expect(
subItems.style.transform, subItems.style.transform,
).toBe(`translate3d(0px, ${Math.floor(el.getBoundingClientRect().top)}px, 0px)`); ).toBe(`translate3d(0px, ${Math.floor(el.getBoundingClientRect().top) - getHeaderHeight()}px, 0px)`);
}); });
it('sets is-above when element is above', () => { it('sets is-above when element is above', () => {
......
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