5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 20:16:22 +00:00
panel/app/views/posts/show.haml

42 lines
1.4 KiB
Text
Raw Normal View History

- dir = t("locales.#{@locale}.dir")
2020-06-25 20:15:43 +00:00
.row.justify-content-center
.col-md-8
2020-07-22 23:37:26 +00:00
%article.content.table-responsive-md
= link_to t('posts.edit'),
edit_site_post_path(@site, @post.id),
2019-09-12 16:55:20 +00:00
class: 'btn btn-block'
- unless @post.layout.ignored?
= link_to t('posts.preview.btn'),
site_post_preview_path(@site, @post.id),
class: 'btn btn-block',
target: '_blank',
rel: 'noopener'
2018-01-30 15:20:19 +00:00
2020-07-22 23:37:26 +00:00
%table.table.table-condensed
%thead
%tr
%th.text-center{ colspan: 2 }= t('.front_matter')
%tbody
2019-08-23 18:29:07 +00:00
- @post.attributes.each do |attr|
2020-08-05 15:29:11 +00:00
- metadata = @post[attr]
2019-08-23 18:29:07 +00:00
- next unless metadata.front_matter?
2018-01-31 20:29:27 +00:00
- cache [metadata, I18n.locale] do
2020-11-11 20:00:09 +00:00
= render("posts/attribute_ro/#{metadata.type}",
post: @post, attribute: attr,
metadata: metadata,
site: @site,
tags: all_html_tags,
locale: @locale,
dir: dir)
2018-01-30 15:20:19 +00:00
-# Mostrar todo lo que no va en el front_matter (el contenido)
- @post.attributes.each do |attr|
2020-11-11 22:49:44 +00:00
- metadata = @post[attr]
2020-11-11 20:00:09 +00:00
- next if metadata.front_matter?
- cache [metadata, I18n.locale] do
2020-11-17 23:46:55 +00:00
%section.editor{ id: attr, dir: dir }
2020-11-11 20:00:09 +00:00
= @post.public_send(attr).to_s.html_safe