Skip to content

Commit

Permalink
Fix clear filters path when search path is set
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattia Roccoberton committed Apr 21, 2021
1 parent 941b8ae commit 7aba784
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/views/administrate_ransack/_filters.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@
if local_assigns.has_key?(:search_path)
form_path = @ransack_results
form_options[:url] = search_path
clear_filters_path = search_path
else
form_path = [:admin, @ransack_results]
clear_filters_path = url_for(url_for([:admin, @ransack_results.klass]))
end
%>
<%= search_form_for form_path, form_options do |f| %>
Expand Down Expand Up @@ -81,6 +83,6 @@

<div class="filters-buttons">
<%= f.submit %>
<%= link_to t('administrate_ransack.filters.clear_filters'), url_for([:admin, @ransack_results.klass]), class: 'btn-clear-filters' %>
<%= link_to t('administrate_ransack.filters.clear_filters'), clear_filters_path, class: 'btn-clear-filters' %>
</div>
<% end %>

0 comments on commit 7aba784

Please sign in to comment.