From 514326868c9229ed3ad39c3adae929ccebb6191c Mon Sep 17 00:00:00 2001
From: Domizio Demichelis
Date: Wed, 22 Jan 2025 22:13:37 +0700
Subject: [PATCH] WIP: Better Calendar paginator and combo_nav_js 2
---
docs/README.md | 10 +-
docs/api/calendar/units.md | 2 +-
docs/how-to.md | 14 +
docs/migration-guide.md | 28 +-
docs/prerequisites.md | 19 +-
docs/troubleshooting.md | 37 +-
gem/config/pagy.rb | 28 +-
gem/lib/pagy/backend/paginators/calendar.rb | 25 +-
gem/lib/pagy/frontend.rb | 20 +-
gem/lib/pagy/modules/url.rb | 2 +-
gem/lib/pagy/offset/calendar.rb | 2 +-
test/pagy/backend/calendar_test.rb | 15 +-
test/pagy/backend/calendar_test.rb.yaml | 628 ++++++++++----------
test/pagy/frontend_test.rb | 3 -
14 files changed, 423 insertions(+), 410 deletions(-)
diff --git a/docs/README.md b/docs/README.md
index f80d94feb..3bb96a9ee 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -3,9 +3,9 @@
The docs are written in [markdown format](https://en.wikipedia.org/wiki/Markdown) and [retype](https://retype.com/) converts it
into styled HTML.
-The [retype configuration](https://retype.com/configuration/project/) is located in
-the [`retype.yml` file](https://github.com/ddnexus/pagy/blob/master/retype.yml).
+The [retype configuration](https://retype.com/configuration/project/) is located in the [
+`retype.yml` file](https://github.com/ddnexus/pagy/blob/master/retype.yml).
-The [publish-docs workflow](https://github.com/ddnexus/pagy/blob/master/.github/workflows/publish-docs.yml) builds and
-publishes the documentation in the [`docs-site` branch](https://github.com/ddnexus/pagy/tree/docs-site) when its markdown changes
-are pushed to the `master` branch.
+The [publish-docs workflow](https://github.com/ddnexus/pagy/blob/master/.github/workflows/publish-docs.yml) builds and publishes
+the documentation in the [`docs-site` branch](https://github.com/ddnexus/pagy/tree/docs-site) when its markdown changes are pushed
+to the `master` branch.
diff --git a/docs/api/calendar/units.md b/docs/api/calendar/units.md
index fc9490b6e..3980c8220 100644
--- a/docs/api/calendar/units.md
+++ b/docs/api/calendar/units.md
@@ -73,7 +73,7 @@ already filtered by the `:period` so there are no records outside it.
### Time conversions
-This classes can use the recommended `ActiveSupport::TimeWithZone` class or the ruby `Time` class for all their time calculations.
+This classes can use the `ActiveSupport::TimeWithZone` class for all their time calculations.
Since they are meant to be used in the UI, they use the user/server local time in order to make sense for the UI. For that reason
their input (the `:period` variable) and output (the `from` and `to` accessors) are always local time.
diff --git a/docs/how-to.md b/docs/how-to.md
index a7be7ccbb..10edda8d4 100644
--- a/docs/how-to.md
+++ b/docs/how-to.md
@@ -892,3 +892,17 @@ pagy demo
!!!
You may want to read also the [Pagy::Frontend API documentation](api/frontend.md) for complete control over your templates.
+
+## Use Pagy with a non-rack app
+
+For non-rack environments that don't respond to the request method, pass the `:request` variable to the paginator with your request[:url_prefix] (i.e. everything that comes before the `?` in the complete url), and your request[:query_params] hash to be merged with the pagy params and form the complete url
+
+
+```ruby
+@pagy, @records = pagy_offset(collection, request: { url_prefix: 'https://my.domain.com/path/script',
+ query_params: { a: 'a', b: 'b'} })
+```
+
+That would compose urls of the pages like: `https://my.domain.com/path/script?a=a&b=b&page=3`.
+
+Pagy rely also on the `params` method inside the app, which should be a hash of the params from the request. Define an alias or a method if your environment doesn't respond to it.
diff --git a/docs/migration-guide.md b/docs/migration-guide.md
index 74b56a671..b80b36ab5 100644
--- a/docs/migration-guide.md
+++ b/docs/migration-guide.md
@@ -29,14 +29,12 @@ if that makes sense for Pagy:
- If it makes sense, you should add the equivalent Pagy statement and remove the legacy statement(s).
- If it doesn't make sense, then just remove the legacy statement.
-!!!primary Don't stress if you miss
-Don't worry about missing something in this step: if anything won't work as before the next steps will fix it.
+!!!primary Don't stress if you miss Don't worry about missing something in this step: if anything won't work as before the next
+steps will fix it.
!!!
#### Preparation
-- Download the pagy initializer: you will edit it during the process.
- [!file](/gem/config/pagy.rb)
- Replace the legacy gem with `gem "pagy"` in the `Gemfile` and `bundle`, or install and require the gem if you don't use bundler.
- Ensure that the legacy gem will not get loaded anymore (or it could mask some old statement still in place and not converted)
- Add the `include Pagy::Backend` statement to the application controller.
@@ -62,13 +60,9 @@ Kaminari.configure do |config|
#config.left = 0
#config.right = 0
end
-
-Pagy::DEFAULT[:limit] = 10
-require 'pagy/extras/size' # Provide legacy support of old navbars like the above
-Pagy::DEFAULT[:size] = [5, 4, 4, 5] # Array parsed by the extra above
```
-Remove all the legacy settings of the old gem(s) and uncomment and edit the new settings in the `pagy.rb` initializer _(see
+Remove all the legacy settings of the old gem(s) and uncomment and edit the new settings in the `pagy.rb` initializer _(see
[How to configure pagy](/quick-start.md#configure))_.
#### Cleanup the Models
@@ -80,16 +74,15 @@ kinds of statements scattered around in your models. You should remove them all
makes sense to Pagy, which of course _is absolutely not_ in the models.
For example, you may want to search for keywords like `per_page`, `per` and such, which are actually configuration settings. They
-should either go into the `pagy.rb` initializer if they are global to the app, or into the specific `pagy` call in the controller
-if they are specific to an action.
+should be added to the specific pagintor call in the controller (e.g. `pagy_offset`).
If the app uses the `page` scope in some of its methods or scopes in some model, that should be removed (including removing the
argument used to pass the page number to the method/scope), leaving the rest of the scope in place. Search where the app uses the
-already paginated scope in the controllers, and use the scope in a regular `pagy` statement. For example:
+already paginated scope in the controllers, and use the scope in a paginator statement. For example:
```ruby Controller
#@records = Product.paginated_scope(params[:page])
-@pagy, @records = pagy(Product.non_paginated_scope)
+@pagy, @records = pagy_offset(Product.non_paginated_scope)
```
#### Search and replace in the Controllers
@@ -97,13 +90,13 @@ already paginated scope in the controllers, and use the scope in a regular `pagy
In the controllers, the occurrence of statements from legacy pagination should have a one-to-one relationship with the Pagy
pagination, so you should be able to go through each of them and convert them quite easily.
-Search for keywords like `page` and `paginate` statements and use the `pagy` method instead. For example:
+Search for keywords like `page` and `paginate` statements and use the `pagy_offset` paginator instead. For example:
```ruby Controller
#@records = Product.some_scope.page(params[:page])
#@records = Product.paginate(:page => params[:page])
-@pagy, @records = pagy(Product.some_scope)
+@pagy, @records = pagy_offset(Product.some_scope)
#@records = Product.some_scope.page(params[:page]).per(15)
#@records = Product.some_scope.page(params[:page]).per_page(15)
@@ -136,13 +129,14 @@ until there will be no exception.
## Fine tuning
If the app is working and displays the pagination, it's time to adjust Pagy as you need, but if the old pagination was using
-custom elements (e.g. custom params, urls, links, html elements, etc.) it will likely not work without some possibly easy adjustment.
+custom elements (e.g. custom params, urls, links, html elements, etc.) it will likely not work without some possibly easy
+adjustment.
Please take a look at the topics in the [how-to](how-to.md) documentation: that should cover most of your custom needs.
### CSS
-The css styling that you may have applied to the pagination elements may need some minor change. However if the app uses the
+The css styling that you may have applied to the pagination elements may need some minor change. However, if the app uses the
pagination from bootstrap (or some other framework), the same CSSs should work seamlessly with the pagy nav helpers.
### I18n
diff --git a/docs/prerequisites.md b/docs/prerequisites.md
index 8edc86962..f94140c1c 100644
--- a/docs/prerequisites.md
+++ b/docs/prerequisites.md
@@ -28,7 +28,7 @@ Use pagy normally
Your app does not use a `Rack` based framework.
!!!
-Use the [standalone extra](extras/standalone.md)
+Read how to [Use Pagy with non-rack apps](how-to.md#use-pagy-with-a-non-rack-app).
+++ Irb
@@ -41,8 +41,19 @@ Use the [Pagy::Console](api/console.md)
## Supported collections
-Out of the box pagy
-supports `ActiveRecord::Relation`, [array](extras/array.md), [elasticsearch_rails](extras/elasticsearch_rails.md), [searchkick](extras/searchkick.md)
-and [meilisearch](extras/meilisearch.md) collections.
+Out of the box pagy supports:
+
+### Offset pagination with:
+
+- `ActiveRecord::Relation`
+- [array](extras/array.md)
+- [elasticsearch_rails](extras/elasticsearch_rails.md)
+- [searchkick](extras/searchkick.md)
+- [meilisearch](extras/meilisearch.md)
+
+### Keyset and Keynav pagination with:
+
+- `ActiveRecord::Relation`
+- `Sequel::Dataset`
In order to paginate other collections, search for "paginate" in the search field above.
diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md
index d14d1518c..d665f4ec0 100644
--- a/docs/troubleshooting.md
+++ b/docs/troubleshooting.md
@@ -9,16 +9,19 @@ icon: alert-24
!!!danger Don't Paginate Unordered PostgreSQL Collections!
```rb
-@pagy, @records = pagy(unordered)
+@pagy, @records = pagy_offset(unordered)
# behind the scenes, pagy selects the page of records with:
unordered.offset(pagy.offset).limit(pagy.limit)
```
-!!!warning From the [PostgreSQL Documentation](https://www.postgresql.org/docs/16/queries-limit.html#:~:text=When%20using%20LIMIT,ORDER%20BY)
+!!! warning
-When using LIMIT, it is important to use an ORDER BY clause that constrains the result rows into a unique order. Otherwise you
+From the [PostgreSQL Documentation](https://www.postgresql.org/docs/16/queries-limit.html#:~:text=When%20using%20LIMIT,ORDER%20BY)
+
+When using LIMIT, it is important to use an ORDER BY clause that constrains the result rows into a unique order. Otherwise, you
will get an unpredictable subset of the query's rows.
+
!!!
!!! success Ensure the PostgreSQL collection is ordered!
@@ -26,7 +29,7 @@ will get an unpredictable subset of the query's rows.
```rb
# results will be predictable with #order
ordered = unordered.order(:id)
-@pagy, @records = pagy(ordered)
+@pagy, @records = pagy_offset(ordered)
```
!!!
@@ -34,17 +37,18 @@ ordered = unordered.order(:id)
==- Invalid HTML
!!!danger Don't rely on ARIA default with multiple nav elements!
+
Pagy sets the `aria-label` attribute of its `nav` elements with the translated and pluralized `pagy.aria_label.nav` that finds in
the locale files. That would be (always) `"Page"/"Pages"` for the `en` locale.
-Since the `nav` or `role="navigation"` elements of a HTML document are considered `landmark roles`, they
-should be uniquely aria-identified in the page.
+Since the `nav` or `role="navigation"` elements of a HTML document are considered `landmark roles`, they should be uniquely
+aria-identified in the page.
!!!
!!!success Pass your own `aria_label` to each nav!
```erb
-<%# Explicitly set the aria_label string %>
+<%# Explicitly set the aria_label string %>
<%== pagy_nav(@pagy, aria_label: 'Search result pages') %>
```
@@ -69,27 +73,12 @@ pagy demo
# ...and point your browser at http://0.0.0.0:8000
```
-!!!primary
-In the specific `bootstrap` example you could override the default bootstrap `"pagination"` class by adding other classes with:
+!!!primary In the specific `bootstrap` example you could override the default bootstrap `"pagination"` class by adding other
+classes with:
```ruby
@pagy, @records = pagy_bootstrap_nav(collection, classes: 'pagination my-class')
```
-!!!
-
-==- Slow Last Page
-
-There has been a single report of a slow last page using very big DB tables. It's a pure DB problem and it's not caused by
-pagy or by any other ruby code ([#696](https://github.com/ddnexus/pagy/pull/696),
-[#704](https://github.com/ddnexus/pagy/pull/704)), but a simple pagy override may avoid it:
-
-```rb
-## override pagy_get_items
-def pagy_get_items(collection, pagy)
- limit = pagy.last == pagy.page ? pagy.in : pagy.limit
- collection.offset(pagy.offset).limit(limit)
-end
-```
!!!
===
diff --git a/gem/config/pagy.rb b/gem/config/pagy.rb
index 452ef753d..34467d1f3 100644
--- a/gem/config/pagy.rb
+++ b/gem/config/pagy.rb
@@ -2,30 +2,44 @@
# Pagy initializer file (9.3.3)
-# IMPORTANT:
-# Customizing the static and frozen Pagy::DEFAULT is not supported since version 10.0.0.
-# Pass the variables to the constructor, or pass your own DEFAULT hash.
+##### Pagy::DEFAULT #######################
+
+# Customizing the static and frozen Pagy::DEFAULT is NOT SUPPORTED since version 10.0.0.
+# Pass the variables to the constructor, or pass your own PAGY_DEFAULT hash.
# For example:
#
# PAGY_DEFAULT = { ... }
# pagy_offset(collection, **PAGY_DEFAULT, ...)
-# Extras
-# Size extra: Enable the Array type for the `:size` variable (e.g. `size: [1,4,4,1]`)
-# See https://ddnexus.github.io/pagy/docs/extras/size
-# require 'pagy/extras/size' # must be required before the other extras
+##### Extras #######################
+
+# The extras are almost all converted to autoloaded mixins, or integrated in the core code at zero-cost.
+# You can use the methods that you need, and they will just work without the need of any explicit `require`.
+#
+# The only extras that are left (for different compelling reasons) are listed below:
+# gearbox, i18n and size. They must be required in the initializer as usual.
+
# Gearbox extra: Automatically change the limit per page depending on the page number
# (e.g. `gearbox_limit: [15, 30, 60, 100]`
# See https://ddnexus.github.io/pagy/docs/extras/gearbox
# require 'pagy/extras/gearbox'
+
# I18n extra: uses the standard i18n gem which is ~18x slower using ~10x more memory
# than the default pagy internal i18n (see below)
# See https://ddnexus.github.io/pagy/docs/extras/i18n
# require 'pagy/extras/i18n'
+
+# Size extra: Enable the Array type for the `:size` variable (e.g. `size: [1,4,4,1]`)
+# See https://ddnexus.github.io/pagy/docs/extras/size
+# require 'pagy/extras/size' # must be required before the other extras
+
+
+##### Pagy::I18n configuration #######################
+
# Pagy internal I18n: ~18x faster using ~10x less memory than the i18n gem
# See https://ddnexus.github.io/pagy/docs/api/i18n
# Notice: No need to configure anything in this section if your app uses only "en"
diff --git a/gem/lib/pagy/backend/paginators/calendar.rb b/gem/lib/pagy/backend/paginators/calendar.rb
index 1c6cca544..f7334c0d7 100644
--- a/gem/lib/pagy/backend/paginators/calendar.rb
+++ b/gem/lib/pagy/backend/paginators/calendar.rb
@@ -21,17 +21,24 @@ def pagy_calendar(collection, conf)
pagy, results = send(conf[:pagy][:backend] || :pagy_offset, collection, **conf[:pagy])
[calendar, pagy, results]
end
+ end
- # This method must be implemented by the application
- def pagy_calendar_period(*)
- raise NoMethodError, 'the pagy_calendar_period method must be implemented by the application ' \
- '(see https://ddnexus.github.io/pagy/docs/extras/calendar/#pagy-calendar-period-collection)'
- end
+ module CalendarOverride
+ def pagy_anchor(pagy, anchor_string: nil, **vars)
+ return super unless (counts = pagy.vars[:counts]) # Skip unless pagy_calendar_counts is defined
- # This method must be implemented by the application
- def pagy_calendar_filter(*)
- raise NoMethodError, 'the pagy_calendar_filter method must be implemented by the application ' \
- '(see https://ddnexus.github.io/pagy/docs/extras/calendar/#pagy-calendar-filter-collection-from-to)'
+ left, right = %(#{text})
+ end
end
end
+ Frontend.prepend CalendarOverride
end
diff --git a/gem/lib/pagy/frontend.rb b/gem/lib/pagy/frontend.rb
index dbd9942dd..47cb63195 100644
--- a/gem/lib/pagy/frontend.rb
+++ b/gem/lib/pagy/frontend.rb
@@ -11,23 +11,11 @@ module Frontend
# Return a performance optimized lambda to generate the HTML anchor element (a tag)
# Benchmarked on a 20 link nav: it is ~22x faster and uses ~18x less memory than rails' link_to
def pagy_anchor(pagy, anchor_string: nil, **vars)
- # Skip if pagy_calendar_counts is defined
- if (counts = pagy.vars[:calendar_counts])
- count_info = lambda do |page, classes|
- count = counts[page - 1]
- info_key = count.zero? ? 'pagy.info.no_items' : 'pagy.info.single_page'
- classes = classes ? "#{classes} empty-page" : 'empty-page' if count.zero?
- title = %( title="#{pagy_t(info_key, item_name: pagy_t('pagy.item_name', count:), count:)}")
- [classes, title]
- end
- end
- left, right =
- %(#{text})
+ %(#{left}#{page}#{right}#{%( class="#{classes}") if classes}#{%( aria-label="#{aria_label}") if aria_label}>#{text})
end
end
diff --git a/gem/lib/pagy/modules/url.rb b/gem/lib/pagy/modules/url.rb
index 22d2c04c3..c2f4613db 100644
--- a/gem/lib/pagy/modules/url.rb
+++ b/gem/lib/pagy/modules/url.rb
@@ -39,7 +39,7 @@ def escape(str)
# Return the URL for the page, relying on the params method and Rack by default.
# It supports all rack-based frameworks (Sinatra, Padrino, Rails, ...).
- # For non-rack environments that don't respond to the request method, pass the :request variable to the constructor
+ # For non-rack environments that don't respond to the request method, pass the :request variable to the paginator
# with your request[:url_prefix] (i.e. everything that comes before the ? in the complete url),
# and your request[:query_params] hash to be merged with the pagy params and form the complete url
def pagy_page_url(pagy, page, absolute: false, fragment: nil, **)
diff --git a/gem/lib/pagy/offset/calendar.rb b/gem/lib/pagy/offset/calendar.rb
index d83d7e580..3d0d4df91 100644
--- a/gem/lib/pagy/offset/calendar.rb
+++ b/gem/lib/pagy/offset/calendar.rb
@@ -69,7 +69,7 @@ def init(conf, period, params)
conf[unit][:page] = @params[:"#{unit}_#{@page_sym}"] # requested page
# :nocov:
# simplecov doesn't need to fail block_given?
- conf[unit][:calendar_counts] = yield(unit, conf[unit][:period]) if block_given?
+ conf[unit][:counts] = yield(unit, conf[unit][:period]) if block_given?
# :nocov:
calendar[unit] = object = Calendar.send(:create, unit, **conf[unit])
end
diff --git a/test/pagy/backend/calendar_test.rb b/test/pagy/backend/calendar_test.rb
index 454c86fec..de86b50d3 100644
--- a/test/pagy/backend/calendar_test.rb
+++ b/test/pagy/backend/calendar_test.rb
@@ -33,14 +33,6 @@ def app(**)
_(pagy.count).must_equal 505
_(pagy.pages).must_equal 26
end
- it 'raises NoMethodError for #pagy_calendar_period' do
- error = assert_raises(NoMethodError) { MockApp.new.send(:pagy_calendar_period) }
- _(error.message).must_match 'the pagy_calendar_period method must be implemented by the application'
- end
- it 'raises NoMethodError for #pagy_calendar_filter' do
- error = assert_raises(NoMethodError) { MockApp.new.send(:pagy_calendar_filter) }
- _(error.message).must_match 'the pagy_calendar_filter method must be implemented by the application'
- end
it 'raises ArgumentError for wrong conf' do
_ { MockApp::Calendar.new.send(:pagy_calendar, Event.all, []) }.must_raise ArgumentError
_ { MockApp::Calendar.new.send(:pagy_calendar, Event.all, unknown: {}) }.must_raise ArgumentError
@@ -275,6 +267,13 @@ def app(**)
_(calendar.showtime).must_equal Time.zone.local(2022, 7, 1)
end
end
+ describe '#pagy_anchor with counts' do
+ it 'includes title and class in page url' do
+ pagy = Pagy::Offset.new(count: 103, page: 1, counts: {2 => 0})
+ _(MockApp::CalendarCounts.new.pagy_anchor(pagy, anchor_string: 'X').call(3, classes: 'a b c')).must_equal \
+ '3'
+ end
+ end
describe "Counts feature" do
[MockApp::CalendarCounts, MockApp::CalendarCountsSkip].each do |c|
it "works with #{c}" do
diff --git a/test/pagy/backend/calendar_test.rb.yaml b/test/pagy/backend/calendar_test.rb.yaml
index d72f6825c..e2a065a22 100644
--- a/test/pagy/backend/calendar_test.rb.yaml
+++ b/test/pagy/backend/calendar_test.rb.yaml
@@ -1,71 +1,104 @@
---
-calendar__instance_methods_test_0016_selects__day_for_the_first_page:
+calendar__Counts_feature_test_0003_works_with_anchor_string:
+ :year:
+calendar__Counts_feature_test_0001_works_with_MockApp__CalendarCounts:
+ :year:
+ :month:
+ :day:
+calendar__Counts_feature_test_0002_works_with_MockApp__CalendarCountsSkip:
+ :year:
+ :month:
+ :day:
+calendar__instance_methods_test_0011_selects__week_for_the_first_page:
:entries:
- 2021-10-21 13:18:23.000000000 Z
- 2021-10-21 23:14:50.000000000 Z
-calendar__instance_methods_test_0018_selects__day_for_the_last_page:
- :entries:
- - 2021-12-19 00:34:04.000000000 Z
- - 2021-12-19 06:58:41.000000000 Z
-calendar__instance_methods_test_0015_selects__week_for_the_last_page:
- :entries:
- - 2023-11-12 01:20:18.000000000 Z
- - 2023-11-12 04:22:50.000000000 Z
- - 2023-11-12 08:38:58.000000000 Z
- - 2023-11-13 15:43:40.000000000 Z
-calendar__instance_methods_test_0012_selects__month_for_the_last_page:
- :entries:
- - 2023-11-02 02:52:55.000000000 Z
- - 2023-11-02 06:00:32.000000000 Z
- - 2023-11-03 08:39:06.000000000 Z
- - 2023-11-04 23:51:22.000000000 Z
- - 2023-11-07 16:11:33.000000000 Z
- - 2023-11-10 10:55:29.000000000 Z
- - 2023-11-12 01:20:18.000000000 Z
- - 2023-11-12 04:22:50.000000000 Z
- - 2023-11-12 08:38:58.000000000 Z
- - 2023-11-13 15:43:40.000000000 Z
-calendar__instance_methods_test_0014_selects__week_for_an_intermediate_page:
- :entries:
- - 2022-04-03 18:27:19.000000000 Z
- - 2022-04-03 23:44:08.000000000 Z
- - 2022-04-06 10:59:32.000000000 Z
- - 2022-04-07 01:33:53.000000000 Z
- - 2022-04-08 10:26:34.000000000 Z
-calendar__instance_methods_test_0011_selects__month_for_an_intermediate_page:
- :entries:
- - 2023-10-01 11:54:24.000000000 Z
- - 2023-10-03 07:36:32.000000000 Z
- - 2023-10-05 05:13:57.000000000 Z
- - 2023-10-06 16:07:06.000000000 Z
- - 2023-10-09 00:03:52.000000000 Z
- - 2023-10-09 02:32:01.000000000 Z
- - 2023-10-10 16:39:07.000000000 Z
- - 2023-10-12 13:28:16.000000000 Z
- - 2023-10-14 04:29:14.000000000 Z
- - 2023-10-17 03:30:24.000000000 Z
- - 2023-10-20 03:13:15.000000000 Z
- - 2023-10-20 20:47:06.000000000 Z
- - 2023-10-21 13:59:34.000000000 Z
- - 2023-10-23 21:38:48.000000000 Z
- - 2023-10-24 06:07:13.000000000 Z
- - 2023-10-25 22:51:17.000000000 Z
- - 2023-10-26 21:12:50.000000000 Z
- - 2023-10-28 05:52:20.000000000 Z
- - 2023-10-29 22:11:01.000000000 Z
- - 2023-10-30 12:29:25.000000000 Z
-calendar__instance_methods_test_0008_selects__quarter_for_an_intermediate_page:
+ - 2021-10-23 01:06:02.000000000 Z
+calendar__instance_methods_test_0017_runs_multiple_units:
:entries:
- - 2022-07-01 16:05:14.000000000 Z
- - 2022-07-02 14:02:12.000000000 Z
- - 2022-07-05 11:08:11.000000000 Z
- - 2022-07-05 12:44:38.000000000 Z
- - 2022-07-08 03:55:17.000000000 Z
- - 2022-07-08 18:02:14.000000000 Z
- - 2022-07-09 09:41:17.000000000 Z
- - 2022-07-11 07:34:51.000000000 Z
- - 2022-07-13 05:11:19.000000000 Z
- - 2022-07-15 02:46:56.000000000 Z
- 2022-07-16 15:40:39.000000000 Z
- 2022-07-17 19:44:15.000000000 Z
- 2022-07-19 00:31:12.000000000 Z
@@ -76,164 +109,7 @@ calendar__instance_methods_test_0008_selects__quarter_for_an_intermediate_page:
- 2022-07-25 07:21:20.000000000 Z
- 2022-07-27 12:02:44.000000000 Z
- 2022-07-29 03:29:28.000000000 Z
- - 2022-07-29 11:35:43.000000000 Z
- - 2022-07-30 05:25:21.000000000 Z
- - 2022-07-30 19:39:10.000000000 Z
- - 2022-07-31 18:54:58.000000000 Z
- - 2022-08-03 11:18:44.000000000 Z
- - 2022-08-05 00:37:47.000000000 Z
- - 2022-08-05 12:08:08.000000000 Z
- - 2022-08-07 14:39:19.000000000 Z
- - 2022-08-08 09:52:59.000000000 Z
- - 2022-08-09 13:48:29.000000000 Z
- - 2022-08-11 19:03:04.000000000 Z
- - 2022-08-13 01:56:49.000000000 Z
- - 2022-08-15 11:33:09.000000000 Z
- - 2022-08-17 23:37:45.000000000 Z
- - 2022-08-19 00:47:19.000000000 Z
- - 2022-08-19 01:01:12.000000000 Z
- - 2022-08-21 07:37:55.000000000 Z
- - 2022-08-21 21:42:15.000000000 Z
- - 2022-08-23 10:55:39.000000000 Z
- - 2022-08-25 16:20:29.000000000 Z
- - 2022-08-27 06:28:14.000000000 Z
- - 2022-08-27 13:12:57.000000000 Z
- - 2022-08-28 23:00:13.000000000 Z
- - 2022-08-31 05:19:56.000000000 Z
- - 2022-09-02 18:00:18.000000000 Z
- - 2022-09-04 12:02:47.000000000 Z
- - 2022-09-06 00:57:21.000000000 Z
- - 2022-09-08 04:26:01.000000000 Z
- - 2022-09-09 04:55:45.000000000 Z
- - 2022-09-11 22:59:36.000000000 Z
- - 2022-09-12 00:54:25.000000000 Z
- - 2022-09-12 17:44:24.000000000 Z
- - 2022-09-12 20:47:30.000000000 Z
- - 2022-09-15 11:39:20.000000000 Z
- - 2022-09-16 07:54:15.000000000 Z
- - 2022-09-17 08:06:29.000000000 Z
- - 2022-09-18 07:17:17.000000000 Z
- - 2022-09-19 08:39:55.000000000 Z
- - 2022-09-22 06:32:56.000000000 Z
- - 2022-09-22 21:26:29.000000000 Z
- - 2022-09-24 16:06:50.000000000 Z
- - 2022-09-27 05:50:18.000000000 Z
- - 2022-09-28 12:12:13.000000000 Z
- - 2022-09-29 21:13:01.000000000 Z
- - 2022-09-30 00:09:29.000000000 Z
-calendar__instance_methods_test_0017_selects__day_for_an_intermediate_page:
- :entries: []
-calendar__instance_methods_test_0013_selects__week_for_the_first_page:
- :entries:
- - 2021-10-21 13:18:23.000000000 Z
- - 2021-10-21 23:14:50.000000000 Z
- - 2021-10-23 01:06:02.000000000 Z
-calendar__instance_methods_test_0009_selects__quarter_for_last_page:
- :entries:
- - 2023-10-01 11:54:24.000000000 Z
- - 2023-10-03 07:36:32.000000000 Z
- - 2023-10-05 05:13:57.000000000 Z
- - 2023-10-06 16:07:06.000000000 Z
- - 2023-10-09 00:03:52.000000000 Z
- - 2023-10-09 02:32:01.000000000 Z
- - 2023-10-10 16:39:07.000000000 Z
- - 2023-10-12 13:28:16.000000000 Z
- - 2023-10-14 04:29:14.000000000 Z
- - 2023-10-17 03:30:24.000000000 Z
- - 2023-10-20 03:13:15.000000000 Z
- - 2023-10-20 20:47:06.000000000 Z
- - 2023-10-21 13:59:34.000000000 Z
- - 2023-10-23 21:38:48.000000000 Z
- - 2023-10-24 06:07:13.000000000 Z
- - 2023-10-25 22:51:17.000000000 Z
- - 2023-10-26 21:12:50.000000000 Z
- - 2023-10-28 05:52:20.000000000 Z
- - 2023-10-29 22:11:01.000000000 Z
- - 2023-10-30 12:29:25.000000000 Z
- - 2023-11-02 02:52:55.000000000 Z
- - 2023-11-02 06:00:32.000000000 Z
- - 2023-11-03 08:39:06.000000000 Z
- - 2023-11-04 23:51:22.000000000 Z
- - 2023-11-07 16:11:33.000000000 Z
- - 2023-11-10 10:55:29.000000000 Z
- - 2023-11-12 01:20:18.000000000 Z
- - 2023-11-12 04:22:50.000000000 Z
- - 2023-11-12 08:38:58.000000000 Z
- - 2023-11-13 15:43:40.000000000 Z
-calendar__instance_methods_test_0007_selects__quarter_for_the_first_page:
- :entries:
- - 2021-10-21 13:18:23.000000000 Z
- - 2021-10-21 23:14:50.000000000 Z
- - 2021-10-23 01:06:02.000000000 Z
- - 2021-10-25 18:54:35.000000000 Z
- - 2021-10-26 02:22:17.000000000 Z
- - 2021-10-28 22:59:49.000000000 Z
- - 2021-10-30 15:02:25.000000000 Z
- - 2021-11-02 04:03:39.000000000 Z
- - 2021-11-04 22:41:23.000000000 Z
- - 2021-11-06 00:34:29.000000000 Z
- - 2021-11-06 23:56:16.000000000 Z
- - 2021-11-07 06:22:04.000000000 Z
- - 2021-11-07 19:46:08.000000000 Z
- - 2021-11-08 09:31:13.000000000 Z
- - 2021-11-09 17:22:03.000000000 Z
- - 2021-11-11 05:29:54.000000000 Z
- - 2021-11-13 09:41:04.000000000 Z
- - 2021-11-16 07:48:22.000000000 Z
- - 2021-11-16 12:43:44.000000000 Z
- - 2021-11-17 16:03:07.000000000 Z
- - 2021-11-20 02:39:01.000000000 Z
- - 2021-11-21 02:01:24.000000000 Z
- - 2021-11-23 19:24:43.000000000 Z
- - 2021-11-26 11:47:22.000000000 Z
- - 2021-11-28 06:30:04.000000000 Z
- - 2021-12-01 00:13:55.000000000 Z
- - 2021-12-03 19:10:16.000000000 Z
- - 2021-12-04 00:43:47.000000000 Z
- - 2021-12-06 20:15:35.000000000 Z
- - 2021-12-09 16:27:07.000000000 Z
- - 2021-12-10 15:28:48.000000000 Z
- - 2021-12-10 23:08:16.000000000 Z
- - 2021-12-11 23:09:08.000000000 Z
- - 2021-12-14 04:56:58.000000000 Z
- - 2021-12-14 14:00:56.000000000 Z
- - 2021-12-15 22:58:51.000000000 Z
- - 2021-12-16 01:28:21.000000000 Z
- - 2021-12-16 20:16:54.000000000 Z
- - 2021-12-19 00:34:04.000000000 Z
- - 2021-12-19 06:58:41.000000000 Z
- - 2021-12-21 11:13:53.000000000 Z
- - 2021-12-23 07:28:50.000000000 Z
- - 2021-12-23 07:57:58.000000000 Z
- - 2021-12-23 18:32:13.000000000 Z
- - 2021-12-24 01:17:51.000000000 Z
- - 2021-12-25 05:36:16.000000000 Z
- - 2021-12-25 23:21:57.000000000 Z
- - 2021-12-27 12:18:57.000000000 Z
- - 2021-12-28 16:59:57.000000000 Z
- - 2021-12-31 15:10:23.000000000 Z
-calendar__instance_methods_test_0010_selects__month_for_the_first_page:
- :entries:
- - 2021-10-21 13:18:23.000000000 Z
- - 2021-10-21 23:14:50.000000000 Z
- - 2021-10-23 01:06:02.000000000 Z
- - 2021-10-25 18:54:35.000000000 Z
- - 2021-10-26 02:22:17.000000000 Z
- - 2021-10-28 22:59:49.000000000 Z
- - 2021-10-30 15:02:25.000000000 Z
-calendar__instance_methods_test_0019_runs_multiple_units:
- :entries:
- - 2022-07-16 15:40:39.000000000 Z
- - 2022-07-17 19:44:15.000000000 Z
- - 2022-07-19 00:31:12.000000000 Z
- - 2022-07-21 21:58:24.000000000 Z
- - 2022-07-22 05:25:48.000000000 Z
- - 2022-07-22 18:33:04.000000000 Z
- - 2022-07-24 07:42:24.000000000 Z
- - 2022-07-25 07:21:20.000000000 Z
- - 2022-07-27 12:02:44.000000000 Z
- - 2022-07-29 03:29:28.000000000 Z
-calendar__instance_methods_test_0006_selects__year_for_the_pages_and_check_the_total:
+calendar__instance_methods_test_0004_selects__year_for_the_pages_and_check_the_total:
:entries:
- 2021-10-21 13:18:23.000000000 Z
- 2021-10-21 23:14:50.000000000 Z
@@ -742,96 +618,220 @@ calendar__instance_methods_test_0006_selects__year_for_the_pages_and_check_the_t
- 2023-11-12 04:22:50.000000000 Z
- 2023-11-12 08:38:58.000000000 Z
- 2023-11-13 15:43:40.000000000 Z
-calendar__Counts_feature_test_0001_works_with_MockApp__CalendarCounts:
- :year:
- :month:
- :day:
-calendar__Counts_feature_test_0003_works_with_anchor_string:
- :year:
-calendar__Counts_feature_test_0002_works_with_MockApp__CalendarCountsSkip:
- :year:
- :month:
- :day:
+calendar__instance_methods_test_0010_selects__month_for_the_last_page:
+ :entries:
+ - 2023-11-02 02:52:55.000000000 Z
+ - 2023-11-02 06:00:32.000000000 Z
+ - 2023-11-03 08:39:06.000000000 Z
+ - 2023-11-04 23:51:22.000000000 Z
+ - 2023-11-07 16:11:33.000000000 Z
+ - 2023-11-10 10:55:29.000000000 Z
+ - 2023-11-12 01:20:18.000000000 Z
+ - 2023-11-12 04:22:50.000000000 Z
+ - 2023-11-12 08:38:58.000000000 Z
+ - 2023-11-13 15:43:40.000000000 Z
+calendar__instance_methods_test_0016_selects__day_for_the_last_page:
+ :entries:
+ - 2021-12-19 00:34:04.000000000 Z
+ - 2021-12-19 06:58:41.000000000 Z
+calendar__instance_methods_test_0006_selects__quarter_for_an_intermediate_page:
+ :entries:
+ - 2022-07-01 16:05:14.000000000 Z
+ - 2022-07-02 14:02:12.000000000 Z
+ - 2022-07-05 11:08:11.000000000 Z
+ - 2022-07-05 12:44:38.000000000 Z
+ - 2022-07-08 03:55:17.000000000 Z
+ - 2022-07-08 18:02:14.000000000 Z
+ - 2022-07-09 09:41:17.000000000 Z
+ - 2022-07-11 07:34:51.000000000 Z
+ - 2022-07-13 05:11:19.000000000 Z
+ - 2022-07-15 02:46:56.000000000 Z
+ - 2022-07-16 15:40:39.000000000 Z
+ - 2022-07-17 19:44:15.000000000 Z
+ - 2022-07-19 00:31:12.000000000 Z
+ - 2022-07-21 21:58:24.000000000 Z
+ - 2022-07-22 05:25:48.000000000 Z
+ - 2022-07-22 18:33:04.000000000 Z
+ - 2022-07-24 07:42:24.000000000 Z
+ - 2022-07-25 07:21:20.000000000 Z
+ - 2022-07-27 12:02:44.000000000 Z
+ - 2022-07-29 03:29:28.000000000 Z
+ - 2022-07-29 11:35:43.000000000 Z
+ - 2022-07-30 05:25:21.000000000 Z
+ - 2022-07-30 19:39:10.000000000 Z
+ - 2022-07-31 18:54:58.000000000 Z
+ - 2022-08-03 11:18:44.000000000 Z
+ - 2022-08-05 00:37:47.000000000 Z
+ - 2022-08-05 12:08:08.000000000 Z
+ - 2022-08-07 14:39:19.000000000 Z
+ - 2022-08-08 09:52:59.000000000 Z
+ - 2022-08-09 13:48:29.000000000 Z
+ - 2022-08-11 19:03:04.000000000 Z
+ - 2022-08-13 01:56:49.000000000 Z
+ - 2022-08-15 11:33:09.000000000 Z
+ - 2022-08-17 23:37:45.000000000 Z
+ - 2022-08-19 00:47:19.000000000 Z
+ - 2022-08-19 01:01:12.000000000 Z
+ - 2022-08-21 07:37:55.000000000 Z
+ - 2022-08-21 21:42:15.000000000 Z
+ - 2022-08-23 10:55:39.000000000 Z
+ - 2022-08-25 16:20:29.000000000 Z
+ - 2022-08-27 06:28:14.000000000 Z
+ - 2022-08-27 13:12:57.000000000 Z
+ - 2022-08-28 23:00:13.000000000 Z
+ - 2022-08-31 05:19:56.000000000 Z
+ - 2022-09-02 18:00:18.000000000 Z
+ - 2022-09-04 12:02:47.000000000 Z
+ - 2022-09-06 00:57:21.000000000 Z
+ - 2022-09-08 04:26:01.000000000 Z
+ - 2022-09-09 04:55:45.000000000 Z
+ - 2022-09-11 22:59:36.000000000 Z
+ - 2022-09-12 00:54:25.000000000 Z
+ - 2022-09-12 17:44:24.000000000 Z
+ - 2022-09-12 20:47:30.000000000 Z
+ - 2022-09-15 11:39:20.000000000 Z
+ - 2022-09-16 07:54:15.000000000 Z
+ - 2022-09-17 08:06:29.000000000 Z
+ - 2022-09-18 07:17:17.000000000 Z
+ - 2022-09-19 08:39:55.000000000 Z
+ - 2022-09-22 06:32:56.000000000 Z
+ - 2022-09-22 21:26:29.000000000 Z
+ - 2022-09-24 16:06:50.000000000 Z
+ - 2022-09-27 05:50:18.000000000 Z
+ - 2022-09-28 12:12:13.000000000 Z
+ - 2022-09-29 21:13:01.000000000 Z
+ - 2022-09-30 00:09:29.000000000 Z
+calendar__instance_methods_test_0015_selects__day_for_an_intermediate_page:
+ :entries: []
+calendar__instance_methods_test_0005_selects__quarter_for_the_first_page:
+ :entries:
+ - 2021-10-21 13:18:23.000000000 Z
+ - 2021-10-21 23:14:50.000000000 Z
+ - 2021-10-23 01:06:02.000000000 Z
+ - 2021-10-25 18:54:35.000000000 Z
+ - 2021-10-26 02:22:17.000000000 Z
+ - 2021-10-28 22:59:49.000000000 Z
+ - 2021-10-30 15:02:25.000000000 Z
+ - 2021-11-02 04:03:39.000000000 Z
+ - 2021-11-04 22:41:23.000000000 Z
+ - 2021-11-06 00:34:29.000000000 Z
+ - 2021-11-06 23:56:16.000000000 Z
+ - 2021-11-07 06:22:04.000000000 Z
+ - 2021-11-07 19:46:08.000000000 Z
+ - 2021-11-08 09:31:13.000000000 Z
+ - 2021-11-09 17:22:03.000000000 Z
+ - 2021-11-11 05:29:54.000000000 Z
+ - 2021-11-13 09:41:04.000000000 Z
+ - 2021-11-16 07:48:22.000000000 Z
+ - 2021-11-16 12:43:44.000000000 Z
+ - 2021-11-17 16:03:07.000000000 Z
+ - 2021-11-20 02:39:01.000000000 Z
+ - 2021-11-21 02:01:24.000000000 Z
+ - 2021-11-23 19:24:43.000000000 Z
+ - 2021-11-26 11:47:22.000000000 Z
+ - 2021-11-28 06:30:04.000000000 Z
+ - 2021-12-01 00:13:55.000000000 Z
+ - 2021-12-03 19:10:16.000000000 Z
+ - 2021-12-04 00:43:47.000000000 Z
+ - 2021-12-06 20:15:35.000000000 Z
+ - 2021-12-09 16:27:07.000000000 Z
+ - 2021-12-10 15:28:48.000000000 Z
+ - 2021-12-10 23:08:16.000000000 Z
+ - 2021-12-11 23:09:08.000000000 Z
+ - 2021-12-14 04:56:58.000000000 Z
+ - 2021-12-14 14:00:56.000000000 Z
+ - 2021-12-15 22:58:51.000000000 Z
+ - 2021-12-16 01:28:21.000000000 Z
+ - 2021-12-16 20:16:54.000000000 Z
+ - 2021-12-19 00:34:04.000000000 Z
+ - 2021-12-19 06:58:41.000000000 Z
+ - 2021-12-21 11:13:53.000000000 Z
+ - 2021-12-23 07:28:50.000000000 Z
+ - 2021-12-23 07:57:58.000000000 Z
+ - 2021-12-23 18:32:13.000000000 Z
+ - 2021-12-24 01:17:51.000000000 Z
+ - 2021-12-25 05:36:16.000000000 Z
+ - 2021-12-25 23:21:57.000000000 Z
+ - 2021-12-27 12:18:57.000000000 Z
+ - 2021-12-28 16:59:57.000000000 Z
+ - 2021-12-31 15:10:23.000000000 Z
+calendar__instance_methods_test_0008_selects__month_for_the_first_page:
+ :entries:
+ - 2021-10-21 13:18:23.000000000 Z
+ - 2021-10-21 23:14:50.000000000 Z
+ - 2021-10-23 01:06:02.000000000 Z
+ - 2021-10-25 18:54:35.000000000 Z
+ - 2021-10-26 02:22:17.000000000 Z
+ - 2021-10-28 22:59:49.000000000 Z
+ - 2021-10-30 15:02:25.000000000 Z
+calendar__instance_methods_test_0007_selects__quarter_for_last_page:
+ :entries:
+ - 2023-10-01 11:54:24.000000000 Z
+ - 2023-10-03 07:36:32.000000000 Z
+ - 2023-10-05 05:13:57.000000000 Z
+ - 2023-10-06 16:07:06.000000000 Z
+ - 2023-10-09 00:03:52.000000000 Z
+ - 2023-10-09 02:32:01.000000000 Z
+ - 2023-10-10 16:39:07.000000000 Z
+ - 2023-10-12 13:28:16.000000000 Z
+ - 2023-10-14 04:29:14.000000000 Z
+ - 2023-10-17 03:30:24.000000000 Z
+ - 2023-10-20 03:13:15.000000000 Z
+ - 2023-10-20 20:47:06.000000000 Z
+ - 2023-10-21 13:59:34.000000000 Z
+ - 2023-10-23 21:38:48.000000000 Z
+ - 2023-10-24 06:07:13.000000000 Z
+ - 2023-10-25 22:51:17.000000000 Z
+ - 2023-10-26 21:12:50.000000000 Z
+ - 2023-10-28 05:52:20.000000000 Z
+ - 2023-10-29 22:11:01.000000000 Z
+ - 2023-10-30 12:29:25.000000000 Z
+ - 2023-11-02 02:52:55.000000000 Z
+ - 2023-11-02 06:00:32.000000000 Z
+ - 2023-11-03 08:39:06.000000000 Z
+ - 2023-11-04 23:51:22.000000000 Z
+ - 2023-11-07 16:11:33.000000000 Z
+ - 2023-11-10 10:55:29.000000000 Z
+ - 2023-11-12 01:20:18.000000000 Z
+ - 2023-11-12 04:22:50.000000000 Z
+ - 2023-11-12 08:38:58.000000000 Z
+ - 2023-11-13 15:43:40.000000000 Z
+calendar__instance_methods_test_0013_selects__week_for_the_last_page:
+ :entries:
+ - 2023-11-12 01:20:18.000000000 Z
+ - 2023-11-12 04:22:50.000000000 Z
+ - 2023-11-12 08:38:58.000000000 Z
+ - 2023-11-13 15:43:40.000000000 Z
+calendar__instance_methods_test_0009_selects__month_for_an_intermediate_page:
+ :entries:
+ - 2023-10-01 11:54:24.000000000 Z
+ - 2023-10-03 07:36:32.000000000 Z
+ - 2023-10-05 05:13:57.000000000 Z
+ - 2023-10-06 16:07:06.000000000 Z
+ - 2023-10-09 00:03:52.000000000 Z
+ - 2023-10-09 02:32:01.000000000 Z
+ - 2023-10-10 16:39:07.000000000 Z
+ - 2023-10-12 13:28:16.000000000 Z
+ - 2023-10-14 04:29:14.000000000 Z
+ - 2023-10-17 03:30:24.000000000 Z
+ - 2023-10-20 03:13:15.000000000 Z
+ - 2023-10-20 20:47:06.000000000 Z
+ - 2023-10-21 13:59:34.000000000 Z
+ - 2023-10-23 21:38:48.000000000 Z
+ - 2023-10-24 06:07:13.000000000 Z
+ - 2023-10-25 22:51:17.000000000 Z
+ - 2023-10-26 21:12:50.000000000 Z
+ - 2023-10-28 05:52:20.000000000 Z
+ - 2023-10-29 22:11:01.000000000 Z
+ - 2023-10-30 12:29:25.000000000 Z
+calendar__instance_methods_test_0012_selects__week_for_an_intermediate_page:
+ :entries:
+ - 2022-04-03 18:27:19.000000000 Z
+ - 2022-04-03 23:44:08.000000000 Z
+ - 2022-04-06 10:59:32.000000000 Z
+ - 2022-04-07 01:33:53.000000000 Z
+ - 2022-04-08 10:26:34.000000000 Z
+calendar__instance_methods_test_0014_selects__day_for_the_first_page:
+ :entries:
+ - 2021-10-21 13:18:23.000000000 Z
+ - 2021-10-21 23:14:50.000000000 Z
diff --git a/test/pagy/frontend_test.rb b/test/pagy/frontend_test.rb
index 86d92f864..f6e3a89c7 100644
--- a/test/pagy/frontend_test.rb
+++ b/test/pagy/frontend_test.rb
@@ -22,9 +22,6 @@ def i18n_load(*locales)
it 'renders with extras' do
pagy = Pagy::Offset.new(count: 103, page: 1)
_(app.pagy_anchor(pagy, anchor_string: 'X').call(3)).must_equal '3'
- pagy = Pagy::Offset.new(count: 103, page: 1, calendar_counts: {2 => 0})
- _(app.pagy_anchor(pagy, anchor_string: 'X').call(3, classes: 'a b c'))
- .must_equal '3'
end
end