mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 05:06:22 +00:00
fix: no enviar el formulario de filtro
This commit is contained in:
parent
01e1692c71
commit
6673660fb6
2 changed files with 12 additions and 2 deletions
10
app/javascript/controllers/enter_controller.js
Normal file
10
app/javascript/controllers/enter_controller.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { Controller } from "stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
/*
|
||||
* Previene el envío de un formulario al presionar enter
|
||||
*/
|
||||
prevent(event) {
|
||||
if (event.key == "Enter") event.preventDefault();
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
name = "#{base}[#{attribute}][]"
|
||||
form_id = "form-#{Nanoid.generate}"
|
||||
|
||||
%div{ data: { controller: 'modal array', 'array-original-value': metadata.value.to_json, 'array-new-array-value': site_posts_new_array_value_path(site) } }
|
||||
%div{ data: { controller: 'modal array enter', 'array-original-value': metadata.value.to_json, 'array-new-array-value': site_posts_new_array_value_path(site) } }
|
||||
.form-group
|
||||
= hidden_field_tag name, ''
|
||||
= label_tag id, post_label_t(attribute, post: post)
|
||||
|
@ -30,7 +30,7 @@
|
|||
- content_for :"#{id}_header" do
|
||||
.form-group.flex-grow-1.mb-0
|
||||
= label_tag id, post_label_t(attribute, post: post)
|
||||
%input.form-control{ data: { target: 'array.search', action: 'input->array#search' }, type: 'search', placeholder: t('.filter') }
|
||||
%input.form-control{ data: { target: 'array.search', action: 'input->array#search keydown->enter#prevent' }, type: 'search', placeholder: t('.filter') }
|
||||
|
||||
- content_for :"#{id}_body" do
|
||||
.form-group.mb-0{ id: "#{id}_body" }
|
||||
|
|
Loading…
Reference in a new issue