5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2025-03-14 23:08:17 +00:00

Merge branch 'issue-15068' into production.panel.sutty.nl

This commit is contained in:
f 2024-07-02 13:58:59 -03:00
commit 3382ebafcc
No known key found for this signature in database
9 changed files with 37 additions and 5 deletions

View file

@ -18,6 +18,18 @@ class MetadataFile < MetadataTemplate
# XXX: Esto ayuda a deserializar en {Site#everything_of} # XXX: Esto ayuda a deserializar en {Site#everything_of}
def values; end def values; end
# Usar la descripción
def titleize?
true
end
# Devolver la descripción
#
# @return [String]
def to_s
value['description'].to_s
end
def validate def validate
super super

View file

@ -7,4 +7,13 @@ class MetadataPredefinedArray < MetadataArray
[v[I18n.locale.to_s], k] [v[I18n.locale.to_s], k]
end&.to_h end&.to_h
end end
# Devolver los valores legibles por humanes
#
# @todo Debería devolver los valores en el idioma del post, no de le
# usuarie
# @return [String]
def to_s
values.invert.select { |x, k| value.include?(x) }.values.join(', ')
end
end end

View file

@ -7,6 +7,11 @@ class MetadataTitle < MetadataString
false false
end end
# Siempre recalcular el título
def value
self[:value] = default_value
end
# Obtener todos los valores de texto del artículo y generar un título # Obtener todos los valores de texto del artículo y generar un título
# en base a eso. # en base a eso.
# #

View file

@ -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)

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -34,7 +34,7 @@
Para poder cancelar, mantenemos el estado original y desactivamos Para poder cancelar, mantenemos el estado original y desactivamos
o activamos los ítemes según estén incluidos en esa lista o no. o activamos los ítemes según estén incluidos en esa lista o no.
%ul.placeholder-glow{ data: { target: 'array.current' } } %ul.placeholder-glow{ data: { target: 'array.current' } }
- metadata.values.slice(*metadata.value).each_key do |value| - metadata.values.invert.slice(*metadata.value).each_value do |value|
= render 'posts/new_array_value', value: value = render 'posts/new_array_value', value: value
= render 'bootstrap/modal', id: id, modal_content_attributes: { class: 'h-100' }, hide_actions: ['array#cancel'], keydown_actions: %w[keydown->array#cancelWithEscape] do = render 'bootstrap/modal', id: id, modal_content_attributes: { class: 'h-100' }, hide_actions: ['array#cancel'], keydown_actions: %w[keydown->array#cancelWithEscape] do