From 336b50d0306d18434aa4377c61a27786906e39d4 Mon Sep 17 00:00:00 2001 From: Annabel Dunstone Gray Date: Tue, 8 May 2018 09:16:35 -0700 Subject: Fix right-aligned menus; only display tooltip on hover --- app/assets/javascripts/main.js | 1 + app/views/layouts/header/_default.html.haml | 2 +- app/views/layouts/terms.html.haml | 2 +- app/views/shared/_ref_switcher.html.haml | 2 +- spec/support/helpers/sorting_helper.rb | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 1308065783e..9803bebfd10 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -143,6 +143,7 @@ document.addEventListener('DOMContentLoaded', () => { // Initialize tooltips $body.tooltip({ selector: '.has-tooltip, [data-toggle="tooltip"]', + trigger: 'hover', placement(tip, el) { return $(el).data('placement') || 'bottom'; }, diff --git a/app/views/layouts/header/_default.html.haml b/app/views/layouts/header/_default.html.haml index e07e8683679..86c976118bb 100644 --- a/app/views/layouts/header/_default.html.haml +++ b/app/views/layouts/header/_default.html.haml @@ -52,7 +52,7 @@ = link_to current_user, class: user_dropdown_class, data: { toggle: "dropdown" } do = image_tag avatar_icon_for_user(current_user, 23), width: 23, height: 23, class: "header-user-avatar qa-user-avatar" = sprite_icon('angle-down', css_class: 'caret-down') - .dropdown-menu-nav.dropdown-menu-align-right + .dropdown-menu-nav.dropdown-menu-right = render 'layouts/header/current_user_dropdown' - if header_link?(:admin_impersonation) %li.nav-item.impersonation diff --git a/app/views/layouts/terms.html.haml b/app/views/layouts/terms.html.haml index a30d6e2688c..d670147226d 100644 --- a/app/views/layouts/terms.html.haml +++ b/app/views/layouts/terms.html.haml @@ -29,6 +29,6 @@ = link_to current_user, class: user_dropdown_class, data: { toggle: "dropdown" } do = image_tag avatar_icon_for_user(current_user, 23), width: 23, height: 23, class: "header-user-avatar qa-user-avatar" = sprite_icon('angle-down', css_class: 'caret-down') - .dropdown-menu-nav.dropdown-menu-align-right + .dropdown-menu-nav.dropdown-menu-right = render 'layouts/header/current_user_dropdown' = yield diff --git a/app/views/shared/_ref_switcher.html.haml b/app/views/shared/_ref_switcher.html.haml index f1c39b9e923..4e7061eef1c 100644 --- a/app/views/shared/_ref_switcher.html.haml +++ b/app/views/shared/_ref_switcher.html.haml @@ -9,7 +9,7 @@ = hidden_field_tag key, value, id: nil .dropdown = dropdown_toggle dropdown_toggle_text, { toggle: "dropdown", selected: dropdown_toggle_text, ref: @ref, refs_url: refs_project_path(@project, sort: 'updated_desc'), field_name: 'ref', submit_form_on_click: true, visit: true }, { toggle_class: "js-project-refs-dropdown qa-branches-select" } - .dropdown-menu.dropdown-menu-selectable.git-revision-dropdown.dropdown-menu-paging.qa-branches-dropdown{ class: ("dropdown-menu-align-right" if local_assigns[:align_right]) } + .dropdown-menu.dropdown-menu-selectable.git-revision-dropdown.dropdown-menu-paging.qa-branches-dropdown{ class: ("dropdown-menu-right" if local_assigns[:align_right]) } .dropdown-page-one = dropdown_title _("Switch branch/tag") = dropdown_filter _("Search branches and tags") diff --git a/spec/support/helpers/sorting_helper.rb b/spec/support/helpers/sorting_helper.rb index 577518d726c..9496a94d8f4 100644 --- a/spec/support/helpers/sorting_helper.rb +++ b/spec/support/helpers/sorting_helper.rb @@ -11,7 +11,7 @@ module SortingHelper def sorting_by(value) find('button.dropdown-toggle').click - page.within('.content ul.dropdown-menu.dropdown-menu-align-right li') do + page.within('.content ul.dropdown-menu.dropdown-menu-right li') do click_link value end end -- cgit v1.2.1