Commit e3a98305 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Skip default behaviour if we are clicking a result for the same location

parent ccc929d7
...@@ -174,7 +174,7 @@ class GitLabDropdown ...@@ -174,7 +174,7 @@ class GitLabDropdown
selected = self.rowClicked $(@) selected = self.rowClicked $(@)
if self.options.clicked if self.options.clicked
self.options.clicked(selected) self.options.clicked(selected, e)
# Finds an element inside wrapper element # Finds an element inside wrapper element
getElement: (selector) -> getElement: (selector) ->
......
...@@ -62,6 +62,8 @@ class @SearchAutocomplete ...@@ -62,6 +62,8 @@ class @SearchAutocomplete
search: search:
fields: ['text'] fields: ['text']
data: @getData.bind(@) data: @getData.bind(@)
selectable: true
clicked: @onClick.bind(@)
getData: (term, callback) -> getData: (term, callback) ->
_this = @ _this = @
...@@ -268,3 +270,9 @@ class @SearchAutocomplete ...@@ -268,3 +270,9 @@ class @SearchAutocomplete
<li><a class='dropdown-menu-empty-link is-focused'>Loading...</a></li> <li><a class='dropdown-menu-empty-link is-focused'>Loading...</a></li>
</ul>" </ul>"
@dropdownContent.html(html) @dropdownContent.html(html)
onClick: (item, e) ->
if location.pathname.indexOf(item.url) isnt -1
e.preventDefault()
@disableAutocomplete()
@searchInput.val('')
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment