We can extract a method to reduce the amount of ERB code and remove the duplication in the link texts. We also make the list consistent; now we always use a <strong> tag in the group name, no matter whether there are many groups or only one.
12 lines
311 B
Plaintext
12 lines
311 B
Plaintext
<div class="budget-group-switcher">
|
|
<% if other_groups.one? %>
|
|
<p>
|
|
<%= currently_showing_text %>
|
|
<%= link_to_group(other_groups.first) %>
|
|
</p>
|
|
<% else %>
|
|
<p><%= currently_showing_text %></p>
|
|
<%= link_list(*other_groups.map { |group| link_to_group(group) }) %>
|
|
<% end %>
|
|
</div>
|