Skip to content

Commit

Permalink
Merge pull request #177 from majksner/additional_options
Browse files Browse the repository at this point in the history
Ability to pass custom url parameter instead of default filterrific
  • Loading branch information
jhund authored Jul 12, 2021
2 parents 3ffa945 + 644bfd8 commit 983e342
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/filterrific/action_view_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def filterrific_sorting_link(filterrific, sort_key, opts = {})
:label => sort_key.to_s.humanize,
:sorting_scope_name => :sorted_by,
:url_for_attrs => {},
:as => :filterrific
}.merge(opts)
opts.merge!(
:html_attrs => opts[:html_attrs].with_indifferent_access,
Expand Down Expand Up @@ -110,7 +111,7 @@ def filterrific_sorting_link_reverse_order(filterrific, new_sort_key, opts)
new_filterrific_params = filterrific.to_hash
.with_indifferent_access
.merge(opts[:sorting_scope_name] => new_sorting)
url_for_attrs = opts[:url_for_attrs].merge(:filterrific => new_filterrific_params)
url_for_attrs = opts[:url_for_attrs].merge(opts[:as] => new_filterrific_params)
link_to(
safe_join([opts[:label], opts[:current_sort_direction_indicator]], ' '),
url_for(url_for_attrs),
Expand All @@ -133,7 +134,7 @@ def filterrific_sorting_link_new_column(filterrific, new_sort_key, opts)
new_filterrific_params = filterrific.to_hash
.with_indifferent_access
.merge(opts[:sorting_scope_name] => new_sorting)
url_for_attrs = opts[:url_for_attrs].merge(:filterrific => new_filterrific_params)
url_for_attrs = opts[:url_for_attrs].merge(opts[:as] => new_filterrific_params)
link_to(
opts[:label],
url_for(url_for_attrs),
Expand Down

0 comments on commit 983e342

Please sign in to comment.