holderdeord/hdo-site

View on GitHub
app/views/shared/_representatives_table.html.erb

Summary

Maintainability
Test Coverage
<p class="pull-right"><%= t('app.counts.representative', :count => representatives.size).html_safe %></p>

<table class="table table-striped">
  <thead>
    <tr>
      <th><%= Representative.human_attribute_name :name %></th>

      <% if show_party %>
        <th><%= Representative.human_attribute_name :party %></th>
      <% end %>

      <% if show_district %>
        <th><%= Representative.human_attribute_name :district %></th>
      <% end %>

      <th>Møtende</th>
      <th>Vara</th>
    </tr>
  </thead>
  <tbody>
      <% representatives.each do |rep| %>
      <tr>
        <td><%= link_to rep.display_name, rep %></td>

        <% if show_party && rep.latest_party %>
          <td><%= link_to rep.latest_party.name, rep.latest_party %></td>
        <% end %>

        <% if show_district %>
          <td><%= link_to rep.district.name, rep.district %></td>
        <% end %>

        <td><% if rep.attending? %>&#9733;<% end %></td>
        <td><% if rep.substitute? %>&#9733;<% end %></td>
      </tr>

      <% end %>
  </tbody>
</table>