NerdDiffer/job_tracker

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

Summary

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

<h1>Contacts</h1>

<p>
  <%= link_to new_contact_path, class: 'add_new_member' do %>
    <i class='fa fa-plus'><span>New Contact</span></i>
  <% end %>
</p>

<table class='table table-striped table-hover contacts index'>
  <thead>
    <tr>
      <th class='name'>
        <%= generate_sortable_link('name') %>
      </th>
      <th class='company'>
        <%= generate_sortable_link('company_name', title: 'Company') %>
      </th>
      <th class='phone email'>Phone &amp; Email</th>
      <th class='actions'>Actions</th>
    </tr>
  </thead>

  <tbody>
    <% contacts = ContactDecorator.decorate_collection(@contacts) %>
    <% contacts.each do |contact| %>
      <tr>
        <td><%= link_to(contact.name, contact) %></td>
        <td><%= contact.link_to_company %></td>
        <td><%= contact.phone_and_email %></td>
        <td>
          <%= link_to 'Edit', edit_contact_path(contact) %><br />
          <%= link_to 'Delete', contact, delete_link_opts %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>