Files
danbooru/app/components/autocomplete_component/autocomplete_component.html.erb
evazion 3d831f7e1c autocomplete: limit width of autocomplete menu.
Limit the width of the autocomplete menu to 480px. This is so that
stupidly long isekai titles don't blow out the size of the menu when
searching for common words.

For example, when searching for "look", one of the results is:

   no_matter_how_you_look_at_it_it's_your_fault_that_i'm_not_popular! -> watashi_ga_motenai_no_wa_dou_kangaetemo_omaera_ga_warui!
2022-09-02 13:56:53 -05:00

22 lines
930 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" %>
<% end %>
</div>
<% end %>
<% end %>
</ul>