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.
42 lines
1.0 KiB
Ruby
42 lines
1.0 KiB
Ruby
class Admin::Budgets::FormComponent < ApplicationComponent
|
|
include TranslatableFormHelper
|
|
include GlobalizeHelper
|
|
include Admin::Namespace
|
|
|
|
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, wizard: false)
|
|
@budget = budget
|
|
@wizard = wizard
|
|
end
|
|
|
|
def voting_styles_select_options
|
|
Budget::VOTING_STYLES.map do |style|
|
|
[Budget.human_attribute_name("voting_style_#{style}"), style]
|
|
end
|
|
end
|
|
|
|
def currency_symbol_select_options
|
|
Budget::CURRENCY_SYMBOLS.map { |cs| [cs, cs] }
|
|
end
|
|
|
|
def phases_select_options
|
|
Budget::Phase::PHASE_KINDS.map { |ph| [t("budgets.phase.#{ph}"), ph] }
|
|
end
|
|
|
|
private
|
|
|
|
def admins
|
|
@admins ||= Administrator.includes(:user)
|
|
end
|
|
|
|
def valuators
|
|
@valuators ||= Valuator.includes(:user).order(description: :asc).order("users.email ASC")
|
|
end
|
|
end
|