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
selected = self.rowClicked $(@)
if self.options.clicked
self.options.clicked(selected)
self.options.clicked(selected, e)
# Finds an element inside wrapper element
getElement: (selector) ->
......
......@@ -62,6 +62,8 @@ class @SearchAutocomplete
search:
fields: ['text']
data: @getData.bind(@)
selectable: true
clicked: @onClick.bind(@)
getData: (term, callback) ->
_this = @
......@@ -268,3 +270,9 @@ class @SearchAutocomplete
<li><a class='dropdown-menu-empty-link is-focused'>Loading...</a></li>
</ul>"
@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