Files
grecia/app/components/sdg_management/targets/index_component.html.erb
Javi Martín c025fef50b Add short titles to SDG targets
Since targets didn't have a title but only a long description, every
form allowing to select targets was pretty much unusable: we either
displayed just the code or the whole description.

Now, with a concise title, it's easier to find and select the desired
target.

The titles have been copied from The Global Goals page [1].

Note we're using the `short_title` I18n key for the `title` method and
the `long_title` I18n key for the `long_title` method. We can't use
`title` as I18n key instead of `short_title` because it would affect
existing translations.

[1] https://www.globalgoals.org/
2021-10-01 16:19:10 +02:00

34 lines
950 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.long_title %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
<% end %>