If you upgrade from version < 5.0.0
see the following:
- Breaking changes in version 5.0.0
- Breaking changes in version 4.0.0
- Breaking changes in version 3.0.0
- Breaking changes in version 2.0.0
- Breaking changes in version 1.0.0
Still supported in version 5.x
but not supported from 6.0
on:
pagy_massage_params
method: use the:params
variable set to a lambdaProc
that does the same (but per instance). See How to customize the params.
- Bundle and npm update
- TypeScript/Javascript improvements:
- More efficient handling of responsive *nav_js helpers
- Replaced window resize event listener with ResizeObserver
- More robust input based js helpers (catching possible invalid user input)
- Improved typing, function naming
- Added error catching
- Improvement and fixes for client-side related structure
- Replaced e2e/cy script with a couple of npm scripts backed by the start-server-and-test
- Added trim test for items_selector_js; cleanup of e2e dir
- Normalized json files indentation
- Added trim to e2e tests
- Reorganized cypress tests: faster and more accurate
- Simpler pagy.ts
- Better doc for e2e related commands in docker/README.md
- Updated package-lock.json and improved ci-cache.sh
- Used better syntax and code style in typescript files
- Updated copyright year
- Refactoring of typescript related files and dirs:
- Moved e2e dir in the project root
- Added typescript linting plugins and configuration
- Converted all the e2e test to typescript
- Updated Docker, VSC and .idea configurations
- Reorganized TypeScript/JavaScript with npm workspaces and better script naming
- Fix typo in gemspec
- Better typescript configuration with source maps and declrations
- GitHub Actions: added quotes to version ruby 3.0
- Added typescript + babel environment for better pagy.js
- Updated e2e environment
- Updated gemfiles
- Fix for support doc snippets and other typos
- Minor update of gemfiles and docs
- Added more gemspec metadata entries (closes #351)
- Docs improvements
- Added **_ to series and sequels
- Updated rematch and gemfiles
- Updated release-gem.yml workflow
- Improved a few code comments; added post link in README
- Full name for translate, aliased as t
- Added check for no calendar units in pagy_calendar configuration
- Updated gemfiles
- Small docs layout adjustment
- Updated RM run configurations
- Fix for missing innerHTML reset, unintentionally committed during a cleanup (closes #350)
- Updated gemfiles, docs and comments
- Improved readability and efficiency of calendar files
- Fix for English spelling in local variable name
- Updated pagy.manifest for Tamil locale
- Add Tamil (ta) translation (#349)
- Internal changes in calendar files:
- Simpler calculations for month mixin
- Normalized naming of non-api methods
- Better comments
- Pagy::I18n: small performance improvement
- Docs reorganization
- Update paths_ignore for skip CI and docs
- Updated cypress and bundler
- Improved efficiency of unit labelling and support for custom calendar unit sub formats
- Added missing initializer default for calendar quarter and missing doc for custom units
- Updated gemfiles
- Updated docs
- Added calendar quarter tests
- Internal calendar refactoring to allow custom units; added quarter unit
- Docs updates
- upgrade bootstrap template navs: call pagy_link_proc with link_extra key (#348)
- Renamed internal #time_for -> #start_for
- Docs fixes and improvements
- Updated cypress and related packages
- Calendar API: FINAL breaking changes (stable from now on):
- Refactoring of calendar classes and variables:
- Moved calendar defaults from
Pagy::DEFAULT
to class-specificPagy::Calendar::*::DEFAULT
- Renamed variables:
:minmax
->:period
:time_order
->:order
:week_offset
->:offset
:*_format
->:format
- Returning local time instead of UTC time for the utc accessors, now renamed:
#utc_from
->#from
(usefrom.utc
if you need it)#utc_to
->#to
(useto.utc
if you need it)
- Inverted the logic for the
:skip
key in the#pagy_calendar
conf, now renamed::skip
->:active
- Renamed methods:
#pagy_calendar_minmax
->#pagy_calendar_period
#pagy_calendar_filtered
->#pagy_calendar_filter
- Added alternative way to delegate the localization to i18n without the i18n extra
- Updated
pagy_calendar_app.ru
- Fix for wrong reordering in
:desc
order - Documentation fixes and improvements
- Removed the warning for the API changes: the API is stable after these changes
- Calendar API breaking changes for refactoring of
Pagy::Calendar
and calendar extra:- Added complete compatibility with all the backend extras
- Simpler usage with automatic handling of pagy objects
- Less variables and simpler requirements for the methods to implement
- Updated gemfiles
- The localize method overridden by the i18n extra must receive a format
- Series and sequels use keyword arguments and pagy_*nav methods accepts a size keyword argument
- Docs improvements
- Removed unnecessary empty section in calendar docs
- Fixes for typos and misalignment
- Added screenshot to the calendar extra (closes #346)
- Added bump.sh script to bump the version in multiple files; check for consistency and optionally commit the changes
- Minor fixes
- Changelog improvements
- Reversed CHANGELOG (closes #345)
- Calendar I18n small internal renaming and docs improvements
- Implemented localization of time labels through the i18n extra delegation
- Renamed internal module and files of SharedExtra to FrontendHelpers
- Added support for
*nav_js
to Calendar - Simplified page labelling, moved into the pagy classes and removed frontend methods
- Deprecated
pagy_massage_params
: use the :params variable set to a Proc that does the same, but per instance - Added apps README
- Completed overflow fix for pagy Countless
- Fix for overflow :empty_page in regular Pagy instances, not returning an empty page
- docs: add tutorial, simplify header (#343)
- Refactoring of rails_inline_input.rb (include and close #342)
- Fix for missing defined?(Calendar) checks; small simplification in headers extra
- Calendar docs improvements and fixes
- Reorganization of mock collection classes; enabled rubocop layout in tests
- Small refactoring of the overview extra
- A few improvements for the Calendar pagination; added the current_page_label method
- Small changes in code; updated gemfiles, tests and docs
- Implemented calendar extra to paginate a Time periods by unit (year, month, week or day)
- Added pagy_labeler frontend method overridable for changing the link text from a simple page number to any arbitrary string
- Enabled rubocop Style/Documentation cop
- Updated npm modules and gemfiles
- Docker better mounts
- Used gem-generic release-gem action
- Added single action standalone rails_inline_output.rb
- Small improvements in code and docs
- Fix for rails problem with internal params in pagy URL (closes #341)
- Documentation improvements
- A few details tag in the README should be opened by default
- Refactoring of pagy_url_for and relative test:
- Fix for ignoring the items_extra variable
- Replaced request.GET with request.params to enable POST pagination
- Refactoring of Mock test classes for better handling of params
- This reverts commit 1d77e672d5b7813108b40c13ca93fdec045f4c03. Generating the URL by using the application params method breakes rails apps because it requires manual changes in the apps.
- Fix and refactoring of pagy_url_for and relative test:
- Fix for ignoring the params not coming from the request
- Fix for ignoring the items_extra variable
- Refactoring of Mock test classes for better handling of params
- Improved code comments, formatting and docs fixes
- Countless extra: simplified code, internal renaming of locals and docs update
- Updated docs and issue templates
- Added cypress-dark theme to e2e test
- Refactoring of coverage to include 100% of line and condition branches covered
- Simplification of metadata extra
- Refactoring of exceptions
- Added CHANGELOG_LEGACY
Pagy 4 dropped the compatibility for old ruby versions >2.5
and started to refactor the code using more modern syntax and paradigms and better performance. It deprecated the legacy ones, printing deprecation warnings and upgrading instruction in the log, but still supporting its legacy API. Pagy 5.0.0 cleans up and removes all that transitional support code.
The changes for upgrading your app cannot be fixed with simple search and replace, but fear not! Fixing them should just take a few minutes with the following steps:
- Upgrade to the latest version of pagy 4
- Run your tests or app
- Check the log for any deprecations message starting with '[PAGY WARNING]'
- Update your code as indicated by the messages
- Ensure that the log is now free from warnings
- Upgrade to pagy 5
FYI: Here is the list of the deprecations that are not supported anymore:
Pagy::VARS[:anchor]
is nowPagy::DEFAULT[:fragment]
- The argument order in
pagy_url_for(page, pagy)
is now inverted:pagy_url_for(pagy, page)
The following optional positional arguments are passed with keywords arguments in all the pagy helpers:
- The
id
html attribute string with thepagy_id
keyword - The
url|absolute
flag with theabsolute
keyword - The
item_name
string with theitem_name
keyword - The
extra|link_extra
string with thelink_extra
keyword - The
text
string with thetext
keyword
There are a few renaming that have not been deprecated in previous versions because they are extremely easy to fix with simple search and replace (while implementing deprecations would have been detrimental to performance and complex for no reason)
A few elements have been renamed: you code may or may not contain them. Just search and replace the following strings:
- Rename
Pagy::VARS
toPagy::DEFAULT
- Rename
enable_items_extra
toitems_extra
- Rename
enable_trim_extra
totrim_extra
- Rename
Pagy::Helpers
toPagy::UrlHelpers
- Rename
pagy_get_params
topagy_massage_params
The items accessor does not adjust for the actual items in the last page anymore. This should not affect normal usage, so you can ignore this change unless you build something on that assumption.
If your code is relying on the actual number of items in the page, then just replace @pagy.items
with @pagy.in
wherever you meant that.
FYI: The @pagy.items
is now always equal to @pagy.vars[:items]
(i.e. the requested items), while the @pagy.in
returns the actual items in the page (which could be less than the items
when the page is the last page)
- Removed support for deprecations
- Refactoring of Pagy and Pagy::Countless classes, I18n, and url helpers
- Refactoring of the docker environment, addition of ready to use VSCode setup
- Changed general module structure (use of prepend instead of re-opening modules)
- Added gearbox extra for geared pagination
- Added configuration files for a full working VSCode devcontainer environment
- Added Run Configurations for RubyMine
- Improved the usage of e2e tests
- Updated doc, gemfiles and github workflow
- Other minor fixes and improvements in code and doc