Hide group name only on budgets with one group

In the form of creating a new investment was hiding the name of the
group if it had only one heading, but could be confusing to users if
there are, for example, five different groups of one heading.

The solution:

- If the budget has one group and one heading, the heading selector is
  hidden.
- If the budget has one group and more than one heading, the group name
  is hidden.
- If the budget has more than one group, the group name appears
  regardless of the number of headings.
This commit is contained in:
decabeza
2020-11-11 09:06:56 +01:00
committed by Javi Martín
parent bc165eeda5
commit 88ad711330
7 changed files with 61 additions and 15 deletions

View File

@@ -30,10 +30,6 @@ class Budget
all.sort_by(&:name)
end
def single_heading_group?
headings.count == 1
end
private
def generate_slug?