libertarian-party/partynest

View on GitHub
app/views/staffs/relation_statuses/_table.html.erb

Summary

Maintainability
Test Coverage
<table class="table">
  <thead>
    <tr>
      <th scope="col">
        <%= RelationStatus.human_attribute_name :org_unit_kind %>
      </th>
      <th scope="col">
        <%= RelationStatus.human_attribute_name :codename %>
      </th>
      <th scope="col">
        <%= RelationStatus.human_attribute_name :name %>
      </th>
      <th scope="col"></th>
    </tr>
  </thead>

  <tbody>
    <% relation_statuses.each do |relation_status| %>
      <tr>
        <td scope="row">
          <% if policy([:staff, relation_status.org_unit_kind]).show? %>
            <%= link_to relation_status.org_unit_kind.short_name,
                        [:staff, relation_status.org_unit_kind] %>
          <% else %>
            <%= relation_status.org_unit_kind.short_name %>
          <% end %>
        </td>
        <td><%= relation_status.codename %></td>
        <td><%= relation_status.name %></td>
        <td>
          <% if policy([:staff, relation_status]).show? %>
            <%= open_action [:staff, relation_status] %>
          <% end %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>