diff --git a/app/views/posts/_htmx_form.haml b/app/views/posts/_htmx_form.haml index 1c3cc783..6968cda7 100644 --- a/app/views/posts/_htmx_form.haml +++ b/app/views/posts/_htmx_form.haml @@ -50,7 +50,8 @@ = render 'errors', post: post -# Parámetros para HTMX - %input{ type: 'hidden', name: 'hide', value: pluck_param((post.errors.empty? ? :show : :hide), optional: true) } + %input{ type: 'hidden', name: 'modal_id', value: pluck_param(:modal_id, optional: true) } + %input{ type: 'hidden', name: 'hide', value: pluck_param((post.errors.empty? ? :show : :hide), optional: true) || pluck_param(:modal_id, optional: true) } %input{ type: 'hidden', name: 'show', value: pluck_param((post.errors.empty? ? :hide : :show), optional: true) } %input{ type: 'hidden', name: 'name', value: pluck_param(:name) } %input{ type: 'hidden', name: 'base', value: pluck_param(:base) } diff --git a/app/views/posts/attributes/_new_has_one.haml b/app/views/posts/attributes/_new_has_one.haml index 09cc9b7f..573cd37e 100644 --- a/app/views/posts/attributes/_new_has_one.haml +++ b/app/views/posts/attributes/_new_has_one.haml @@ -46,7 +46,7 @@ = render 'bootstrap/modal', id: id, modal_content_attributes: { class: 'h-100' } do - content_for :"#{id}_body" do -# @todo ocultar el modal después de guardar - .placeholder-glow{ 'hx-get': site_posts_form_path(site, layout: layout, base: id, name: name, form: form_id, swap: 'innerHTML', target: target_id, attribute: 'new_has_one', hide: modal_id, uuid: metadata.value, invalid: invalid_id, submitting: submitting_id, saved: saved_id, inverse: metadata.inverse, metadata.inverse => post.uuid.value), 'hx-trigger': 'load' } + .placeholder-glow{ 'hx-get': site_posts_form_path(site, layout: layout, base: id, name: name, form: form_id, swap: 'innerHTML', target: target_id, attribute: 'new_has_one', modal_id: modal_id, uuid: metadata.value, invalid: invalid_id, submitting: submitting_id, saved: saved_id, inverse: metadata.inverse, metadata.inverse => post.uuid.value), 'hx-trigger': 'load' } %span.placeholder.w-100.h-100 - content_for :"#{id}_footer" do diff --git a/app/views/posts/new_has_one_value.haml b/app/views/posts/new_has_one_value.haml index 06065518..9ce50526 100644 --- a/app/views/posts/new_has_one_value.haml +++ b/app/views/posts/new_has_one_value.haml @@ -1 +1 @@ -= render 'posts/new_has_one', post: @post.to_index, name: pluck_param(:name), value: @uuid, modal_id: pluck_param(:show) += render 'posts/new_has_one', post: @post.to_index, name: pluck_param(:name), value: @uuid, modal_id: pluck_param(:modal_id)