5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 16:56:22 +00:00

Merge branch 'issue-15068' into production.panel.sutty.nl

This commit is contained in:
f 2024-05-23 17:15:51 -03:00
commit 58837f61f6
No known key found for this signature in database
2 changed files with 12 additions and 2 deletions

View 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();
}
}

View file

@ -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" }