mirror of
https://0xacab.org/sutty/sutty
synced 2025-03-15 04:28:17 +00:00
88 lines
2.8 KiB
Text
88 lines
2.8 KiB
Text
.row
|
|
.col
|
|
= render 'layouts/breadcrumb',
|
|
crumbs: [ link_to(t('sites.index'), sites_path),
|
|
@site.name,
|
|
link_to(t('posts.index'),
|
|
site_posts_path(@site)),
|
|
@post.title ]
|
|
|
|
.row
|
|
.col
|
|
%h1{class: @post.get_front_matter(:dir)}= @post.title
|
|
|
|
%p
|
|
- translations = @post.translations.map do |translation|
|
|
- link_to translation.title, site_post_path(@site, translation, lang: translation.lang)
|
|
= raw translations.join(' / ')
|
|
|
|
.row
|
|
.col
|
|
= link_to t('posts.edit'),
|
|
edit_site_post_path(@site, @post, lang: @lang),
|
|
class: 'btn btn-info'
|
|
|
|
.row
|
|
.col
|
|
.content{class: @post.get_front_matter(:dir)}
|
|
:markdown
|
|
#{@post.content}
|
|
|
|
-# 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
|
|
- @post.front_matter.each do |key, data|
|
|
%tr
|
|
%th= t("posts.#{key}")
|
|
%td
|
|
- if data.is_a? Array
|
|
-# Un Array de Hashes
|
|
- if data.all? { |a| a.is_a? Hash }
|
|
%table
|
|
%thead
|
|
%tr
|
|
- !data.empty? && 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
|
|
- if @post.image? key
|
|
%img.img-fluid{src: @site.get_url_for_sutty(data)}
|
|
- elsif @post.url? key
|
|
%a{href: @site.get_url_for_sutty(data)}= data
|
|
- else
|
|
= data
|