katalyst-tables 3.10.0 → 3.11.0
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '058d981c1598d836b758da0286de162feed139ae80aa1b59465a4505bd3ef0e2'
|
|
4
|
+
data.tar.gz: ed95bb712fdf61560678659121b5a368839830ae3577eca4ae9d4c98d04f5b6c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a24284360f7f865e46001614c877a4564c87b2c6a197a94ece8430d55ac1aa14b49d5f86be1b7304f662c56418b0d288e8ddfc8933298277b7579c0eff1042f5
|
|
7
|
+
data.tar.gz: e6cb76f7383fb3a146465701b2842ebe54f4e0352e6fd0fb0d88ea83c9c397de7789b66fdf8d1e589fafcef78a50f3063a359b9e588bf88422e8797fa38a8f3d
|
data/CHANGELOG.md
CHANGED
|
@@ -8,7 +8,15 @@ module Katalyst
|
|
|
8
8
|
"Pagy::Frontend".safe_constantize&.tap { |pagy| include(pagy) }
|
|
9
9
|
|
|
10
10
|
def self.pagy_legacy?
|
|
11
|
-
|
|
11
|
+
pagy_major < 43
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def self.pagy_pre_8?
|
|
15
|
+
pagy_major < 8
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def self.pagy_major
|
|
19
|
+
@pagy_major ||= Pagy::VERSION.scan(/\d+/).first.to_i
|
|
12
20
|
end
|
|
13
21
|
|
|
14
22
|
delegate :pagy_legacy?, to: :class
|
|
@@ -25,7 +33,7 @@ module Katalyst
|
|
|
25
33
|
end
|
|
26
34
|
|
|
27
35
|
def call
|
|
28
|
-
|
|
36
|
+
render_nav.html_safe # rubocop:disable Rails/OutputSafety
|
|
29
37
|
end
|
|
30
38
|
|
|
31
39
|
def pagy_options
|
|
@@ -38,6 +46,12 @@ module Katalyst
|
|
|
38
46
|
|
|
39
47
|
private
|
|
40
48
|
|
|
49
|
+
def render_nav
|
|
50
|
+
return pagy_nav(@pagy, **pagy_options) if pagy_legacy?
|
|
51
|
+
|
|
52
|
+
@pagy.series_nav(**pagy_options)
|
|
53
|
+
end
|
|
54
|
+
|
|
41
55
|
def default_pagy_options
|
|
42
56
|
pagy_legacy? ? {} : { anchor_string: 'data-turbo-action="replace"' }
|
|
43
57
|
end
|
|
@@ -38,7 +38,7 @@ module Katalyst
|
|
|
38
38
|
opts = @paginate.is_a?(Hash) ? @paginate : {}
|
|
39
39
|
opts = opts.dup
|
|
40
40
|
|
|
41
|
-
if PagyNavComponent.
|
|
41
|
+
if PagyNavComponent.pagy_pre_8?
|
|
42
42
|
opts[:anchor_string] ||= "data-turbo-action=\"replace\""
|
|
43
43
|
end
|
|
44
44
|
|
|
@@ -48,7 +48,11 @@ module Katalyst
|
|
|
48
48
|
class Paginate # :nodoc:
|
|
49
49
|
# Pagy is not a required gem unless you're using pagination
|
|
50
50
|
# Expect to see NoMethodError failures if pagy is not available
|
|
51
|
-
"Pagy::
|
|
51
|
+
if (pagy_method = "Pagy::Method".safe_constantize)
|
|
52
|
+
include(pagy_method)
|
|
53
|
+
else
|
|
54
|
+
"Pagy::Backend".safe_constantize&.tap { |pagy| include(pagy) }
|
|
55
|
+
end
|
|
52
56
|
|
|
53
57
|
def initialize(app)
|
|
54
58
|
@app = app
|
|
@@ -64,7 +68,12 @@ module Katalyst
|
|
|
64
68
|
|
|
65
69
|
# pagy shim
|
|
66
70
|
def params
|
|
67
|
-
@collection.
|
|
71
|
+
@collection.to_params
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Pagy 43 expects a request object; provide the minimal hash interface it supports.
|
|
75
|
+
def request
|
|
76
|
+
{ base_url: nil, path: nil, params:, cookie: nil }
|
|
68
77
|
end
|
|
69
78
|
end
|
|
70
79
|
end
|