There was an edge case where we could access the headings index without
sending the mode parameter in the URL. That meant when sending the
headings form we could send a form with the mode hidden field set to an
empty string. When that happened, the returned text was
`t("admin.budgets.help.#{i18n_namespace}.`, which returned a hash.
Using `multiple` when an empty strin is received solves the issue.
22 lines
513 B
Ruby
22 lines
513 B
Ruby
class Admin::Budgets::HelpComponent < ApplicationComponent
|
|
attr_reader :i18n_namespace
|
|
|
|
def initialize(i18n_namespace)
|
|
@i18n_namespace = i18n_namespace
|
|
end
|
|
|
|
def budget_mode
|
|
(helpers.budget_mode if helpers.respond_to?(:budget_mode)).presence || "multiple"
|
|
end
|
|
|
|
private
|
|
|
|
def text
|
|
if t("admin.budgets.help.#{i18n_namespace}").is_a?(Hash)
|
|
t("admin.budgets.help.#{i18n_namespace}.#{budget_mode}")
|
|
else
|
|
t("admin.budgets.help.#{i18n_namespace}")
|
|
end
|
|
end
|
|
end
|