Draiken/opinio

View on GitHub
app/views/opinio/comments/_comment.html.erb

Summary

Maintainability
Test Coverage
<% reply = defined?(reply) ? reply : false %>
<li id="comment_<%= comment.id %>">
  <span>User: <%= comment.owner.id %></span>
  <p>
    <%= simple_format(comment.body) %>
  </p>
  <% if comment.owner == current_commenter %>
    <%= link_to t('opinio.actions.delete'), comment_path(comment), :method => :delete, :remote => true %>
  <% end %>
  <%# this enables only 1 level of replies %>
  <% if Opinio.accept_replies && !reply %>
    <% if current_commenter %>
      <span><%= link_to t('opinio.actions.reply'), reply_comment_path(comment), :remote => true %></span>
    <% end %>
    <ul id="comment_<%= comment.id %>_replies" class="replies">
      <%= render :partial => "opinio/comments/comment", :collection => comment.comments, :locals => {:reply => true} %>
    </ul>
  <% end %>
</li>