5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-07 11:25:46 +00:00

ver los datos de la ficha #51

This commit is contained in:
f 2018-06-27 20:08:30 -03:00
parent ae8856334c
commit c287ec649a
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7

View file

@ -28,28 +28,56 @@
:markdown
#{@post.content}
%table.table.table-condensed.table-striped
-# Representar los datos en una tabla:
-# Texto: tal cual en una celda
-# Array: píldoras
-# Array de Hashes: Tabla
-# Hash: Tabla
-# TODO DRY
%table.table.table-condensed.table-striped.table-responsive
%tbody
- hashes = {}
- @post.front_matter.each do |key, data|
- if data.is_a? Hash
- hashes[key] = data
- next
%tr
%th= t("posts.#{key}")
%td
- if data.is_a? Array
- data.each do |d|
%span.badge.badge-success= d
-# Un Array de Hashes
- if data.all? { |a| a.is_a? Hash }
%table
%thead
%tr
- data.first.keys.each do |k|
%th= k.humanize
%tbody
- data.each do |r|
%tr
- r.each do |_,v|
%td
- if v.is_a? Array
- v.each do |s|
%span.badge.badge-secondary= s
- else
= v
- else
- data.each do |d|
%span.badge.badge-secondary= d
- elsif data.is_a? Hash
%table
%thead
%tr
- data.keys.each do |k|
%th= k.humanize
%tbody
%tr
- data.each do |_, v|
%td= v
- elsif data.respond_to? :content
-# Contenido del artículo
:markdown
#{data.content}
- elsif data.respond_to? :strftime
-# Fecha
= data.strftime('%F')
- else
-# Texto
= data
- hashes.each do |key, data|
- data.each do |k,d|
%tr
%th= t("posts.#{key}.#{k}")
%td= d