Files
grecia/app/views/admin/budgets/_group.html.erb
2018-07-13 11:46:09 +02:00

50 lines
2.1 KiB
Plaintext

<% max_headings_label = t('admin.budgets.form.current_of_max_headings', current: group.max_votable_headings, max: group.headings.count ) %>
<table>
<thead>
<tr>
<th colspan="4" class="with-button">
<%= content_tag(:span, group.name, class:"group-toggle-#{group.id}", id:"group-name-#{group.id}") %>
<span class="max_headings_label" style="margin-left: 10px; font-size: 0.9em; color: gray;">
<%= t("admin.budgets.form.max_votable_headings")%>
<strong style="font-weight: bold; color: black;"><%= max_headings_label %></strong>
</span>
<%= render 'admin/budgets/group_form', budget: @budget, group: group, id: "group-form-#{group.id}", button_title: t("admin.budgets.form.submit"), css_class: "group-toggle-#{group.id}" %>
<%= link_to t("admin.budgets.form.edit_group"), "#", class: "button float-right js-toggle-link hollow", data: { "toggle-selector" => ".group-toggle-#{group.id}" } %>
<%= link_to t("admin.budgets.form.add_heading"), "#", class: "button float-right js-toggle-link", data: { "toggle-selector" => "#group-#{group.id}-new-heading-form" } %>
</th>
</tr>
<% if headings.present? %>
<tr>
<th><%= t("admin.budgets.form.table_heading") %></th>
<th class="text-right"><%= t("admin.budgets.form.table_amount") %></th>
<th class="text-right"><%= t("admin.budgets.form.table_population") %></th>
<th><%= t("admin.actions.actions") %></th>
</tr>
<% end %>
</thead>
<tbody>
<% if headings.blank? %>
<tr>
<td colspan="4">
<div class="callout primary">
<%= t("admin.budgets.form.no_heading") %>
</div>
</td>
</tr>
<% end %>
<tr id="group-<%= group.id %>-new-heading-form" style="display:none">
<td colspan="4">
<%= render "admin/budgets/heading_form", group: group, budget: @budget, heading: Budget::Heading.new %>
</td>
</tr>
<% headings.each do |heading| %>
<%= render "admin/budgets/heading", group: group, budget: @budget, heading: heading %>
<% end %>
</tbody>
</table>