Skip default behaviour if we are clicking a result for the same location
This commit is contained in:
parent
ccc929d75d
commit
e3a9830507
2 changed files with 9 additions and 1 deletions
|
@ -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('')
|
||||
|
|
Loading…
Reference in a new issue