Rewrite the method to not use budget_investments_sorting_options [#2931]

This commit is contained in:
Anna Anks Nowak
2018-12-30 23:41:09 +01:00
committed by Javi Martín
parent 22059379f5
commit 5dd468092a
2 changed files with 5 additions and 17 deletions

View File

@@ -1,17 +1,14 @@
module BudgetInvestmentsHelper
def budget_investments_sorting_options
Budget::Investment::SORTING_OPTIONS.map do |so|
[t("admin.budget_investments.index.sort_by.#{so}"), so]
end
end
def budget_investments_advanced_filters(params)
params.map { |af| t("admin.budget_investments.index.filters.#{af}") }.join(', ')
end
def link_to_investments_sorted_by(column)
sorting_option = budget_investments_sorting_options.select { |so| so[1] == column.downcase }.flatten
link_to t(sorting_option[0]), admin_budget_budget_investments_path(sort_by: sorting_option[1])
sorting_option = column.downcase
link_to(
t("admin.budget_investments.index.sort_by.#{sorting_option}"),
admin_budget_budget_investments_path(sort_by: sorting_option)
)
end
def investments_minimal_view_path

View File

@@ -1,12 +1,3 @@
<%= form_tag(admin_budget_budget_investments_path(budget: @budget), method: :get) do %>
<div class="small-12 medium-3 column">
<%= select_tag :sort_by, options_for_select(budget_investments_sorting_options, params[:sort_by]),
{ prompt: t("admin.budget_investments.index.sort_by.placeholder"),
label: false,
class: "js-submit-on-change" } %>
</div>
<% end %>
<%= link_to t("admin.budget_investments.index.download_current_selection"),
admin_budget_budget_investments_path(csv_params),
class: "float-right small clear" %>