diff options
author | Phil Hughes <me@iamphill.com> | 2017-04-06 14:27:48 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-04-06 14:27:48 +0100 |
commit | 92541f54821bc6a211b2bdbfebbc28fde57f231f (patch) | |
tree | 815f69a888de00997155e8103e02da578b55071f | |
parent | 1adc698b9df0398ad41b6f4fc192e112d43b8698 (diff) | |
download | gitlab-ce-menu-shortcut.tar.gz |
Fixed specsmenu-shortcut
Updated JS that was causing the hints to appear & then disappear
-rw-r--r-- | app/assets/javascripts/shortcuts.js | 13 | ||||
-rw-r--r-- | app/views/layouts/nav/_dashboard.html.haml | 28 | ||||
-rw-r--r-- | spec/features/dashboard/shortcuts_spec.rb | 12 |
3 files changed, 34 insertions, 19 deletions
diff --git a/app/assets/javascripts/shortcuts.js b/app/assets/javascripts/shortcuts.js index d9b20d2694b..5b6bb2bf3f5 100644 --- a/app/assets/javascripts/shortcuts.js +++ b/app/assets/javascripts/shortcuts.js @@ -17,15 +17,20 @@ import findAndFollowLink from './shortcuts_dashboard_navigation'; Mousetrap.bind('s', Shortcuts.focusSearch); Mousetrap.bind('f', (e => this.focusFilter(e))); - const globalDropdownMenu = $('.global-dropdown-menu'); + const $globalDropdownMenu = $('.global-dropdown-menu'); + const $globalDropdownToggle = $('.global-dropdown-toggle'); $('.global-dropdown').on('hide.bs.dropdown', () => { - globalDropdownMenu.toggleClass('shortcuts'); + $globalDropdownMenu.removeClass('shortcuts'); }); Mousetrap.bind('n', () => { - globalDropdownMenu.toggleClass('shortcuts'); - $('.global-dropdown-toggle').trigger('click'); + $globalDropdownMenu.toggleClass('shortcuts'); + $globalDropdownToggle.trigger('click'); + + if (!$globalDropdownMenu.is(':visible')) { + $globalDropdownToggle.blur(); + } }); Mousetrap.bind('shift+t', () => findAndFollowLink('.shortcuts-todos')); diff --git a/app/views/layouts/nav/_dashboard.html.haml b/app/views/layouts/nav/_dashboard.html.haml index 2f8d722c58a..444ecc414c0 100644 --- a/app/views/layouts/nav/_dashboard.html.haml +++ b/app/views/layouts/nav/_dashboard.html.haml @@ -2,13 +2,17 @@ = nav_link(path: ['root#index', 'projects#trending', 'projects#starred', 'dashboard/projects#index'], html_options: {class: "#{project_tab_class} home"}) do = link_to dashboard_projects_path, title: 'Projects', class: 'dashboard-shortcuts-projects' do .shortcut-mappings - .key shift p + .key + = icon('arrow-up', 'aria-label' => 'hidden') + P %span Projects = nav_link(path: 'dashboard#activity') do = link_to activity_dashboard_path, class: 'dashboard-shortcuts-activity', title: 'Activity' do .shortcut-mappings - .key shift a + .key + = icon('arrow-up', 'aria-label' => 'hidden') + A %span Activity - if koding_enabled? @@ -19,33 +23,43 @@ = nav_link(controller: [:groups, 'groups/milestones', 'groups/group_members']) do = link_to dashboard_groups_path, class: 'dashboard-shortcuts-groups', title: 'Groups' do .shortcut-mappings - .key shift g + .key + = icon('arrow-up', 'aria-label' => 'hidden') + G %span Groups = nav_link(controller: 'dashboard/milestones') do = link_to dashboard_milestones_path, class: 'dashboard-shortcuts-milestones', title: 'Milestones' do .shortcut-mappings - .key shift l + .key + = icon('arrow-up', 'aria-label' => 'hidden') + L %span Milestones = nav_link(path: 'dashboard#issues') do = link_to assigned_issues_dashboard_path, title: 'Issues', class: 'dashboard-shortcuts-issues' do .shortcut-mappings - .key shift i + .key + = icon('arrow-up', 'aria-label' => 'hidden') + I %span Issues .badge= number_with_delimiter(cached_assigned_issuables_count(current_user, :issues, :opened)) = nav_link(path: 'dashboard#merge_requests') do = link_to assigned_mrs_dashboard_path, title: 'Merge Requests', class: 'dashboard-shortcuts-merge_requests' do .shortcut-mappings - .key shift m + .key + = icon('arrow-up', 'aria-label' => 'hidden') + M %span Merge Requests .badge= number_with_delimiter(cached_assigned_issuables_count(current_user, :merge_requests, :opened)) = nav_link(controller: 'dashboard/snippets') do = link_to dashboard_snippets_path, class: 'dashboard-shortcuts-snippets', title: 'Snippets' do .shortcut-mappings - .key shift s + .key + = icon('arrow-up', 'aria-label' => 'hidden') + S %span Snippets %li.divider diff --git a/spec/features/dashboard/shortcuts_spec.rb b/spec/features/dashboard/shortcuts_spec.rb index d5c5b344ffd..fa5524e18d8 100644 --- a/spec/features/dashboard/shortcuts_spec.rb +++ b/spec/features/dashboard/shortcuts_spec.rb @@ -7,23 +7,19 @@ feature 'Dashboard shortcuts', feature: true, js: true do end scenario 'Navigate to tabs' do - find('body').native.send_key(:shift) - find('body').native.send_key('p') + find('body').native.send_keys([:shift, 'P']) check_page_title('Projects') - find('body').native.send_key(:shift) - find('body').native.send_key('i') + find('body').native.send_key([:shift, 'I']) check_page_title('Issues') - find('body').native.send_key(:shift) - find('body').native.send_key('m') + find('body').native.send_key([:shift, 'M']) check_page_title('Merge Requests') - find('body').native.send_key(:shift) - find('body').native.send_key('t') + find('body').native.send_keys([:shift, 'T']) check_page_title('Todos') end |