Files
fizzy/app/views/commands/_form.html.erb
T
Jorge Manrubia 5c417ada63 Keep focus
2025-05-06 10:20:37 +02:00

21 lines
858 B
Plaintext

<% has_error = local_assigns.fetch(:error, false) %>
<%= form_tag commands_path,
id: "commands_form",
class: [ "flex align-center gap-half", { "has-error" => has_error } ],
data: { controller: "form", action: "turbo:submit-end->form#reset turbo:submit-end->commands#focus", turbo_permanent: true } do %>
<label class="terminal__label txt-nowrap" for="fizzy_do">Fizzy do &gt;</label>
<%= text_field_tag "command", has_error ? params[:command] : nil,
autocomplete: "off",
autocorrect: "off",
autocapitalize: "off",
class: "terminal__input input fill-transparent unpad",
data: {
commands_target: "input",
action: "keydown.up->toggle-class#add:prevent keydown.down->toggle-class#remove:prevent"
},
placeholder: "Search or type commands…" %>
<% end %>