The max headings label is updated automatically when updating the heading. It is done via AJAX and a refresh isn't needed.
48 lines
1.9 KiB
Plaintext
48 lines
1.9 KiB
Plaintext
<table>
|
|
<thead>
|
|
<tr>
|
|
<th colspan="4" class="with-button">
|
|
<%= content_tag(:span, group.name, class:"group-toggle-#{group.id}", id:"group-name-#{group.id}") %>
|
|
|
|
<%= content_tag(:span, (render 'admin/budgets/max_headings_label', current: group.max_votable_headings, max: group.headings.count, group: group if group.max_votable_headings), class:"max-headings-label group-toggle-#{group.id}", id:"max-heading-label-#{group.id}") %>
|
|
|
|
<%= 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>
|