aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/refinery/blog/shared/_post.html.erb
blob: 5bf9c3c8e502796d32e9abb9148012888d59dde3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<% if post.live? %>
  <article class="blog_post" id="<%= dom_id(post) %>">
    <header>
      <h1><%= link_to post.title, refinery.blog_post_path(post) %></h1>
      <section class='details'>
        <time datetime="<%=l post.published_at.to_date, :format => :default %>" class='posted_at'>
          <%= t('created_at', :scope => 'refinery.blog.shared.posts', :when => l(post.published_at.to_date, :format => :short)) %>
        </time>
        <%= "#{t('by', :scope => 'refinery.blog.posts.show')} #{post.author.username}" if post.author.present? %>.
        <% if (categories = post.categories.translated).any? %>
          <aside class='filled_in'>
            <%= t('filled_in', :scope => 'refinery.blog.posts.show') %>
            <%=raw categories.collect { |category| link_to category.title, refinery.blog_category_path(category) }.to_sentence %>
          </aside>
        <% end %>
        <% if (tags = post.tags).any? %>
          <aside class='tagged'>
            <%= t('tagged', :scope => 'refinery.blog.posts.show') %>
            <%=raw tags.collect { |tag| link_to tag, refinery.blog_tagged_posts_path(tag.id, tag.name.parameterize) }.to_sentence %>
          </aside>
        <% end %>
      </section>
    </header>
    <section class='clearfix'>
      <% if blog_post_teaser_enabled? %>
        <%= blog_post_teaser(post) %>
      <% else %>
        <%= post.body.html_safe %>
      <% end %>
    </section>
    <footer>
      <p>
        <% if blog_post_teaser_enabled? && post.custom_teaser.present? %>
        <%= link_to t('read_more', :scope => 'refinery.blog.shared.posts'), refinery.blog_post_path(post) %>
        <% end %>
      </p>
      <% if Refinery::Blog::Post.comments_allowed? %>
        <aside class='comment_count'>
          <%= link_to "#{t('title', :scope => 'refinery.blog.posts.show.comments')} (#{post.comments.approved.count})", refinery.blog_post_path(post) << '#comments' %>
        </aside>
      <% end %>
    </footer>
  </article>
<% end %>