app/views/schools/interventions/index.html.erb
<h1><%= t('interventions.index.title') %></h1>
<% if can? :create, Observation %>
<p><%= link_to t('interventions.index.record_action'), intervention_type_groups_path, class: 'btn btn-primary' %></p>
<% end %>
<table class="table table-borderless">
<% @interventions.group_by{|intervention| [intervention.at.year, intervention.at.month]}.each do |(year, month), interventions|%>
<thead>
<tr>
<th colspan="3">
<span class="float-right"><%= t('common.action', count: interventions.size) %></span>
<h2><%= t_month(month) %> <span class="h3"><%= year %></span></h2>
</th>
</tr>
</thead>
<tbody>
<% interventions.each do |intervention| %>
<tr scope="row">
<td class="p-3 text-center">
<%= fa_icon("#{intervention.intervention_type.intervention_type_group.icon} fa-2x") %>
</td>
<td>
<h4><%= link_to intervention.intervention_type.name, school_intervention_path(@school, intervention)%></h4>
<%= nice_dates(intervention.at) %>
</td>
<td class="text-right">
<% if can?(:manage, intervention) %>
<div class="btn-group">
<%= link_to t('common.labels.edit'), edit_school_intervention_path(@school, intervention), class: 'btn btn-warning' %>
<%= link_to t('common.labels.delete'), school_intervention_path(@school, intervention), method: :delete, data: { confirm: t('common.confirm') }, class: 'btn btn-danger' %>
</div>
<% end %>
</td>
</tr>
<% end %>
</tbody>
<% end %>
</table>