<h2>Blog Posts</h2>

<%= render_template('../util/pager') %>

<table class="list posts" summary="List of all blog posts">
  <%= render_template('../util/table_sortheader') %>
  <tfoot></tfoot>
  <tbody>
    <% row = 'even' %>
    <% @posts.all do |post| %>
      <tr class="<%= row == 'even' ? row = 'odd' : row = 'even' %>">
        <td class="id"><%= post.id %></td>
        <td class="title">
          <a href="<%== post.url %>"><%== post.title %></a>
        </td>
        <td class="created">
          <%= post.created_at(Thoth::Config.timestamp.short) %>
        </td>
        <td class="updated">
          <%= post.updated_at(Thoth::Config.timestamp.short) %>
        </td>
      </tr>
    <% end %>

    <% if @pager.record_count == 0 %>
      <tr class="empty">
        <td colspan="4">
          No blog posts to display.
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= render_template('../util/pager') %>
