NerdDiffer/job_tracker

View on GitHub
app/views/notes/index.html.erb

Summary

Maintainability
Test Coverage
<% @page_title = "Notes" %>

<h1 class='allow_inline'>Notes</h1>

<%= render 'faq' %>

<table class='table table-striped table-hover notes index'>
  <thead>
    <tr>
      <th><%= generate_sortable_link('updated_at', title: 'Updated') %></th>
      <th>Connected to</th>
      <th class='contents'>Contents</th>
      <th class='actions'>Actions</th>
    </tr>
  </thead>

  <tbody>
    <% notes = NoteDecorator.decorate_collection(@notes) %>
    <% notes.each do |note| %>
      <% default_link_dest = [note.notable, note] %>
      <% updated_at = note.updated_at.to_s('month date year')%>
      <tr>
        <td><%= link_to updated_at, default_link_dest %></td>
        <td><%= link_to note.notable_name, note.link_destination %></td>
        <td class='contents'>
          <%= link_to(truncate(note.content), default_link_dest) %>
        </td>
        <td>
          <%= link_to 'Edit', [:edit, note.notable, note] %><br />
          <%= link_to 'Delete', default_link_dest, delete_link_opts %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>