summaryrefslogtreecommitdiff
path: root/app/views/blogposts/index.html.erb
blob: 9dadf42523af9e472ec65cf62ee10cec0182a849 (plain)
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
<% title "News" %>

<h1>News</h1>
<%= link_to 'Make new Post', new_blogpost_path, class: "btn blue" if mod? %>
<div id="posts">
  <% @posts.each do |p| %>
    <div class="item-group with-avatar" id="post-<%= p.id %>">
      <div class="header">
        <%= link_to(p.author.avatar(64), p.author, title: p.author.ign) %>
        <%= render partial: "users/username", locals: { user: p.author } %>
        <%= link_to p do %>
          <%= ago p.created_at %>
        <% end %>
        <span class="comment-counter">
          <%= link_to pluralize(p.comments.count, "Comment"), p %>
        </span>
        <div class="clear-right"></div>
      </div>
      <div class="items">
        <div class="item content post">
          <h2 class="headline"><%= link_to truncate(p.title, length: 60, omission: " …"), p %></h2>
          <%= render_md(p.content).html_safe %>
        </div>
      </div>
    </div>
  <% end %>
  <%= paginate @posts %>
</div>