autocomplete: highlight matches in autocomplete menu.

Highlight the matching part of the tag in the autocomplete menu. For
example, if you search "hair", then the word "hair" will be bolded in
every matching tag. This is so users can tell why a particular tag was
matched.
This commit is contained in:
evazion
2022-09-02 00:15:26 -05:00
parent f8e4e5724f
commit 8491bef6e6
2 changed files with 63 additions and 4 deletions

View File

@@ -4,11 +4,12 @@
<div class="ui-menu-item-wrapper" tabindex="-1">
<%= link_to_result result do %>
<% if result.antecedent.present? %>
<span class="autocomplete-antecedent"><%= result.antecedent.tr("_", " ") %></span>
<span class="autocomplete-antecedent"><%= highlight_antecedent(result) %></span>
<span class="autocomplete-arrow">→</span>
<%= result.label %>
<% else %>
<%= highlight_result(result) %>
<% end %>
<%= result.label %>
<% end %>
<% if result.post_count %>