Skip to content

Commit

Permalink
Merge pull request #217 from aditya-cherukuri/fix/current-sort-direct…
Browse files Browse the repository at this point in the history
…ion-indicator

[fix] handle indicator when current sorting is not present
  • Loading branch information
jhund authored Feb 12, 2023
2 parents ad49fb6 + b05824d commit 79c05e6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/filterrific/action_view_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def filterrific_sorting_link(filterrific, sort_key, opts = {})
current_sort_direction: if current_sorting
current_sorting.end_with?("_desc") ? "desc" : "asc"
end,
current_sort_direction_indicator: (current_sorting.end_with?("_desc") ? opts[:descending_indicator] : opts[:ascending_indicator])
current_sort_direction_indicator: if current_sorting
(current_sorting.end_with?("_desc") ? opts[:descending_indicator] : opts[:ascending_indicator])
end
)
new_sort_key = sort_key.to_s
if new_sort_key == opts[:current_sort_key]
Expand Down

0 comments on commit 79c05e6

Please sign in to comment.