So now there's no need to edit each phase individually to enable/disable them. We aren't doing the same thing in the form to edit a budget because we aren't sure about possible usability issues. On one hand, in some tables we automatically update records when we mark a checkbox, so users might expect that. On the other hand, having a checkbox in the middle of a form which updates the database automatically is counter-intuitive, particularly when right below that table there are other checkboxes which don't update the database until the form is submitted. So, either way, chances are users would think they've updated the phases (or kept them intact) while the opposite would be true. In the form within the wizard to create a budget that problem isn't that important because there aren't any other fields in the form and it's pretty intuitive that what users do will have no effect until they press the "Finish" button. Co-Authored-By: Julian Nicolas Herrero <microweb10@gmail.com>
41 lines
1.3 KiB
Plaintext
41 lines
1.3 KiB
Plaintext
<% if phases.present? %>
|
|
<table class="budget-phases-table table-for-mobile">
|
|
<caption><%= t("admin.budgets.edit.phases_caption") %></caption>
|
|
<thead>
|
|
<tr>
|
|
<th><%= t("admin.budgets.edit.phase") %></th>
|
|
<th><%= t("admin.budgets.edit.duration") %></th>
|
|
<th class="text-center"><%= t("admin.budgets.edit.enabled") %></th>
|
|
<th><%= t("admin.budgets.edit.actions") %></th>
|
|
</tr>
|
|
</thead>
|
|
|
|
<% phases.each do |phase| %>
|
|
<tr id="<%= dom_id(phase) %>" class="phase">
|
|
<td>
|
|
<%= phase.name %>
|
|
<% if phase.current? %>
|
|
<span class="label success"><strong><%= t("admin.budgets.edit.active") %></strong></span>
|
|
<% end %>
|
|
</td>
|
|
<td>
|
|
<% if phase.starts_at.present? || phase.ends_at.present? %>
|
|
<%= dates(phase) %>
|
|
<% else %>
|
|
<em><%= t("admin.budgets.edit.blank_dates") %></em>
|
|
<% end %>
|
|
</td>
|
|
<td class="text-center">
|
|
<%= enabled_cell(phase) %>
|
|
</td>
|
|
<td>
|
|
<%= render Admin::TableActionsComponent.new(phase,
|
|
actions: [:edit],
|
|
edit_text: t("admin.budgets.edit.edit_phase")
|
|
) %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</table>
|
|
<% end %>
|