libertarian-party/partynest

View on GitHub
app/views/staffs/people/person_comments/_list.html.erb

Summary

Maintainability
Test Coverage
<% person_comments.each_with_index do |person_comment, index| %>
  <% unless index.zero? %>
    <hr class="my-0"/>
  <% end %>

  <div class="card border-light">
    <div class="card-body">
      <p class="card-text">
        <% if person_comment.origin %>
          <strong>
            <%= translate_enum :person_comment_origin, person_comment.origin %>
          </strong>

          <br/>
        <% end %>

        <%= person_comment.text %>

        <% if person_comment.attachment.attached? %>
          <br/>

          <small>
            <i class="fas fa-paperclip"></i>
            <%= link_to person_comment.attachment.blob.filename.to_s,
                        rails_blob_path(person_comment.attachment.blob,
                                        disposition: 'download') %>
          </small>
        <% end %>
      </p>

      <p class="card-text">
        <small class="text-muted">
          <%= localize person_comment.created_at, format: :long %>
          <% if person_comment.account %>
            &bull;
            <%= link_to person_comment.account.nickname,
                        person_comment.account %>
          <% end %>
        </small>
      </p>
    </div>
  </div>
<% end %>