Files
grecia/app/components/admin/budget_groups/groups_component.html.erb
Javi Martín 6a2c01b119 Extract method to render an admin table action
This way it will be easier to change the behavior of all table actions,
like adding ARIA attributes. In the past, when we changed the behavior
of the `link_to` method, we had to change all table action classes.
2021-09-20 20:27:37 +02:00

34 lines
1.1 KiB
Plaintext

<% if groups.any? %>
<h3><%= t("admin.budget_groups.amount", count: groups.count) %></h3>
<table>
<thead>
<tr id="<%= dom_id(budget) %>">
<th><%= t("admin.budget_groups.name") %></th>
<th><%= Budget::Group.human_attribute_name(:max_votable_headings) %></th>
<th><%= t("admin.budget_groups.headings_name") %></th>
<th><%= t("admin.actions.actions") %></th>
</tr>
</thead>
<tbody>
<% groups.each do |group| %>
<tr id="<%= dom_id(group) %>">
<td><%= group.name %></td>
<td><%= group.max_votable_headings %></td>
<td><%= group.headings.count %></td>
<td>
<%= render Admin::TableActionsComponent.new(group) do |actions| %>
<%= actions.action(:headings,
text: t("admin.budget_groups.headings_manage"),
path: headings_path(group)) %>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="callout primary clear">
<%= t("admin.budget_groups.no_groups") %>
</div>
<% end %>