5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-15 04:21:41 +00:00

mostrar todas las imagenes

This commit is contained in:
f 2018-07-20 15:17:34 -03:00
parent e0ce6700f7
commit 9fd73d0c38
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
2 changed files with 8 additions and 3 deletions

View file

@ -262,9 +262,11 @@ class Post
# Detecta si un valor es un archivo
def url?(name)
path = get_front_matter(name)
return false unless path.is_a? String
return false unless path.is_a?(String) || path.is_a?(Array)
# El primer valor es '' porque la URL empieza con /
path.split('/').second == 'public'
[path].flatten.map do |p|
p.split('/').second == 'public'
end.all?
end
def image?(name)

View file

@ -1,5 +1,8 @@
- if @post.url? name
%img.img-fluid{src: @site.get_url_for_sutty(@post.get_front_matter(name))}
.row
- [@post.get_front_matter(name)].flatten.each do |url|
.col
%img.img-fluid{src: @site.get_url_for_sutty(url)}
- name = [name,''] if template.multiple?
= file_field_tag field_name_for_post_as_string(name),
class: 'form-control',