mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 20:16:23 +00:00
feat: mostrar los posts relacionados como tarjetas
This commit is contained in:
parent
9b3db70bf4
commit
ba9c0ad953
4 changed files with 28 additions and 3 deletions
9
app/views/bootstrap/_card.haml
Normal file
9
app/views/bootstrap/_card.haml
Normal file
|
@ -0,0 +1,9 @@
|
|||
.card{ **local_assigns.except(:image, :description) }
|
||||
- if local_assigns[:image]
|
||||
= render 'bootstrap/responsive' do
|
||||
= image_tag url_for(local_assigns[:image]), alt: local_assigns[:description], class: 'img-fluid'
|
||||
|
||||
.card-body
|
||||
.card-title= title
|
||||
|
||||
= yield
|
4
app/views/bootstrap/_responsive.haml
Normal file
4
app/views/bootstrap/_responsive.haml
Normal file
|
@ -0,0 +1,4 @@
|
|||
- local_assigns[:ratio] ||= '1by1'
|
||||
|
||||
.embed-responsive{ class: "embed-responsive-#{local_assigns[:ratio]}" }
|
||||
.embed-responsive-item= yield
|
|
@ -1,2 +1,14 @@
|
|||
.col
|
||||
%p= link_to post.title, post.path
|
||||
:ruby
|
||||
image = nil
|
||||
description = nil
|
||||
|
||||
if post.post.attribute?(:image) && (image = post.post.image.static_file)
|
||||
description = post.post.image.value['description']
|
||||
end
|
||||
|
||||
.col.mb-3
|
||||
= 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
|
||||
|
||||
= link_to 'Editar', post.path, class: 'btn btn-secondary'
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
Para poder cancelar, mantenemos el estado original y desactivamos
|
||||
o activamos los ítemes según estén incluidos en esa lista o no.
|
||||
.row.row-cols-1.row-cols-md-2{ data: { target: 'array.current' } }
|
||||
.row.row-cols-3.row-cols-md-4{ data: { target: 'array.current' } }
|
||||
- metadata.values.slice(*metadata.value).each do |value|
|
||||
= render 'posts/new_array_value', value: value
|
||||
|
||||
|
|
Loading…
Reference in a new issue