Files
grecia/app/components/sdg/goals/targets_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

29 lines
1.0 KiB
Plaintext

<section class="sdg-goal-targets">
<ul class="tabs" id="goal_<%= goal.code %>_targets" data-deep-link="true" data-tabs>
<% [global_targets, local_targets].each do |targets| %>
<li class="tabs-title <%= active(targets) %>">
<%= link_to title(targets), "#goal_#{@goal.code}_tab_#{type(targets)}_targets" %>
</li>
<% end %>
</ul>
<div class="tabs-content" data-tabs-content="goal_<%= goal.code %>_targets">
<% [global_targets, local_targets].each do |targets| %>
<div class="tabs-panel <%= active(targets) %>" id="goal_<%= goal.code %>_tab_<%= type(targets) %>_targets">
<% if targets.blank? %>
<div class="callout primary">
<%= t("sdg.goals.show.targets.no_local_targets") %>
</div>
<% else %>
<dl>
<% targets.sort.each do |target| %>
<dt><%= target.code %><dt>
<dd><%= target.long_title %><dd>
<% end %>
</dl>
<% end %>
</div>
<% end %>
</div>
</section>