Commit 824fecb7 authored by Alfredo Sumaran's avatar Alfredo Sumaran

Bring back search context when chosing the same project/group

parent ab42560e
......@@ -104,6 +104,8 @@ class @SearchAutocomplete
lastCategory = suggestion.category
data.push
id: "#{suggestion.category.toLowerCase()}-#{suggestion.id}"
category: suggestion.category
text: suggestion.label
url: suggestion.url
......@@ -271,8 +273,27 @@ class @SearchAutocomplete
</ul>"
@dropdownContent.html(html)
onClick: (item, e) ->
onClick: (item, $el, e) ->
if location.pathname.indexOf(item.url) isnt -1
e.preventDefault()
if not @badgePresent
if item.category is 'Projects'
@projectInputEl.val(item.id)
@addLocationBadge(
value: 'This project'
)
if item.category is 'Groups'
@groupInputEl.val(item.id)
@addLocationBadge(
value: 'This group'
)
$el.removeClass('is-active')
@disableAutocomplete()
@searchInput.val('')
@searchInput.val('').focus()
# We need to wait because of @skipBlurEvent
setTimeout( =>
@onSearchInputFocus()
, 200)
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