Use if blocks instead of two ternary operators
Using a simple ternary operator is usually fine; however, code combining two ternary operator is a bit hard to follow.
This commit is contained in:
@@ -16,8 +16,15 @@ module BudgetInvestmentsHelper
|
||||
end
|
||||
|
||||
def set_sorting_icon(direction, sort_by)
|
||||
icon = direction == "desc" ? "icon-arrow-top" : "icon-arrow-down"
|
||||
icon = sort_by.to_s == params[:sort_by] ? icon : ""
|
||||
if sort_by.to_s == params[:sort_by]
|
||||
if direction == "desc"
|
||||
"icon-arrow-top"
|
||||
else
|
||||
"icon-arrow-down"
|
||||
end
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def set_direction(current_direction)
|
||||
|
||||
Reference in New Issue
Block a user