BathHacked/energy-sparks

View on GitHub
app/components/timeline_component/timeline_component.html.erb

Summary

Maintainability
Test Coverage
<div <%= "id=#{id}" if id %> class="timeline-component<%= classes %>">
  <table class="table timeline teachers">
    <% observations.group_by{|observation| [observation.at.strftime("%Y"), observation.at.strftime("%B")]}.each do |(year, month), grouped_observations|%>
      <thead>
        <tr>
          <th colspan="4">
            <h5><%= helpers.title_for_month(month, year) %></h5>
            <span class="text-muted">
              <%= t('components.timeline.action', count: grouped_observations.size) %>
            </span>
          </th>
        </tr>
      </thead>
      <tbody>
        <% grouped_observations.each do |observation| %>
          <tr scope="row">
            <td></td>
            <td class="timeline-border-left"></td>
            <%= component 'observation', observation: observation, show_actions: show_actions %>
          </tr>
        <% end %>
      </tbody>
    <% end %>
  </table>
</div>