<div class="card">
  <div class="card-header">
    Editor notes
  </div>
  <div class="card-body">
    <% if paper.notes.any? %>
      <table class="comments-table" id="paper-notes" style="margin-bottom:20px;">
        <tbody>
        <% paper.notes.each do |note| %>
        <tr>
          <td width="50px">
            <%= image_tag(avatar(note.editor.login), size: "24x24", class: "avatar", title: note.editor.full_name) %></td>
          <td>
            <%= note.comment %>
            <div class="time">
              <%= time_ago_in_words(note.created_at) %> ago.
              <%= link_to("Delete note", paper_note_path(paper,note), data: { turbo_method: :delete }) if note.editor == current_user.editor %>
            </div>
          </td>
        </tr>
        <% end %>
        </tbody>
      </table>
    <% end %>

    <%= form_for [paper, Note.new] do |f| %>
      <div class="form-group">
        <div class="row">
          <div class="col">
            <%= f.text_area :comment, class: "form-control", placeholder: "Your note to other editors" %>
          </div>
        </div>
      </div>

      <div class="form-group">
        <div class="row">
          <div class="col-md-3">
            <%= f.submit "Add note", form_class: "left", class: "btn btn-light btn-sm" %>
          </div>
        </div>
      </div>
    <% end %>
  </div>

  <div class="card-footer">
    <small class="text-muted">Comments on the paper to share context on this submission between editors.</small>
  </div>
</div>
<br />