summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2016-03-27 13:28:45 -0500
committerAlfredo Sumaran <alfredo@gitlab.com>2016-03-27 13:28:45 -0500
commit07a0278d631fcd55ab3cd16838669836efb74e06 (patch)
treeccde343caa700a44705d1055d1ba35c1e3d171b5
parentd681623c716360282c27e3a9762d5f7e634c666b (diff)
downloadgitlab-ce-07a0278d631fcd55ab3cd16838669836efb74e06.tar.gz
Do not show dropdown menu if when no suggestions returned
-rw-r--r--app/assets/javascripts/search_autocomplete.js.coffee9
1 files changed, 5 insertions, 4 deletions
diff --git a/app/assets/javascripts/search_autocomplete.js.coffee b/app/assets/javascripts/search_autocomplete.js.coffee
index e873a3d2570..e38fba7dc8c 100644
--- a/app/assets/javascripts/search_autocomplete.js.coffee
+++ b/app/assets/javascripts/search_autocomplete.js.coffee
@@ -79,6 +79,11 @@ class @SearchAutocomplete
project_ref: @projectRef
term: term
}, (response) ->
+ # Hide dropdown menu if no suggestions returns
+ if !response.length
+ _this.disableAutocomplete()
+ return
+
data = []
# List results
@@ -228,10 +233,6 @@ class @SearchAutocomplete
@dropdown.removeClass 'open'
- # Only add class if there's a badge
- # if @badgePresent()
- # @searchInput.addClass 'disabled'
-
badgePresent: ->
@locationBadgeEl.children().length