pagy 5.1.0 → 5.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/config/pagy.rb +1 -1
- data/lib/javascripts/pagy.js +1 -1
- data/lib/pagy/extras/standalone.rb +6 -6
- data/lib/pagy/url_helpers.rb +5 -5
- data/lib/pagy.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5300f9784ba9ab19522910b10e2f100a9823b5b52c91738966e946c91a08702a
|
4
|
+
data.tar.gz: 2dc3599be82ee24dba9e8074c1b84e5443d69550ddec6fd32967f66a316ecedd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36b6893409fad1745593238f9a169623841dc4b55172fd2263f0bba09b3436e8c7f4e6f5ff6fc65bd56233b510daef44df60238189249547205f17087ddd69ab
|
7
|
+
data.tar.gz: bddaf3afe21358ed1b9ed73de5585931f4dac9018cc37b30c268aae29cdd7f836ac4f77e4ea419f9268dc4f9f247907996ab2461cd6fc6a44d9e80467b513567
|
data/lib/config/pagy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Pagy initializer file (5.1.
|
3
|
+
# Pagy initializer file (5.1.1)
|
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
@@ -34,15 +34,15 @@ class Pagy
|
|
34
34
|
# it works exactly as the regular #pagy_url_for, relying on the params method and Rack.
|
35
35
|
# If there is a defined pagy.vars[:url] variable it does not need the params method nor Rack.
|
36
36
|
def pagy_url_for(pagy, page, absolute: nil)
|
37
|
-
|
38
|
-
return super unless (url =
|
37
|
+
p_vars = pagy.vars
|
38
|
+
return super unless (url = p_vars[:url])
|
39
39
|
|
40
|
-
params
|
41
|
-
params[
|
42
|
-
params[
|
40
|
+
params = p_vars[:params]
|
41
|
+
params[p_vars[:page_param].to_s] = page
|
42
|
+
params[p_vars[:items_param].to_s] = p_vars[:items] if defined?(ItemsExtra)
|
43
43
|
|
44
44
|
query_string = "?#{QueryUtils.build_nested_query(pagy_massage_params(params))}"
|
45
|
-
"#{url}#{query_string}#{
|
45
|
+
"#{url}#{query_string}#{p_vars[:fragment]}"
|
46
46
|
end
|
47
47
|
end
|
48
48
|
# In ruby 3+ `UrlHelpers.prepend StandaloneExtra` would be enough instead of using the next 2 lines
|
data/lib/pagy/url_helpers.rb
CHANGED
@@ -7,13 +7,13 @@ class Pagy
|
|
7
7
|
# It supports all Rack-based frameworks (Sinatra, Padrino, Rails, ...).
|
8
8
|
# For non-rack environments you can use the standalone extra
|
9
9
|
def pagy_url_for(pagy, page, absolute: nil)
|
10
|
-
|
11
|
-
params
|
12
|
-
params[
|
13
|
-
params[
|
10
|
+
p_vars = pagy.vars
|
11
|
+
params = request.GET.merge(p_vars[:params])
|
12
|
+
params[p_vars[:page_param].to_s] = page
|
13
|
+
params[p_vars[:items_param].to_s] = p_vars[:items] if defined?(ItemsExtra)
|
14
14
|
|
15
15
|
query_string = "?#{Rack::Utils.build_nested_query(pagy_massage_params(params))}"
|
16
|
-
"#{request.base_url if absolute}#{request.path}#{query_string}#{
|
16
|
+
"#{request.base_url if absolute}#{request.path}#{query_string}#{p_vars[:fragment]}"
|
17
17
|
end
|
18
18
|
|
19
19
|
# Sub-method called only by #pagy_url_for: here for easy customization of params by overriding
|
data/lib/pagy.rb
CHANGED