Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jul 18, 2024
2 parents 84b03c5 + 20f3e12 commit 864baf2
Show file tree
Hide file tree
Showing 188 changed files with 3,375 additions and 2,356 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/Code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ body:
attributes:
label: 👀 Before submitting...
options:
- label: I upgraded to pagy version 8.6.3
- label: I upgraded to pagy version 9.0.0
required: true
- label: I searched through the [Documentation](https://ddnexus.github.io/pagy/)
required: true
Expand Down
34 changes: 20 additions & 14 deletions .github/latest_release_body.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
### ✴ What's new in 8.0+ ✴
### ✴ What's new in 9.0+ ✴
- Wicked-fast [Keyset Pagination](https://ddnexus.github.io/pagy/docs/api/keyset/) for big data! It works with `ActiveRecord::Relation` and `Sequel::Dataset` sets.
- More [Playground Apps](https://ddnexus.github.io/pagy/playground/) to showcase, clone and develop pagy APPs without any setup on your side
- Lots of refactorings and optimizations
- See the [Changelog](https://ddnexus.github.io/pagy/changelog) for breaking changes

- New [Pagy Playground](https://ddnexus.github.io/pagy/playground/) to showcase, clone and develop pagy APPs without any setup on your side (try the [pagy demo](https://ddnexus.github.io/pagy/playground.md#3-demo-app))
- New `:max_pages` variable to limit the pagination regardless the actual count
- Better frontend helpers
- The `foundation`, `materialize`, `semantic` and `uikit` CSS extras have been discontinued and will be removed in v9 (See the [details](https://github.com/ddnexus/pagy/discussions/672#discussioncomment-9212328))
- Deprecate the legacy nav bar, add features to the default faster nav bar series
- See the [CHANGELOG](https://ddnexus.github.io/pagy/changelog) for possible breaking changes
### Changes in 9.0.0

### Changes in 8.6.3

<!-- changes start -->
- Add missing DEFAULT[:max_pages] hint to the config/pagy.rb
- Improve activerecord handling in playground apps
- Fix the missing "ar.pagy.aria_label.nav.other" (closes #577)
<!-- changes end -->
<!-- changes_start -->
- Improve Keyset::Sequel and docs
- BREAKING: Rename :max_limit > :limit_max
- BREAKING: Rename variable, param, accessor, extra and helper "items" to "limit"
- Add playground keyset_ar.ru and keyset_s.ru apps and integration with the rest of the gems
- Add keyset pagination base files
- Pagy::Keyset API
- ActiveRecord and Sequel adapters
- BREAKING: Transform the vars positional hash argument in keyword arguments (double splat); internal renaming of setup/assign methods
- Refactor pagy_get_vars in various backend extras
- BREAKING: Refactor the fragment url
- BREAKING: Refactor the anchor_string system
- BREAKING: Drop the support for 8+ deprecations
<!-- changes_end -->

[CHANGELOG](https://ddnexus.github.io/pagy/changelog)
4 changes: 0 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ AllCops:
- coverage/**/*
- docs/**/*
- gem/lib/optimist.rb
- gem/lib/pagy/extras/foundation.rb
- gem/lib/pagy/extras/materialize.rb
- gem/lib/pagy/extras/semantic.rb
- gem/lib/pagy/extras/uikit.rb
- src/**/*
- vendor/**/* # fix the problem with github ruby

Expand Down
16 changes: 9 additions & 7 deletions .simplecov
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,27 @@ SimpleCov.formatter = if ENV['COVERAGE_REPORT'] == 'true'

SimpleCov.start do
command_name "Task##{$PROCESS_ID}" # best way to get a different id for the specific task
merge_timeout 60
merge_timeout 120
enable_coverage :branch

add_group 'All Extras', %w[gem/lib/pagy/extras]
add_group 'Core', %w[gem/lib/pagy.rb
gem/lib/pagy/b64.rb
gem/lib/pagy/backend.rb
gem/lib/pagy/console.rb
gem/lib/pagy/countless.rb
gem/lib/pagy/init_vars.rb
gem/lib/pagy/exceptions.rb
gem/lib/pagy/frontend.rb
gem/lib/pagy/i18n.rb
gem/lib/pagy/url_helpers.rb]
add_group 'Countless', %w[gem/lib/pagy/countless.rb
gem/lib/pagy/extras/countless.rb]
add_group 'Calendar', %w[gem/lib/pagy/extras/calendar.rb
gem/lib/pagy/calendar]
add_group 'Calendar', %w[gem/lib/pagy/calendar
gem/lib/pagy/extras/calendar.rb]
add_group 'Keyset', %w[gem/lib/pagy/keyset.rb
gem/lib/pagy/keyset/active_record.rb
gem/lib/pagy/keyset/sequel.rb
gem/lib/pagy/extras/keyset.rb]
add_group 'Tests', %w[test]
add_filter %w[gem/lib/pagy/extras/foundation.rb
gem/lib/pagy/extras/materialize.rb
gem/lib/pagy/extras/semantic.rb
gem/lib/pagy/extras/uikit.rb]
end
267 changes: 66 additions & 201 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ icon: versions-24

## Breaking Changes

If you upgrade from version `< 8.0.0` see the following:
If you upgrade from version `< 9.0.0` see the following:

- [Breaking changes in version 8.0.0](#version-800)
- [Breaking changes in version 9.0.0](#version-900)
- [Breaking changes in version 8.0.0](CHANGELOG_LEGACY.md#version-800)
- [Breaking changes in version 7.0.0](CHANGELOG_LEGACY.md#version-700)
- [Breaking changes in version 6.0.0](CHANGELOG_LEGACY.md#version-600)
- [Breaking changes in version 5.0.0](CHANGELOG_LEGACY.md#version-500)
Expand All @@ -19,208 +20,72 @@ If you upgrade from version `< 8.0.0` see the following:

## Deprecations

- The `foundation`, `materialize`, `semantic` and `uikit` CSS extras have been discontinued and will be removed in v9
(See the [details](https://github.com/ddnexus/pagy/discussions/672#discussioncomment-9212328))
- Protected method `Pagy#setup_pages_var`. Use `Pagy#setup_last_var` instead
- **Javascript files renamed**
- `pagy.js`: use `pagy.min.js`
- `pagy-module.js`: use `pagy.mjs`
- `pagy-dev.js`: use the `pagy.min.js`with the `pagy.min.js.map`
- `pagy-module.d.ts`: use `pagy.d.ts`
- The Array type for the `:size` (e.g. `size: [1, 4, 4, 1]`) that generates the classic bar. Use the `:size` set to an integer
with the `ends: true` variable (which are the default since 8.4.6). If a legacy bar it will remain REALLY a requirement, add
`require 'pagy/extras/size` to your `pagy.rb` initalizer for smooth upgrades. (see [size extra](https://ddnexus.github.io/pagy/docs/extras/size))
- None
<hr>

## Version 8.6.3

- Add missing DEFAULT[:max_pages] hint to the config/pagy.rb
- Improve activerecord handling in playground apps
- Fix the missing "ar.pagy.aria_label.nav.other" (closes #577)

## Version 8.6.2

- Fix the legacy size in code and test
- Improve code readability and size check in series
- Fix the old terminology in the demo.ru app

## Version 8.6.1

- Update playground apps and e2e tests
- Update pagy.rb initializer

## Version 8.6.0

- Add translated pluralized aria_label.nav for "ar" locale (close #577)
- Deprecate the legacy bar. Insert first and last pages and gaps when needed into the simple bar

## Version 8.5.0

- Improve pagy playground launcher
- Refactor calendar class structure
- Remove automatic skipping of bundle install in playground apps
- Update ruby calendar test
- Update cypress calendar test
- Refactor calendar test environment to use activerecord
- Add code for calendar counts
- Remove redundant Warning
- Convert calendar.ru to calendar_rails.ru

## Version 8.4.5

- Fix pluralization rule link on locale files (#716)
- Install gems in pagy CI
- Indentation changes
- Remove :cycle false default
- Fill aria_label.nav ca pluralized entry (#715) (Fixes #581)
- Fix typos (#710)

## Version 8.4.4
## Version 9.0.0

- Update eslint: new configuration, stricter rules and javascript code
### Breaking Changes

#### Dropped support for deprecated stuff

## Version 8.4.3

- Deprecate/rename javascript files keeping copies of old files to avoid production breaking changes; updates playground apps

## Version 8.4.2

- Limit the playground --rerun option to linux platforms
- Simplify and improve the js environment by using bun

## Version 8.4.1

- Fix pagy.in in pagy_get_items method introduced in 8.4.0 (see #696) (closes #704) (closes #708) (#707)
- Fix renamed Frontend Helpers to JS Tools and typo `next_a` "aria-label" (#700)
- Fix rubocop

## Version 8.4.0

- Retrieve only @in items:
- improve the performance of the last page in
particular storage conditions (see #696)
- Improve pagy launcher for pagy devs

## Version 8.3.0

- Discontinue foundation materialize, semantic and uikit CSS extras
- Improve playground:
- Add install option (automated in pagy development)
- Fix HTML validation for all apps
- Remove unused styles from the demo app
- Hardcode version in pagy.gemspec

## Version 8.2.2

- Add nav translation for ko (closes #592) (#690)

## Version 8.2.1

- Fix empty page param raising error (closes #689)

## Version 8.2.0

- Fix the '#pagy_url_for' method for calendar pagination (#688)
- Extend the use of pagy_get_page to the arel, array and countless extras
- Add the pagy_get_count method to the backend

## Version 8.1.2

- Added "da" locale for aria_label.nav (closes #583)

## Version 8.1.1

- Fixed broken aria-label for disabled links in Foundation (#685)
- Simplification of input variables and defaults: params and request_path are not instance variables

## Version 8.1.0

- Implement max_pages to limit the pagination regardless the actual count
- Improve efficiency of params in pagy_url_for
- Remove nil variables from DEFAULT
- Removed redundant @pages, aliased with @last

## Version 8.0.2

- Minor change in rails app and RM run config
- Fix canonical gem root:
- Correct script.build: "NODE_PATH="$(bundle show 'pagy')/javascripts"
- Move pagy.gemspec inside the gem root dir
- Fix for Turbo not intercepting changes in window.location
- Use require_relative for gem/lib files
- Complete translation of aria.nav for "ru" locale (close #599)
- Docs improvement and fixes

## Version 8.0.1

- Reorganize the gem root dir: it was the lib dir (containing everything), now is the gem dir (containing lib and everything
else).
- Fix broken link in README

## Version 8.0.0

### Breaking changes

- Renamed/removed the following arguments for all the helpers:
- Search `pagy_id:`, replace with `id:`
- Search `nav_aria_label:`, replace with`aria_label:`
- The `nav_i18n_key` has been removed: pass the interpolated/pluralized value as the `aria_label:` argument
- The `item_i18n_key` has been removed: pass the interpolated/pluralized value as the `item_name:` argument
- The `link_extra:` has been removed: its cumulative mechanism was confusing and error prone. The `:anchor_string` pagy
variable substitutes it, however it's not an helper argument anymore, so you can assign it as the `DEFAULT[:anchor_string]`
and/or pass it as any other pagy variable at object construction. (
See [customize the link attributes](https://ddnexus.github.io/pagy/docs/how-to/#customize-the-link-attributes))
- HTML structure, classes and internal methods have been changed: they may break your views if you used custom stylesheets,
templates or helper overrides. See the complete changes below if you notice any cosmetic changes or get some exception.
- The `navs` and `support` extras has been merged into the new [pagy extra](https://ddnexus.github.io/pagy/docs/extras/pagy).
Search for `"extras/navs"` and
`"extras/support"` and replace with `"extras/pagy"` (remove the duplicate if you used both)
- The `"extras/frontend_helpers"` has been renamed to `"extras/js_tools"`
- The build path for javascript builders has been updated to the canonical paths for gems, and has moved from the `lib` to
the gem root. Notice that the correct setup in `package json` was still wrongly wrapped in the `gem` dir for 8.0.0-8.0.1, and it
has finally been fixed in 8.0.2 (sorry for that):
- 8.0.0-8.0.1 only: `build: "NODE_PATH=\"$(bundle show 'pagy')/gem/javascripts\" <your original command>"`
- 8.0.2+: `build: "NODE_PATH=\"$(bundle show 'pagy')/javascripts\" <your original command>"`

### Changes

- Streamlined HTML and CSS helper structure. You may want to look at the actual output by running
the [pagy demo](https://ddnexus.github.io/pagy/playground.md#3-demo-app)
- The `pagy_nav` and `pagy_nav_js` helpers output a series of `a` tags inside a wrapper `nav` tag (nothing else)
- The disabled links are so because they are missing the `href` attributes. (They also have the `role="link"`
and `aria-disabled="true"` attributes)
- The `current` and `gap` classes are assigned to the specific `a` tags
- HTML changes
- All the pagy helper root classes have been changed according to the following rule. For example:
- `"pagy-nav"` > `"pagy nav"`
- `"pagy-bootstrap-nav-js"` > `"pagy-bootstrap nav-js"`
- and so on for all the helpers
- The `active` class of the `*nav`/`*nav_js` links as been renamed as `current`
- The `disabled`, `prev`, `next` and `pagy-combo-input` link classes have been removed (see
the [stylesheets](https://ddnexus.github.io/pagy/docs/api/stylesheets/#pagy-scss) for details)
- The `rel="prev"` and `rel="next"` attributes have been dropped (they are obsolete)
- The `<label>`/`</label>` and `<b>`/`</b>` wrappers in the dictionary files have been removed
- The `pagy_link_proc` method (only used internally or in your custom overriding) has been renamed to `pagy_anchor` and it works
slightly differently:
- The `link_extra:` key argument has been removed
- The `extra` positional argument of the returned lambda has been removed
- The `classes:` and `aria_label:` keyword arguments have been added to the returned lambda
- The `nav_aria_label_attr` method has been renamed as `nav_aria_label`
- The internal `prev_aria_label_attr` and `next_aria_label_attr` methods have been removed
- The `gap` in the nav bars is a disabled anchor element (`a` tag without a `href` attribute)
- The `pagy_prev_html` and `pagy_next_html` have been renamed as `pagy_prev_a` and `pagy_next_a`
- The `pagy_prev_link_tag` and `pagy_next_link_tag` have been renamed as `pagy_prev_link` and `pagy_next_link`
- The `*combo_nav_js` and `pagy_items_selector_js` helpers use a more efficient code
- The `src/pagy.ts` and relative built javascript files have been adapted to the above changes
- The [stylesheets](https://ddnexus.github.io/pagy/docs/api/stylesheets/) are a lot simpler as a consequence of the changes above
- All the `*combo-nav_js` of the framework extras use simpler structure and improve the look and feel consistently with their
respective frameworks
- All the frontend extra have been normalized and are totally consistent with each other; a few may add the `classes:`
argument to a few components, when the framework allows it.
- Created the [pagy playground](https://ddnexus.github.io/pagy/playground) system of apps working with the `pagy` executable.
- Internal renaming `FrontendHelpers` > `JSTools`
- Fix broken link of pagy.rb in docs (closes #668, #669)
- Docs Improvements
- Better code issue template
- The `foundation`, `materialize`, `semantic` and `uikit` CSS extras have been removed:
(See the [reasons](https://github.com/ddnexus/pagy/discussions/672#discussioncomment-9212328))
- **Javascript renamed files**
- `pagy.js`: use `pagy.min.js`
- `pagy-module.js`: use `pagy.mjs`
- `pagy-dev.js`: use the `pagy.min.js`with the `pagy.min.js.map`
- `pagy-module.d.ts`: use `pagy.d.ts`
- The Array type for the `:size` (e.g. `size: [1, 4, 4, 1]`) that generates the classic bar is not supported anymore: use the
`:size` set to an integer with the `ends: true` variable (which are the default since 8.4.6). If a legacy bar remains REALLY
a requirement, add `require 'pagy/extras/size` to your `pagy.rb` initalizer. (See the
[size extra](https://ddnexus.github.io/pagy/docs/extras/size))

#### Simple renaming

We used `items` for too many things that confused even maintainers. The "items" are now referencing only the records/elements
fetched from a collection (plural entity), so they are kept as before (e.g. `pagy_*get_items` methods).
The "number of items" (singular entity), are now unmistakably referenced as the `limit` everywhere (code, API, files, extras,
docs, etc.). The logic didn't change so you have just to globally search 'items' and replace with `limit` and you should be
done... or use the detailed table below:

| Type | Search | Replace |
|-------------------|--------------------------|------------------------------|
| Pagy Variable | `:items` | `:limit` |
| Extra Path | `pagy/extras/items` | `pagy/extras/limit` |
| Extra Variable | `:items_param` | `:limit_param` |
| Default URL param | `items` | `limit` |
| Extra Variable | `:items_extra` | `:limit_extra` |
| Extra Variable | `:max_items` | `:limit_max` (now inverted) |
| Extra Method | `pagy_items_selector_js` | `pagy_limit_selector_js` |
| Extra Variable | `:headers[:items]` | `:headers[limit]` |

#### Code changes

- The `DEFAULT[:anchor_string]` was useless and has been dropped.
- The `:anchor_string`and the `:fragment` are not instance variables anymore, but keyword arguments for all the helpers,
because it is frontend code (see the [discussion](https://github.com/ddnexus/pagy/discussions/719)). Instead of passing them to the `pagy*` method in the controller, pass it to any `pagy_*nav` method in the view.
- A general internal revamp has changed the positional argument for the Pagy::* objects and constructors methods to keyword
arguments. If you get a `wrong number of arguments (given 1, expected 0) (ArgumentError)`, just use a double splat `**`.

#### Possibly breaking overrides

- The internal Pagy protected methods have been renamed and refactored. If you use custom Pagy
classes, you may need to search into the code.

## Changes

- Improve Keyset::Sequel and docs
- BREAKING: Rename :max_limit > :limit_max
- BREAKING: Rename variable, param, accessor, extra and helper "items" to "limit"
- Add playground keyset_ar.ru and keyset_s.ru apps and integration with the rest of the gems
- Add keyset pagination base files
- Pagy::Keyset API
- ActiveRecord and Sequel adapters
- BREAKING: Transform the vars positional hash argument in keyword arguments (double splat); internal renaming of setup/assign methods
- Refactor pagy_get_vars in various backend extras
- BREAKING: Refactor the fragment url
- BREAKING: Refactor the anchor_string system
- BREAKING: Drop the support for 8+ deprecations

[LEGACY CHANGELOG >>>](CHANGELOG_LEGACY.md)
Loading

0 comments on commit 864baf2

Please sign in to comment.