5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 03:36:21 +00:00

fix: no romper relaciones!

This commit is contained in:
f 2024-07-02 13:02:32 -03:00
parent a344c16f4d
commit 3a2005e54a
No known key found for this signature in database
5 changed files with 10 additions and 4 deletions

View file

@ -85,11 +85,13 @@
= hidden_field_tag "#{base}[layout]", post.layout.name
-# Dibuja cada atributo
-# Dibuja cada atributo, excepto algunos
= render 'posts/attributes', site: site, post: post, dir: dir, base: base, locale: locale, except: except
-# Enviamos valores vacíos para los atributos ocultos
-#
Enviamos valores vacíos o arrastrados desde el formulario anterior
para los atributos ignorados
- except.each do |attr|
%input{ type: 'hidden', name: "#{base}[#{attr}]", value: "" }
%input{ type: 'hidden', name: "#{base}[#{attr}]", value: params[attr].presence }
= yield(:post_form)

View file

@ -100,6 +100,7 @@
%input{ type: 'hidden', name: 'attribute', value: metadata.type }
- if metadata.inverse?
%input{ type: 'hidden', name: 'inverse', value: metadata.inverse }
%input{ type: 'hidden', name: metadata.inverse, value: post.uuid.value }
%div{ id: post_modal_id, data: { controller: 'modal' } }
= render 'bootstrap/modal', id: post_id, modal_content_attributes: { class: 'h-100' } do
- content_for :"#{post_id}_body" do

View file

@ -101,6 +101,7 @@
%input{ type: 'hidden', name: 'attribute', value: metadata.type }
- if metadata.inverse?
%input{ type: 'hidden', name: 'inverse', value: metadata.inverse }
%input{ type: 'hidden', name: metadata.inverse, value: post.uuid.value }
%div{ id: post_modal_id, data: { controller: 'modal' } }
= render 'bootstrap/modal', id: post_id, modal_content_attributes: { class: 'h-100' } do
- content_for :"#{post_id}_body" do

View file

@ -99,8 +99,10 @@
%input{ type: 'hidden', name: 'name', value: name }
%input{ type: 'hidden', name: 'form', value: form_id }
%input{ type: 'hidden', name: 'attribute', value: metadata.type }
-# @todo Forma genérica de arrastrar valores desde un formulario al siguiente
- if metadata.inverse?
%input{ type: 'hidden', name: 'inverse', value: metadata.inverse }
%input{ type: 'hidden', name: metadata.inverse, value: post.uuid.value }
%div{ id: post_modal_id, data: { controller: 'modal' } }
= render 'bootstrap/modal', id: post_id, modal_content_attributes: { class: 'h-100' } do
- content_for :"#{post_id}_body" do

View file

@ -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), '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', 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' }
%span.placeholder.w-100.h-100
- content_for :"#{id}_footer" do