Commit b5bd497a authored by Alfredo Sumaran's avatar Alfredo Sumaran Committed by Jacob Schatz

Allow to hightlight matches

parent f858ee43
......@@ -252,6 +252,8 @@ class GitLabDropdown
if selected
cssClass = "is-active"
text = @highlightTextMatches(text, @filterInput.val())
html = "<li>"
html += "<a href='#{url}' class='#{cssClass}'>"
html += text
......@@ -260,6 +262,15 @@ class GitLabDropdown
return html
highlightTextMatches: (text, term) ->
occurrences = fuzzaldrinPlus.match(text, term)
textArr = text.split('')
textArr.forEach (character, i, textArr) ->
if i in occurrences
textArr[i] = "<b>#{character}</b>"
textArr.join ''
noResults: ->
html = "<li>"
html += "<a href='#' class='is-focused'>"
......
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