diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-05-05 16:42:34 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-06-03 17:14:23 -0500 |
commit | 5d7445198fd830c093d5242bc5651d68b07bb079 (patch) | |
tree | ffab466354cf6ba0e3ec120af6654349fdcfbd3e | |
parent | 116f5f26ea8e8f824caa89d1cb407b1082e32399 (diff) | |
download | gitlab-ce-5d7445198fd830c093d5242bc5651d68b07bb079.tar.gz |
Only filter asynchronously if option remote is true.
We need to update the results right away when we do bulk assignment.
-rw-r--r-- | app/assets/javascripts/gl_dropdown.js.coffee | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/app/assets/javascripts/gl_dropdown.js.coffee b/app/assets/javascripts/gl_dropdown.js.coffee index 1e144861741..e98a8a561d5 100644 --- a/app/assets/javascripts/gl_dropdown.js.coffee +++ b/app/assets/javascripts/gl_dropdown.js.coffee @@ -37,20 +37,20 @@ class GitLabDropdownFilter if keyCode is 13 return false - clearTimeout timeout - timeout = setTimeout => - blur_field = @shouldBlur keyCode - search_text = @input.val() + # Only filter asynchronously only if option remote is set + if @options.remote + clearTimeout timeout + timeout = setTimeout => + blur_field = @shouldBlur keyCode - if blur_field and @filterInputBlur - @input.blur() + if blur_field and @filterInputBlur + @input.blur() - if @options.remote - @options.query search_text, (data) => + @options.query @input.val(), (data) => @options.callback(data) - else - @filter search_text - , 250 + , 250 + else + @filter @input.val() shouldBlur: (keyCode) -> return BLUR_KEYCODES.indexOf(keyCode) >= 0 |