From c279d09f4601b1db12fb5896a13183013cb9a652 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 23 May 2024 15:24:32 -0300 Subject: [PATCH] fix: los id no llevan corchetes --- app/views/posts/attributes/_new_array.haml | 2 +- app/views/posts/attributes/_new_has_many.haml | 2 +- app/views/posts/attributes/_new_predefined_array.haml | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/posts/attributes/_new_array.haml b/app/views/posts/attributes/_new_array.haml index 394345a6..692a6898 100644 --- a/app/views/posts/attributes/_new_array.haml +++ b/app/views/posts/attributes/_new_array.haml @@ -1,7 +1,7 @@ -# Genera un listado de checkboxes entre los que se puede elegir para guardar :ruby - id = "#{base}_#{attribute}" + id = "#{base.gsub(/[\[\]]/, '_')}_#{attribute}".squeeze('_') name = "#{base}[#{attribute}][]" form_id = "form-#{Nanoid.generate}" diff --git a/app/views/posts/attributes/_new_has_many.haml b/app/views/posts/attributes/_new_has_many.haml index 16d68322..48230759 100644 --- a/app/views/posts/attributes/_new_has_many.haml +++ b/app/views/posts/attributes/_new_has_many.haml @@ -8,7 +8,7 @@ del formulario principal porque no se pueden anidar. :ruby - id = "#{base}_#{attribute}" + id = "#{base.gsub(/[\[\]]/, '_')}_#{attribute}".squeeze('_') name = "#{base}[#{attribute}][]" form_id = "form-#{Nanoid.generate}" modal_id = "modal-#{Nanoid.generate}" diff --git a/app/views/posts/attributes/_new_predefined_array.haml b/app/views/posts/attributes/_new_predefined_array.haml index 5203c12b..218a2cc2 100644 --- a/app/views/posts/attributes/_new_predefined_array.haml +++ b/app/views/posts/attributes/_new_predefined_array.haml @@ -3,7 +3,8 @@ guardar, pero no se pueden agregar nuevos. :ruby - id = "#{base}_#{attribute}" + # @todo Convertir en un helper + id = "#{base.gsub(/[\[\]]/, '_')}_#{attribute}".squeeze('_') name = "#{base}[#{attribute}][]" form_id = "form-#{Nanoid.generate}"