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 $(@)
|
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
|
||||||
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
|
||||||
<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('')
|
||||||
|
|
Loading…
Reference in a new issue