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.
22 lines
954 B
Plaintext
22 lines
954 B
Plaintext
<ul>
|
|
<% autocomplete_results.each do |result| %>
|
|
<%= tag.li class: "ui-menu-item", "data-autocomplete-type": result.type, "data-autocomplete-antecedent": result.antecedent, "data-autocomplete-value": result.value, "data-autocomplete-category": result.category, "data-autocomplete-post-count": result.post_count do %>
|
|
<div class="ui-menu-item-wrapper" tabindex="-1">
|
|
<%= link_to_result result do %>
|
|
<% if result.antecedent.present? %>
|
|
<span class="autocomplete-antecedent"><%= highlight_antecedent(result) %></span>
|
|
<span class="autocomplete-arrow">→</span>
|
|
<%= result.label %>
|
|
<% else %>
|
|
<%= highlight_result(result) %>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% if result.post_count %>
|
|
<%= tag.span humanized_number(result.post_count), class: "post-count", style: "float: right;" %>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
</ul>
|