diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-08-07 23:20:09 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-08-07 23:20:09 +0300 |
commit | 7767ceef47a57baf2bc03f609e3dbf77ed44c9aa (patch) | |
tree | 0d057168bfba56bff88f2bf1b4e8f19af0aa2204 /app/assets/javascripts/gl_dropdown.js | |
parent | 1d5a306596e56398c3f6f46feafd1f4ce23c3c2c (diff) | |
parent | b12107a0b953b566cd58db30ae880800a4a695a6 (diff) |
Merge branch 'master' into ide
* master: (177 commits)
Add changelog
Bump gitlab-shell version to 5.8.0 to fix Git for Windows 2.14
Make contextual sidebar collapsible
Fixed sidebar context header hover colors
Use correct `Environment`-class within `Gitlab` namespace
Remove gl.Activities from Commits page
Move `let` calls inside the `describe` block using them
Add `/assign me` alias support for assigning issuables to oneself
GRPC::Unavailable (< GRPC::BadStatus) is wrapped in a CommandError
Use `broken_storage` in the fs_shards_spec.
Eager load project creators for project dashboards
Memoize a user's personal projects count
Remove redundant query from User#recent_push
Improve checking if projects would be returned
Change spelling of gitlab-shell
Remove unused #tree-holder
Add custom linter for inline JavaScript to haml_lint
Rename user_can_admin? because it's more accurate
Synchronous zanata community contribution translation
Add Korean translation to i18n
...
Diffstat (limited to 'app/assets/javascripts/gl_dropdown.js')
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js b/app/assets/javascripts/gl_dropdown.js index 65916b4d04d..b62acfcd445 100644 --- a/app/assets/javascripts/gl_dropdown.js +++ b/app/assets/javascripts/gl_dropdown.js @@ -1,5 +1,6 @@ /* eslint-disable func-names, no-underscore-dangle, space-before-function-paren, no-var, one-var, one-var-declaration-per-line, prefer-rest-params, max-len, vars-on-top, wrap-iife, no-unused-vars, quotes, no-shadow, no-cond-assign, prefer-arrow-callback, no-return-assign, no-else-return, camelcase, comma-dangle, no-lonely-if, guard-for-in, no-restricted-syntax, consistent-return, prefer-template, no-param-reassign, no-loop-func, no-mixed-operators */ /* global fuzzaldrinPlus */ +import _ from 'underscore'; import { isObject } from './lib/utils/type_utility'; var GitLabDropdown, GitLabDropdownFilter, GitLabDropdownRemote, GitLabDropdownInput; @@ -158,7 +159,7 @@ GitLabDropdownFilter = (function() { } else { elements = this.options.elements(); if (search_text) { - return elements.each(function() { + elements.each(function() { var $el, matches; $el = $(this); matches = fuzzaldrinPlus.match($el.text().trim(), search_text); @@ -171,8 +172,10 @@ GitLabDropdownFilter = (function() { } }); } else { - return elements.show().removeClass('option-hidden'); + elements.show().removeClass('option-hidden'); } + + elements.parent().find('.dropdown-menu-empty-link').toggleClass('hidden', elements.is(':visible')); } }; @@ -782,9 +785,15 @@ GitLabDropdown = (function() { GitLabDropdown.prototype.focusTextInput = function(triggerFocus = false) { if (this.options.filterable) { this.dropdown.one('transitionend', () => { + const initialScrollTop = $(window).scrollTop(); + if (this.dropdown.is('.open')) { this.filterInput.focus(); } + + if ($(window).scrollTop() < initialScrollTop) { + $(window).scrollTop(initialScrollTop); + } }); if (triggerFocus) { |