Skip to content

Conversation

@allomov
Copy link

@allomov allomov commented Jul 10, 2023

Hello, everyone!

I propose this change to allow config.paginate option to be set as a block that will return a value based on resource configuration.

In my case, I have a Sessions resource with an index that can be displayed as a table (default view) and as a calendar. With the calendar view, the pagination is replaced by the start/end time filter.

Using this change I can initialize resources in the following way:

ActiveAdmin.register Session, as: "All Sessions" do
  config.paginate = proc { params[:as] != "calendar" }
  index(as: :calendar)
end

which will allow ActiveAdmin::Views::IndexAsCalendar will handle filtering instead of pagination.

Thank you for your attention! Please, tell me what you think about it.

@allomov
Copy link
Author

allomov commented Jul 18, 2023

I am not sure why CI is failing, because the same command for test (3.2, rails_70) and other configurations work fine, but fail on test (3.2, rails_61)

@codecov
Copy link

codecov bot commented Jul 22, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.11%. Comparing base (15800ce) to head (b037309).
Report is 424 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8007      +/-   ##
==========================================
+ Coverage   98.84%   99.11%   +0.26%     
==========================================
  Files         197      197              
  Lines        4950     4949       -1     
==========================================
+ Hits         4893     4905      +12     
+ Misses         57       44      -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant