aboutsummaryrefslogtreecommitdiffstats
path: root/app/views/blog/shared/_post.html.erb
blob: 2e92f73bc25cf06bc74fbe69413fdc195df39360 (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
<% if post.live? %>
  <article class="blog_post" id="<%= dom_id(post) %>">
    <header>
      <h1><%= link_to post.title, blog_post_url(post) %></h1>
      <details>
        <time datetime="<%=l post.published_at.to_date, :format => :default %>" class='posted_at'>
          <%= t('blog.shared.posts.created_at', :when => l(post.published_at.to_date, :format => :short)) %>.
        </time><%= " by #{post.author.username}" if post.author.present? %>
        <% if (categories = post.categories).any? %>
          <aside class='filed_in'>
            <%= t('filed_in', :scope => 'blog.posts.show') %>
            <% categories.each_with_index do |category, index| %>
              <%= link_to category.title, blog_category_url(category) -%><%= ',' if index < ((categories.length) - 1) %>
            <% end %>
          </aside>
        <% end %>
      </details>
    </header>
    <section class='clearfix'>
      <%= truncate(post.body,
                   :length => RefinerySetting.find_or_set(:blog_post_teaser_length, 250),
                   :preserve_html_tags => true) %>
    </section>
    <footer>
      <p>
        <%= link_to t('blog.shared.posts.read_more'), blog_post_url(post) %>
      </p>
      <aside class='comment_count'>
        <% if BlogPost.comments_allowed? %>
          <% if post.comments.any? %>
             (<%= pluralize(post.comments.approved.count, t('blog.shared.comments.singular')) %>)
          <% else %>
                (<%= t('blog.shared.comments.none') %>)
          <% end %>
        <% end %>
      </aside>
    </footer>
  </article>
<% end %>