Files
nairobi/app/components/sdg_management/targets/index_component.html.erb
Javi Martín 791ba73e12 Extract method to display a goal code and title
This is a pattern we're going to use in many places.
2020-12-21 18:27:27 +01:00

34 lines
945 B
Plaintext

<%= header %>
<%= render SDGManagement::SubnavigationComponent.new(current: :targets) do %>
<table>
<thead>
<tr>
<td></td>
<th id="target-title" scope="col"><%= attribute_name(:title) %></th>
</tr>
</thead>
<tbody>
<% targets.group_by(&:goal).map do |goal, targets| %>
<tr class="goal-header">
<th id="<%= header_id(goal) %>" colspan="2" scope="colgroup">
<%= goal.code_and_title %>
</th>
</tr>
<% targets.each do |target| %>
<tr id="<%= dom_id(target) %>" class="target">
<th headers="<%= header_id(goal) %>" id="<%= header_id(target) %>">
<%= target.code %>
</th>
<td headers="<%= header_id(goal) %> <%= header_id(target) %> target-title">
<%= target.title %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<% end %>