2019-07-29 18:20:19 +00:00
|
|
|
- tags = %w[h1 h2 h3 h4 h5 h6 p a ul ol li table tr td th tbody thead tfoot em strong sup blockquote cite pre]
|
|
|
|
|
2018-02-05 17:27:12 +00:00
|
|
|
.row
|
|
|
|
.col
|
|
|
|
= render 'layouts/breadcrumb',
|
2019-07-29 18:20:19 +00:00
|
|
|
crumbs: [link_to(t('sites.index'), sites_path),
|
|
|
|
@site.name,
|
|
|
|
link_to(t('posts.index'),
|
|
|
|
site_posts_path(@site)),
|
|
|
|
@post.title]
|
2018-02-05 17:27:12 +00:00
|
|
|
|
2018-01-30 15:20:19 +00:00
|
|
|
.row
|
2018-02-03 22:37:09 +00:00
|
|
|
.col
|
2019-07-29 18:20:19 +00:00
|
|
|
%h1{ class: @post.get_front_matter(:dir) }= @post.title
|
2018-01-30 15:20:19 +00:00
|
|
|
|
2018-02-24 21:24:11 +00:00
|
|
|
%p
|
|
|
|
- translations = @post.translations.map do |translation|
|
2019-07-29 18:20:19 +00:00
|
|
|
- link_to translation.title,
|
|
|
|
site_post_path(@site, translation, lang: translation.lang)
|
2018-02-24 21:24:11 +00:00
|
|
|
= raw translations.join(' / ')
|
|
|
|
|
2018-02-03 22:37:09 +00:00
|
|
|
.row
|
|
|
|
.col
|
2018-02-23 19:20:51 +00:00
|
|
|
= link_to t('posts.edit'),
|
|
|
|
edit_site_post_path(@site, @post, lang: @lang),
|
2018-02-03 22:37:09 +00:00
|
|
|
class: 'btn btn-info'
|
2018-01-31 20:29:27 +00:00
|
|
|
|
2018-02-03 22:37:09 +00:00
|
|
|
.row
|
|
|
|
.col
|
2019-07-29 18:20:19 +00:00
|
|
|
.content{ class: @post.get_front_matter(:dir) }
|
|
|
|
= sanitize_markdown @post.content,
|
|
|
|
tags: tags
|
2018-01-30 15:20:19 +00:00
|
|
|
|
2019-07-29 18:20:19 +00:00
|
|
|
-#
|
|
|
|
Representar los datos en una tabla:
|
|
|
|
Texto: tal cual en una celda
|
|
|
|
Array: píldoras
|
|
|
|
Array de Hashes: Tabla
|
|
|
|
Hash: Tabla
|
|
|
|
TODO DRY
|
2018-06-27 23:08:30 +00:00
|
|
|
%table.table.table-condensed.table-striped.table-responsive
|
2018-02-03 22:37:09 +00:00
|
|
|
%tbody
|
|
|
|
- @post.front_matter.each do |key, data|
|
|
|
|
%tr
|
2018-03-14 17:46:17 +00:00
|
|
|
%th= t("posts.#{key}")
|
2018-02-03 22:37:09 +00:00
|
|
|
%td
|
2018-03-14 17:46:17 +00:00
|
|
|
- if data.is_a? Array
|
2018-06-27 23:08:30 +00:00
|
|
|
-# Un Array de Hashes
|
|
|
|
- if data.all? { |a| a.is_a? Hash }
|
|
|
|
%table
|
|
|
|
%thead
|
|
|
|
%tr
|
2018-06-27 23:13:47 +00:00
|
|
|
- !data.empty? && data.first.keys.each do |k|
|
2018-06-27 23:08:30 +00:00
|
|
|
%th= k.humanize
|
|
|
|
%tbody
|
|
|
|
- data.each do |r|
|
|
|
|
%tr
|
2019-07-29 18:20:19 +00:00
|
|
|
- r.each do |_, v|
|
2018-06-27 23:08:30 +00:00
|
|
|
%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
|
2018-02-03 22:37:09 +00:00
|
|
|
- elsif data.respond_to? :content
|
2018-06-27 23:08:30 +00:00
|
|
|
-# Contenido del artículo
|
2019-07-29 18:20:19 +00:00
|
|
|
= sanitize_markdown data.content, tags: tags
|
2018-02-03 22:37:09 +00:00
|
|
|
- elsif data.respond_to? :strftime
|
2018-06-27 23:08:30 +00:00
|
|
|
-# Fecha
|
2018-02-03 22:37:09 +00:00
|
|
|
= data.strftime('%F')
|
|
|
|
- else
|
2018-06-27 23:08:30 +00:00
|
|
|
-# Texto
|
2018-07-02 22:07:06 +00:00
|
|
|
- if @post.image? key
|
2019-07-29 18:20:19 +00:00
|
|
|
%img.img-fluid{ src: @site.get_url_for_sutty(data) }
|
2018-07-02 22:07:06 +00:00
|
|
|
- elsif @post.url? key
|
2019-07-29 18:20:19 +00:00
|
|
|
%a{ href: @site.get_url_for_sutty(data) }= data
|
2018-07-02 22:07:06 +00:00
|
|
|
- else
|
|
|
|
= data
|