There is an issue that screws with cursor position afterwards, always placing it at the end. For the time being, manage the binding manually.
31 lines
1.1 KiB
Text
31 lines
1.1 KiB
Text
% stash("pooru.search" => 1);
|
|
|
|
<%= form_for "list_media" =>
|
|
name => "search",
|
|
class => "layout-flex-row suggestions" =>
|
|
begin %>
|
|
<div class="layout-flex-item-fullsize position-relative"
|
|
x-data="tagsSuggestions('<%= param "tags" %>')"
|
|
@click.outside="open = false">
|
|
<input name="tags" value="<%= param "tags" %>" placeholder="Search tags..."
|
|
x-ref="search"
|
|
@input.debounce="fetchSuggestionsOnInput"
|
|
@keydown.tab="autocompleteItem"
|
|
@keydown.enter="autocompleteItem"
|
|
@keydown.up.prevent="moveActiveItemBackward"
|
|
@keydown.down.prevent="moveActiveItemForward"
|
|
@keydown.escape="open = false">
|
|
<ul x-ref="suggestions" x-cloak x-show="open">
|
|
<template x-for="(item, index) in sortedItems" :key="item.display">
|
|
<li
|
|
:class="index === activeItem ? 'suggestion-hover' : ''"
|
|
@click="autocompletePointedItem"
|
|
@mouseenter="setHoveredItem">
|
|
<span x-text="item.display" :class="item.kind_class"></span>
|
|
<span class="float-right" x-text="item.count"></span>
|
|
</li>
|
|
</template>
|
|
</ul>
|
|
</div>
|
|
<%= submit_button "Search" %>
|
|
<% end %>
|