sutty/app/views/posts/show.haml

56 lines
1.5 KiB
Text
Raw Normal View History

2018-02-05 17:27:12 +00:00
.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 ]
2018-01-30 15:20:19 +00:00
.row
.col
2018-02-10 16:09:42 +00:00
%h1{class: @post.get_front_matter(:dir)}= @post.title
2018-01-30 15:20:19 +00:00
%p
- translations = @post.translations.map do |translation|
- link_to translation.title, site_post_path(@site, translation, lang: translation.lang)
= raw translations.join(' / ')
.row
.col
2018-02-23 19:20:51 +00:00
= link_to t('posts.edit'),
edit_site_post_path(@site, @post, lang: @lang),
class: 'btn btn-info'
2018-01-31 20:29:27 +00:00
.row
.col
2018-02-10 16:09:42 +00:00
.content{class: @post.get_front_matter(:dir)}
:markdown
#{@post.content}
2018-01-30 15:20:19 +00:00
%table.table.table-condensed.table-striped
%tbody
2018-03-14 17:46:17 +00:00
- hashes = {}
- @post.front_matter.each do |key, data|
2018-03-14 17:46:17 +00:00
- if data.is_a? Hash
- hashes[key] = data
- next
%tr
2018-03-14 17:46:17 +00:00
%th= t("posts.#{key}")
%td
2018-03-14 17:46:17 +00:00
- if data.is_a? Array
- data.each do |d|
%span.badge.badge-success= d
- elsif data.respond_to? :content
:markdown
#{data.content}
- elsif data.respond_to? :strftime
= data.strftime('%F')
- else
= data
2018-03-14 17:46:17 +00:00
- hashes.each do |key, data|
- data.each do |k,d|
%tr
%th= t("posts.#{key}.#{k}")
%td= d