diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-03-23 22:24:46 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-03-23 22:24:46 +0300 |
commit | c37735841b096eec5935e5c5ccb6d3d8b4f8234a (patch) | |
tree | cdfd68357ff05aa7709a0f121e700a32270f48a2 /app/assets/javascripts/search_autocomplete.js.coffee | |
parent | 44817726fe52a5a061396a2280f7fd19c7d494d0 (diff) |
Restore menu content when emptying the search input
Diffstat (limited to 'app/assets/javascripts/search_autocomplete.js.coffee')
-rw-r--r-- | app/assets/javascripts/search_autocomplete.js.coffee | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/assets/javascripts/search_autocomplete.js.coffee b/app/assets/javascripts/search_autocomplete.js.coffee index a06c80b60cd..4aa658735de 100644 --- a/app/assets/javascripts/search_autocomplete.js.coffee +++ b/app/assets/javascripts/search_autocomplete.js.coffee @@ -18,6 +18,7 @@ class @SearchAutocomplete # Dropdown Element @dropdown = @wrap.find('.dropdown') + @dropdownContent = @dropdown.find('.dropdown-content') @locationBadgeEl = @getElement('.search-location-badge') @locationText = @getElement('.location-text') @@ -136,6 +137,7 @@ class @SearchAutocomplete if e.currentTarget.value is '' @removeLocationBadge() @searchInput.focus() + @disableAutocomplete() when KEYCODE.ESCAPE if @badgePresent() else @@ -239,4 +241,13 @@ class @SearchAutocomplete disableAutocomplete: -> if @autocomplete @searchInput.addClass('disabled') + @dropdown.removeClass('open') + @restoreMenu() + @autocomplete = false + + restoreMenu: -> + html = "<ul> + <li><a class='is-focused'>Loading...</a></li> + </ul>" + @dropdownContent.html(html) |