ruby-rcade/RubyGameDev.com

View on GitHub
app/views/posts/_list.html.erb

Summary

Maintainability
Test Coverage
<table class="posts table">
  <tbody>
    <% @posts.each do |post| %>
      <tr>
        <td>
          <% if post.instance_of? Guide %>
            <%= image_tag 'Guide.png', alt: 'Guides', class: 'guide-xs pull-left show', width: 25 %>
          <% end %> 
          <%= link_to post.title, post_path(post) %>
          <br><span class="text-muted">Submitted by <%= post.username %> on <%= post.created_at.strftime("%m/%d/%Y") %></span>
          <br><%= render 'posts/tags', post: post %>
        </td>
        <td>
          <%= render 'votes/vote', post: post %>
          <span class="badge pull-right" title="<%= pluralize(post.number_of_comments, 'comment') %>"><%= post.number_of_comments %></span>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>