pagy 5.2.1 → 5.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/config/pagy.rb +1 -1
- data/lib/javascripts/pagy.js +1 -1
- data/lib/pagy/extras/headers.rb +2 -2
- data/lib/pagy/extras/metadata.rb +1 -1
- data/lib/pagy/extras/overflow.rb +1 -1
- data/lib/pagy.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cb4539d68931db35f7f2f8c9d53d9e8a63541f402f23621b92a51e6a2e77386
|
4
|
+
data.tar.gz: 4adbae6e3d5213c6628bec8a35a26c5e44ce09546fa6fdd74541d5bbf2feb63b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 277754cc4da9b7bd70c173ad052c87658eda48c7a42ad28675e1b5ce3eafae09932bf3c2a1682715890bbb4039ce3484f0a1adc7f7223e6bd3702e3cfb9b0eab
|
7
|
+
data.tar.gz: 9cb4995ece3b2fe8ab5625646cb1118080d27f52ce63af8efe5fd5178a6f8e8e77e9196a7f851780057fb315368622961f70eb65f808c460d011d5d890ff69bd
|
data/lib/config/pagy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Pagy initializer file (5.2.
|
3
|
+
# Pagy initializer file (5.2.2)
|
4
4
|
# Customize only what you really need and notice that Pagy works also without any of the following lines.
|
5
5
|
# Should you just cherry pick part of this file, please maintain the require-order of the extras
|
6
6
|
|
data/lib/javascripts/pagy.js
CHANGED
data/lib/pagy/extras/headers.rb
CHANGED
@@ -28,7 +28,7 @@ class Pagy # :nodoc:
|
|
28
28
|
|
29
29
|
# Generates a hash structure of the headers
|
30
30
|
def pagy_headers_hash(pagy)
|
31
|
-
countless = defined?(
|
31
|
+
countless = defined?(Countless) && pagy.is_a?(Countless)
|
32
32
|
rel = { 'first' => 1, 'prev' => pagy.prev, 'next' => pagy.next }
|
33
33
|
rel['last'] = pagy.last unless countless
|
34
34
|
url_str = pagy_url_for(pagy, PAGE_PLACEHOLDER, absolute: true)
|
@@ -39,7 +39,7 @@ class Pagy # :nodoc:
|
|
39
39
|
hash = { 'Link' => link }
|
40
40
|
headers = pagy.vars[:headers]
|
41
41
|
hash[headers[:page]] = pagy.page.to_s if headers[:page]
|
42
|
-
if headers[:items] && !(defined?(
|
42
|
+
if headers[:items] && !(defined?(Calendar) && pagy.is_a?(Calendar)) # items is not for Calendar
|
43
43
|
hash[headers[:items]] = pagy.vars[:items].to_s
|
44
44
|
end
|
45
45
|
unless countless
|
data/lib/pagy/extras/metadata.rb
CHANGED
@@ -17,7 +17,7 @@ class Pagy # :nodoc:
|
|
17
17
|
def pagy_metadata(pagy, absolute: nil)
|
18
18
|
scaffold_url = pagy_url_for(pagy, PAGE_PLACEHOLDER, absolute: absolute)
|
19
19
|
{}.tap do |metadata|
|
20
|
-
keys = pagy.is_a?(Calendar) ? pagy.vars[:metadata] - %i[count items] : pagy.vars[:metadata]
|
20
|
+
keys = defined?(Calendar) && pagy.is_a?(Calendar) ? pagy.vars[:metadata] - %i[count items] : pagy.vars[:metadata]
|
21
21
|
keys.each do |key|
|
22
22
|
metadata[key] = case key
|
23
23
|
when :scaffold_url then scaffold_url
|
data/lib/pagy/extras/overflow.rb
CHANGED
@@ -28,7 +28,7 @@ class Pagy # :nodoc:
|
|
28
28
|
@vars[:page] = requested_page # restore the requested page
|
29
29
|
when :empty_page
|
30
30
|
@offset = @in = @from = @to = 0 # vars relative to the actual page
|
31
|
-
if is_a?(Calendar)
|
31
|
+
if defined?(Calendar) && is_a?(Calendar) # only for Calendar instances
|
32
32
|
edge = @order == :asc ? @final : @initial # get the edge of the overflow side (neat, but it would work with any time)
|
33
33
|
@utc_from = @utc_to = edge.getutc # set both to the edge utc time (a query with >= && < will get no record)
|
34
34
|
end
|
data/lib/pagy.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.2.
|
4
|
+
version: 5.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Domizio Demichelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Agnostic pagination in plain ruby. It does it all. Better.
|
14
14
|
email:
|