Make params handling case insensitive
This commit is contained in:
committed by
Javi Martín
parent
e264490bca
commit
e88acb8905
@@ -6,8 +6,9 @@ module BudgetInvestmentsHelper
|
||||
def link_to_investments_sorted_by(column)
|
||||
sort_by = column.downcase
|
||||
default_direction = "desc"
|
||||
current_direction = params[:direction].downcase if params[:direction]
|
||||
|
||||
direction = params[:direction] == default_direction ? default_direction : "asc"
|
||||
direction = current_direction == default_direction ? default_direction : "asc"
|
||||
|
||||
icon = direction == default_direction ? "icon-arrow-down" : "icon-arrow-top"
|
||||
icon = sort_by == params[:sort_by] ? icon : ""
|
||||
|
||||
@@ -140,7 +140,7 @@ class Budget
|
||||
end
|
||||
|
||||
def self.order_filter(params)
|
||||
sorting_key = params[:sort_by].to_sym if params[:sort_by]
|
||||
sorting_key = params[:sort_by].downcase.to_sym if params[:sort_by]
|
||||
allowed_sort_option = SORTING_OPTIONS.select { |so| so[sorting_key]}.reduce
|
||||
|
||||
if allowed_sort_option.present?
|
||||
|
||||
Reference in New Issue
Block a user