Why: The Admin Budget form has a submit button for saving the record, adding another submit input to destroy the record actually adds to the html: `<input type="hidden" name="_method" value="delete">` and it collides with the save button, forcing it to perform a destroy instead of save. Previously the destroy button was not in the same div as the save button How: Just changing the Destroy from a button_to to a link_to.
71 lines
2.4 KiB
Plaintext
71 lines
2.4 KiB
Plaintext
<%= form_for [:admin, @budget] do |f| %>
|
|
|
|
<%= f.text_field :name, maxlength: Budget.title_max_length %>
|
|
|
|
<div class="row margin-top">
|
|
<div class="small-12 medium-9 column">
|
|
<%= f.select :phase, budget_phases_select_options %>
|
|
</div>
|
|
<div class="small-12 medium-3 column">
|
|
<%= f.select :currency_symbol, budget_currency_symbol_select_options %>
|
|
</div>
|
|
</div>
|
|
|
|
<% if @budget.phases.present? %>
|
|
<table id='budget-phases-table' class="table-for-mobile">
|
|
<thead>
|
|
<tr>
|
|
<th><%= t("admin.budgets.edit.phase") %></th>
|
|
<th><%= t("admin.budgets.edit.dates") %></th>
|
|
<th class="text-center"><%= t("admin.budgets.edit.enabled") %></th>
|
|
<th><%= t("admin.budgets.edit.actions") %></th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<% @budget.phases.each do |phase| %>
|
|
<tr id="<%= dom_id(phase) %>" class="phase">
|
|
<td>
|
|
<%= t("budgets.phase.#{phase.kind}") %>
|
|
<% if @budget.current_phase == phase %>
|
|
<span class="label success"><strong><%= t("admin.budgets.edit.active") %></strong></span>
|
|
<% end %>
|
|
</td>
|
|
<td>
|
|
<% if phase.starts_at.present? && phase.ends_at.present? %>
|
|
<%= l phase.starts_at.to_date %> - <%= l phase.ends_at.to_date %>
|
|
<% else %>
|
|
<em><%= t("admin.budgets.edit.blank_dates") %></em>
|
|
<% end %>
|
|
</td>
|
|
<td class="text-center">
|
|
<span class="budget-phase-enabled <%= phase.enabled? ? 'enabled' : 'disabled' %>"></span>
|
|
</td>
|
|
<td>
|
|
<%= link_to t("admin.budgets.edit.edit_phase"),
|
|
edit_admin_budget_budget_phase_path(@budget, phase),
|
|
method: :get, class: "button hollow" %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
<% end %>
|
|
|
|
<div class="margin-top">
|
|
<%= f.submit nil, class: "button success" %>
|
|
|
|
<div class="float-right">
|
|
<% if @budget.balloting_process? %>
|
|
<%= link_to t("admin.budgets.winners.calculate"),
|
|
calculate_winners_admin_budget_path(@budget),
|
|
method: :put,
|
|
class: "button hollow" %>
|
|
<% end %>
|
|
|
|
<% if @budget.persisted? %>
|
|
<%= link_to t("admin.budgets.edit.delete"), admin_budget_path(@budget), method: :delete, class: "button hollow alert float-right" %>
|
|
<% end %>
|
|
</div>
|
|
|
|
</div>
|
|
<% end %>
|