Since the message might appear several times on the same page, it's useful to give a bit more context. Besides, usability tests show that when there's a group with no headings, there's no clear indication on the page that the group is actually a group and not a heading. We're also adding some emphasis to the group name in the "Showing headings" message, to be consistent with the emphasis we've added the the group name in the "No headings" message.
30 lines
589 B
Ruby
30 lines
589 B
Ruby
class Admin::BudgetsWizard::Headings::GroupSwitcherComponent < ApplicationComponent
|
|
attr_reader :group
|
|
|
|
def initialize(group)
|
|
@group = group
|
|
end
|
|
|
|
def render?
|
|
other_groups.any?
|
|
end
|
|
|
|
private
|
|
|
|
def budget
|
|
group.budget
|
|
end
|
|
|
|
def other_groups
|
|
@other_groups ||= budget.groups.sort_by_name - [group]
|
|
end
|
|
|
|
def headings_path(group)
|
|
admin_budgets_wizard_budget_group_headings_path(budget, group)
|
|
end
|
|
|
|
def currently_showing_text
|
|
sanitize(t("admin.budget_headings.group_switcher.currently_showing", group: group.name))
|
|
end
|
|
end
|