sanger/sequencescape

View on GitHub
app/views/shared/_comment.html.erb

Summary

Maintainability
Test Coverage
<% commentable ||= comment.commentable.becomes(comment.commentable.class.base_class) %>
<div class="comment-box">
  <div class="comment">
    <h5 class="comment-title"><%= comment.title %> <%= badge(commentable.class.name, style: 'info') %></h5>
    <div class="comment-description"><%= comment.description %></div>
  </div>
  <div  class="comment-metadata">
    Added by <%= comment.user.try(:login)||"Unknown user" %> <%= comment.created_at.to_formatted_s(:short)%>
    <% if can? :delete, comment %>
      <%= button_to 'Remove',
                    url_for([commentable, comment]),
                    form:{ data: { update: update_target }, class:'remote-form'},
                    method: :delete,
                    remote: true,
                    class: 'btn btn-danger' %>
    <% end %>
  </div>
</div>