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 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'
...@@ -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