mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 06:46:23 +00:00
fix: no romper relaciones!
This commit is contained in:
parent
a344c16f4d
commit
3a2005e54a
5 changed files with 10 additions and 4 deletions
|
@ -85,11 +85,13 @@
|
||||||
|
|
||||||
= hidden_field_tag "#{base}[layout]", post.layout.name
|
= 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
|
= 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|
|
- except.each do |attr|
|
||||||
%input{ type: 'hidden', name: "#{base}[#{attr}]", value: "" }
|
%input{ type: 'hidden', name: "#{base}[#{attr}]", value: params[attr].presence }
|
||||||
|
|
||||||
= yield(:post_form)
|
= yield(:post_form)
|
||||||
|
|
|
@ -100,6 +100,7 @@
|
||||||
%input{ type: 'hidden', name: 'attribute', value: metadata.type }
|
%input{ type: 'hidden', name: 'attribute', value: metadata.type }
|
||||||
- if metadata.inverse?
|
- if metadata.inverse?
|
||||||
%input{ type: 'hidden', name: 'inverse', value: 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' } }
|
%div{ id: post_modal_id, data: { controller: 'modal' } }
|
||||||
= render 'bootstrap/modal', id: post_id, modal_content_attributes: { class: 'h-100' } do
|
= render 'bootstrap/modal', id: post_id, modal_content_attributes: { class: 'h-100' } do
|
||||||
- content_for :"#{post_id}_body" do
|
- content_for :"#{post_id}_body" do
|
||||||
|
|
|
@ -101,6 +101,7 @@
|
||||||
%input{ type: 'hidden', name: 'attribute', value: metadata.type }
|
%input{ type: 'hidden', name: 'attribute', value: metadata.type }
|
||||||
- if metadata.inverse?
|
- if metadata.inverse?
|
||||||
%input{ type: 'hidden', name: 'inverse', value: 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' } }
|
%div{ id: post_modal_id, data: { controller: 'modal' } }
|
||||||
= render 'bootstrap/modal', id: post_id, modal_content_attributes: { class: 'h-100' } do
|
= render 'bootstrap/modal', id: post_id, modal_content_attributes: { class: 'h-100' } do
|
||||||
- content_for :"#{post_id}_body" do
|
- content_for :"#{post_id}_body" do
|
||||||
|
|
|
@ -99,8 +99,10 @@
|
||||||
%input{ type: 'hidden', name: 'name', value: name }
|
%input{ type: 'hidden', name: 'name', value: name }
|
||||||
%input{ type: 'hidden', name: 'form', value: form_id }
|
%input{ type: 'hidden', name: 'form', value: form_id }
|
||||||
%input{ type: 'hidden', name: 'attribute', value: metadata.type }
|
%input{ type: 'hidden', name: 'attribute', value: metadata.type }
|
||||||
|
-# @todo Forma genérica de arrastrar valores desde un formulario al siguiente
|
||||||
- if metadata.inverse?
|
- if metadata.inverse?
|
||||||
%input{ type: 'hidden', name: 'inverse', value: 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' } }
|
%div{ id: post_modal_id, data: { controller: 'modal' } }
|
||||||
= render 'bootstrap/modal', id: post_id, modal_content_attributes: { class: 'h-100' } do
|
= render 'bootstrap/modal', id: post_id, modal_content_attributes: { class: 'h-100' } do
|
||||||
- content_for :"#{post_id}_body" do
|
- content_for :"#{post_id}_body" do
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
= render 'bootstrap/modal', id: id, modal_content_attributes: { class: 'h-100' } do
|
= render 'bootstrap/modal', id: id, modal_content_attributes: { class: 'h-100' } do
|
||||||
- content_for :"#{id}_body" do
|
- content_for :"#{id}_body" do
|
||||||
-# @todo ocultar el modal después de guardar
|
-# @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
|
%span.placeholder.w-100.h-100
|
||||||
|
|
||||||
- content_for :"#{id}_footer" do
|
- content_for :"#{id}_footer" do
|
||||||
|
|
Loading…
Reference in a new issue