diff options
author | jerasmus <jerasmus@gitlab.com> | 2018-10-25 13:37:30 +0200 |
---|---|---|
committer | jerasmus <jerasmus@gitlab.com> | 2018-10-25 13:37:30 +0200 |
commit | 162d3510a97df93498f8fb03dad85a957e34fdd7 (patch) | |
tree | 4c20ea8eeeeaf8a79397c067104e7e5445a6dfb4 | |
parent | d13f10c5b11c41edbaa599c5f6c0baecc7ba096e (diff) | |
download | gitlab-ce-51306-fix-inaccessible-dropdown-for-codeless-projects.tar.gz |
Refactor notification dropdown51306-fix-inaccessible-dropdown-for-codeless-projects
Refactored the way that the notification dropdown is positioned.
4 files changed, 3 insertions, 27 deletions
diff --git a/app/assets/javascripts/notifications_dropdown.js b/app/assets/javascripts/notifications_dropdown.js index 0dab9af59c5..c4c8cf86cb0 100644 --- a/app/assets/javascripts/notifications_dropdown.js +++ b/app/assets/javascripts/notifications_dropdown.js @@ -1,5 +1,4 @@ import $ from 'jquery'; -import _ from 'underscore'; import Flash from './flash'; export default function notificationsDropdown() { @@ -26,23 +25,4 @@ export default function notificationsDropdown() { Flash('Failed to save new settings', 'alert'); } }); - - const positionDropdown = ()=> { - const dropdown = $('.js-notifications-dropdown'); - const offsetLeft = dropdown.offset().left; - const isShowing = dropdown.hasClass('show'); - - if(!isShowing) { - return; - } - - if(offsetLeft < dropdown.width()) { - dropdown.addClass('dropdown-menu-left'); - } else { - dropdown.removeClass('dropdown-menu-left'); - } - }; - - $('.notifications-btn').on('click', ()=>_.delay(positionDropdown, 10)); // delay gives time for the dropdown to open before calculating its position. - $(window).on('resize', _.debounce(positionDropdown, 250)); } diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index a893fbb1d1c..da3d8aa53ad 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -287,10 +287,6 @@ @extend .dropdown-menu-right; } - .notification-dropdown .dropdown-menu-left { - left: 0; - } - .download-button { @include media-breakpoint-down(md) { margin-left: 0; diff --git a/app/views/shared/notifications/_button.html.haml b/app/views/shared/notifications/_button.html.haml index 09ddf732ada..f6c7ca70ebd 100644 --- a/app/views/shared/notifications/_button.html.haml +++ b/app/views/shared/notifications/_button.html.haml @@ -9,11 +9,11 @@ %button.dropdown-new.btn.btn-default.has-tooltip.notifications-btn#notifications-button{ type: "button", title: "Notification setting", "aria-label" => "Notification setting: #{notification_title(notification_setting.level)}", data: { container: "body", toggle: "modal", target: "#" + notifications_menu_identifier("modal", notification_setting), display: 'static' } } = icon("bell", class: "js-notification-loading") = notification_title(notification_setting.level) - %button.btn.dropdown-toggle{ data: { toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting) } } + %button.btn.dropdown-toggle{ data: { toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } } = icon('caret-down') .sr-only Toggle dropdown - else - %button.dropdown-new.btn.btn-default.has-tooltip.notifications-btn#notifications-button{ type: "button", title: "Notification setting", "aria-label" => "Notification setting: #{notification_title(notification_setting.level)}", data: { container: "body", toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), display: 'static' } } + %button.dropdown-new.btn.btn-default.has-tooltip.notifications-btn#notifications-button{ type: "button", title: "Notification setting", "aria-label" => "Notification setting: #{notification_title(notification_setting.level)}", data: { container: "body", toggle: "dropdown", target: notifications_menu_identifier("dropdown", notification_setting), flip: "false" } } = icon("bell", class: "js-notification-loading") = notification_title(notification_setting.level) = icon("caret-down") diff --git a/app/views/shared/notifications/_notification_dropdown.html.haml b/app/views/shared/notifications/_notification_dropdown.html.haml index 68238bbd252..85ad74f9a39 100644 --- a/app/views/shared/notifications/_notification_dropdown.html.haml +++ b/app/views/shared/notifications/_notification_dropdown.html.haml @@ -1,4 +1,4 @@ -%ul.dropdown-menu.dropdown-menu-no-wrap.dropdown-menu-selectable.dropdown-menu-large.js-notifications-dropdown{ role: "menu", class: [notifications_menu_identifier("dropdown", notification_setting)] } +%ul.dropdown-menu.dropdown-menu-no-wrap.dropdown-menu-selectable.dropdown-menu-large{ role: "menu", class: [notifications_menu_identifier("dropdown", notification_setting)] } - NotificationSetting.levels.each_key do |level| - next if level == "custom" - next if level == "global" && notification_setting.source.nil? |