From 34071a0f9f4c63df66b26bdd06644fed2b5bfabf Mon Sep 17 00:00:00 2001 From: kikito Date: Tue, 6 Dec 2016 18:03:03 +0100 Subject: [PATCH] Unifies budget_headings_helper --- app/helpers/budget_headings_helper.rb | 12 +++--------- app/views/admin/budget_investments/edit.html.erb | 4 ++-- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/app/helpers/budget_headings_helper.rb b/app/helpers/budget_headings_helper.rb index 9bb511394..e8d45ace1 100644 --- a/app/helpers/budget_headings_helper.rb +++ b/app/helpers/budget_headings_helper.rb @@ -1,15 +1,9 @@ module BudgetHeadingsHelper def budget_heading_select_options(budget) - budget.headings.map {|heading| [heading.name, heading.id]} - end - - def multiple_budgets_heading_select_options(headings) - headings.map { |heading| ["#{heading.budget.name} - #{heading.group.name} - #{heading.name}", heading.id] } - end - - def budget_scoped_heading_select_options(budget) - budget.headings.includes(:group).order("group_id ASC, budget_headings.name ASC").map {|heading| [heading.group.name + ': ' + heading.name, heading.id]} + budget.headings.includes(:group).order('budget_groups.name', 'budget_headings.name').map do |heading| + ["#{heading.group.name}: #{heading.name}", heading.id] + end end end diff --git a/app/views/admin/budget_investments/edit.html.erb b/app/views/admin/budget_investments/edit.html.erb index db57c423b..e98483772 100644 --- a/app/views/admin/budget_investments/edit.html.erb +++ b/app/views/admin/budget_investments/edit.html.erb @@ -23,7 +23,7 @@
- <%= f.select :heading_id, budget_scoped_heading_select_options(@budget), include_blank: t("admin.budget_investments.edit.select_heading") %> + <%= f.select :heading_id, budget_heading_select_options(@budget), include_blank: t("admin.budget_investments.edit.select_heading") %>
@@ -66,4 +66,4 @@ <% end %>
-<%# render 'valuation/budget_investments/written_by_valuators' %> \ No newline at end of file +<%# render 'valuation/budget_investments/written_by_valuators' %>