2024-05-23 21:20:20 +00:00
|
|
|
:ruby
|
|
|
|
image = nil
|
|
|
|
description = nil
|
2024-07-11 18:56:11 +00:00
|
|
|
card_id = random_id
|
2024-05-23 21:20:20 +00:00
|
|
|
|
|
|
|
if post.post.attribute?(:image) && (image = post.post.image.static_file)
|
|
|
|
description = post.post.image.value['description']
|
|
|
|
end
|
|
|
|
|
2024-07-11 18:56:11 +00:00
|
|
|
.col.mb-3.p-1{ id: card_id, data: { controller: 'modal' } }
|
2024-05-23 21:20:20 +00:00
|
|
|
= render('bootstrap/card', image: image, description: description, title: post.title, class: 'h-100') do
|
|
|
|
- if post.post.attribute?(:description)
|
|
|
|
%p.card-text= post.post.description.value
|
|
|
|
|
2024-07-11 18:56:11 +00:00
|
|
|
-#
|
|
|
|
Si pasamos el ID del modal, asumimos que hay uno que ya existe y
|
|
|
|
lo llamamos. Sino, tenemos que abrir el modal genérico y cargarle
|
|
|
|
el formulario vía "HTMX".
|
|
|
|
|
|
|
|
- if local_assigns[:modal_id].present?
|
|
|
|
= render 'bootstrap/btn', content: t('.edit'), data: { action: 'modal#showAnother', 'modal-show-value': local_assigns[:modal_id] }, id: random_id
|
|
|
|
- else
|
|
|
|
- form_params = {}
|
|
|
|
- form_params[:layout] = post.layout
|
|
|
|
- form_params[:uuid] = post.post_id
|
|
|
|
- form_params[:modal_id] = form_params[:show] = modal_id = random_id
|
|
|
|
-# Asociar un modal con una tarjeta
|
|
|
|
- form_params[:result_id] = card_id
|
|
|
|
|
|
|
|
-# @todo Poder indicar en qué elemento queremos asociar lo descargado
|
|
|
|
= render 'bootstrap/btn', content: t('.edit'), data: { controller: 'htmx', action: 'modal#showAnother htmx#getUrlOnce', 'modal-show-value': modal_id, 'htmx-get-url-param': site_posts_modal_path(post.site, **form_params) }, id: random_id
|