From 3967a631632c09a1310c4248c7b1a61406284d3e Mon Sep 17 00:00:00 2001 From: f Date: Mon, 4 Mar 2024 15:10:20 -0300 Subject: [PATCH] feat: extraer en un componente --- app/views/components/_select_all_container.haml | 13 +++++++++++++ app/views/moderation_queue/_accounts.haml | 2 +- app/views/moderation_queue/_instances.haml | 3 +-- 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 app/views/components/_select_all_container.haml diff --git a/app/views/components/_select_all_container.haml b/app/views/components/_select_all_container.haml new file mode 100644 index 00000000..5fa91e2d --- /dev/null +++ b/app/views/components/_select_all_container.haml @@ -0,0 +1,13 @@ +-# + Contenedor para las acciones en masa. + + Es un formulario auto-contenido, que permite colocar los elementos + fuera del formulario para evitar anidarlos. Mientras los elementos + tengan el atributo `form` con el mismo parĂ¡metro `form_id`, el + navegador los va a asignar a este formulario. + + @param path [String] + @param form_id [String] + += form_tag path, id: form_id, method: :patch do + -# nada diff --git a/app/views/moderation_queue/_accounts.haml b/app/views/moderation_queue/_accounts.haml index 53d2f28e..65ff953f 100644 --- a/app/views/moderation_queue/_accounts.haml +++ b/app/views/moderation_queue/_accounts.haml @@ -1,6 +1,6 @@ - form_id = 'actor_moderations_action_on_several' -= form_tag site_actor_moderations_action_on_several_path, id: form_id, method: :patch += render 'components/select_all_container', path: site_actor_moderations_action_on_several_path, form_id: form_id .row.no-gutters.pt-2{ data: { controller: 'select-all' } } .col-1.d-flex.align-items-center diff --git a/app/views/moderation_queue/_instances.haml b/app/views/moderation_queue/_instances.haml index a707d48a..d9db967f 100644 --- a/app/views/moderation_queue/_instances.haml +++ b/app/views/moderation_queue/_instances.haml @@ -1,8 +1,7 @@ - form_id = 'instance_moderation_action_on_several' %section - = form_tag site_instance_moderations_action_on_several_path, id: form_id, method: :patch - + = render 'components/select_all_container', path: site_instance_moderations_action_on_several_path, form_id: form_id .row.no-gutters.pt-2{ data: { controller: 'select-all' } } .col-1.d-flex.align-items-center = render 'components/select_all', id: 'instances', form_id: form_id