Allow editing the budget in budget creation wizard

When users created a budget and made a typo, they could use the link to
go back to edit a budget. However, after doing so, they were out of the
budget creation process.

So we're now letting users go back to edit the budget, fix any mistakes
they might have made, and then continue to groups.
This commit is contained in:
Javi Martín
2021-06-07 20:19:55 +02:00
parent f8008a4a6f
commit bdd5361f6a
12 changed files with 92 additions and 13 deletions

View File

@@ -37,7 +37,7 @@
<%= render "/admin/budgets/association", assignable_type: "valuators", assignables: valuators, form: f %>
</fieldset>
<% if budget.persisted? %>
<% unless wizard? %>
<fieldset>
<legend><%= t("admin.budgets.edit.info.phases_settings") %></legend>
<div class="small-12 medium-6 column">
@@ -52,10 +52,10 @@
<div class="small-12 column">
<div class="clear small-12 medium-4 large-3 inline-block">
<% if budget.persisted? %>
<%= f.submit nil, class: "button success" %>
<% else %>
<% if wizard? %>
<%= f.submit t("admin.budgets_wizard.budgets.continue"), class: "button success expanded" %>
<% else %>
<%= f.submit nil, class: "button success" %>
<% end %>
</div>

View File

@@ -3,14 +3,16 @@ class Admin::Budgets::FormComponent < ApplicationComponent
include GlobalizeHelper
include Admin::Namespace
attr_reader :budget
attr_reader :budget, :wizard
alias_method :wizard?, :wizard
delegate :display_calculate_winners_button?,
:calculate_winner_button_text,
:calculate_winners_admin_budget_path,
to: :helpers
def initialize(budget)
def initialize(budget, wizard: false)
@budget = budget
@wizard = wizard
end
def voting_styles_select_options