bdurand/us_geo

View on GitHub
explorer_app/app/views/places/_table.html.erb

Summary

Maintainability
Test Coverage
<%
  zcta ||= nil
  overlap = (zcta)
%>

<table class="table table-striped sortable">
  <thead>
    <tr>
      <th>GEOID</th>
      <th>Name</th>
      <th>Primary County</th>
      <th>FIPS Class Code</th>

      <%= demographics_headers %>

      <% if overlap %>
        <th class="text-end">Overlap</th>
      <% end %>
    </th>
  </thead>
  <tbody>
    <% places.each do |place| %>
      <tr>
        <td><%= place.geoid %></td>
        <td><%= link_to place.name, place_path(place, breadcrumb_params) %></td>
        <td>
          <% if place.primary_county %>
            <%= link_to place.primary_county.full_name, county_path(place.primary_county, breadcrumb_params) %>
          <% else %>
            -
          <% end %>
        </td>
        <td><%= place.fips_class_code %></td>

        <%= demographics_cells(place, round_area: 1) %>

        <% if overlap %>
          <td class="text-end">
            <% if zcta %>
              <%= overlap_percentage(zcta, place, :zcta_places) %>
            <% end %>
          </td>
        <% end %>
      </tr>
    <% end %>
  </tbody>
</table>