Specify group in the "No headings" message

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.
This commit is contained in:
Javi Martín
2021-09-10 01:44:09 +02:00
parent d702fbbfc7
commit 4d0638d5df
9 changed files with 32 additions and 14 deletions

View File

@@ -28,6 +28,6 @@
</table>
<% else %>
<div class="callout primary clear">
<%= t("admin.budget_headings.no_headings") %>
<%= sanitize(t("admin.budget_headings.no_headings", group: group.name)) %>
</div>
<% end %>

View File

@@ -8,10 +8,10 @@ class Admin::BudgetHeadings::HeadingsComponent < ApplicationComponent
private
def group
@group ||= headings.first.group
@group ||= headings.proxy_association.owner
end
def budget
@budget ||= headings.first.budget
@budget ||= group.budget
end
end

View File

@@ -1,12 +1,12 @@
<div class="budget-group-switcher">
<% if other_groups.one? %>
<p>
<%= t("admin.budget_headings.group_switcher.currently_showing", group: group.name) %>
<%= currently_showing_text %>
<%= link_to t("admin.budget_headings.group_switcher.the_other_group", group: other_groups.first.name),
headings_path(other_groups.first) %>
</p>
<% else %>
<p><%= t("admin.budget_headings.group_switcher.currently_showing", group: group.name) %></p>
<p><%= currently_showing_text %></p>
<ul class="dropdown menu" data-dropdown-menu data-disable-hover="true" data-click-open="true">
<li class="has-submenu">
<button type="button"><%= t("admin.budget_headings.group_switcher.different_group") %></button>

View File

@@ -22,4 +22,8 @@ class Admin::BudgetsWizard::Headings::GroupSwitcherComponent < ApplicationCompon
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