mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 05:16:21 +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}][]"
|
name = "#{base}[#{attribute}][]"
|
||||||
form_id = "form-#{Nanoid.generate}"
|
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
|
.form-group
|
||||||
= hidden_field_tag name, ''
|
= hidden_field_tag name, ''
|
||||||
= label_tag id, post_label_t(attribute, post: post)
|
= label_tag id, post_label_t(attribute, post: post)
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
- content_for :"#{id}_header" do
|
- content_for :"#{id}_header" do
|
||||||
.form-group.flex-grow-1.mb-0
|
.form-group.flex-grow-1.mb-0
|
||||||
= label_tag id, post_label_t(attribute, post: post)
|
= 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
|
- content_for :"#{id}_body" do
|
||||||
.form-group.mb-0{ id: "#{id}_body" }
|
.form-group.mb-0{ id: "#{id}_body" }
|
||||||
|
|
Loading…
Reference in a new issue