NerdDiffer/job_tracker

View on GitHub
app/views/companies/_recruitments.html.erb

Summary

Maintainability
Test Coverage
<% if company.agency? %>
  <h2>Clients</h2>
  <%= link_to('+ Add new client',
          new_company_recruitment_path(company_id: company.id),
          class: 'add_new_member') %>
<% else %>
  <h2>Associated Agencies</h2>
  <%= link_to('+ Add new agency',
          new_company_recruitment_path(company_id: company.id),
          class: 'add_new_member') %>
<% end %>

<table class='table table-striped table-hover companies recruitments'>
  <thead>
    <tr>
      <th>Name</th>
      <th>Website</th>
      <th>Categories</th>
      <th>Actions</th>
    </tr>
  </thead>

  <tbody>
    <% company.companies_via_recruitments.each do |associated_company| %>
      <tr>
        <td><%= link_to associated_company.name, associated_company %></td>
        <td>
          <%= link_to(
            associated_company.website,
            interpolate_link(associated_company.website),
            target: '_blank'
          ) %>
        </td>
        <td><%= display_names(associated_company.category_names) %></td>
        <td><%= company.link_to_remove(associated_company.id) %></td>
      </tr>
    <% end %>
  </tbody>
</table>