Skip to content

Commit

Permalink
Merge pull request #2983 from AlchemyCMS/backport/6.1-stable/pr-2978
Browse files Browse the repository at this point in the history
[6.1-stable] Fix combining search filters and pagination
  • Loading branch information
tvdeyen authored Jul 31, 2024
2 parents 35e0a3c + 8d6bbfc commit 96b9e45
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= form_tag url_for, method: :get, class: 'per-page-select-form' do |f| %>
<% search_filter_params.reject { |k, _| k == 'page' || k == 'per_page' }.each do |key, value| %>
<% if value.is_a? Hash %>
<% if value.respond_to?(:keys) %>
<% value.each do |k, v| %>
<%= hidden_field_tag "#{key}[#{k}]", v, id: nil %>
<% end %>
Expand Down
15 changes: 15 additions & 0 deletions spec/features/admin/resources_integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@
expect(page).to_not have_content("today 1")
end
end

it "can combine filters and pagination", :js do
stub_alchemy_config(:items_per_page, 1)

visit "/admin/events?filter[start]=starting_today"

select("4", from: "per_page")

within "div#archive_all table.list tbody" do
expect(page).to have_selector("tr", count: 2)
expect(page).to have_content("today 1")
expect(page).to have_content("today 2")
expect(page).not_to have_content("yesterday")
end
end
end
end

Expand Down

0 comments on commit 96b9e45

Please sign in to comment.