pagy 5.3.0 → 5.3.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/calendar.rb +7 -6
- data/lib/pagy/extras/calendar.rb +3 -3
- data/lib/pagy/extras/i18n.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: e3530b69891d7c069acdb707d6fa54e8b5d31763a80e57dae2e0fe3afafce8b2
|
4
|
+
data.tar.gz: defdc75e9f60ae351e8b071fffd3bf4767e28d51edd8ec6398a1b5958d688084
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13dc93a7f0de2f1e4a688292e1901905df218d500fe1543e4d518dab1f1e7f7d2276cc63f197c251b1ed14e8fea4b46d8be4590ccbad89cfed11d70481a769a2
|
7
|
+
data.tar.gz: f6ddac95479d63445920df9bad22142f59b9b14e2a4c758303c76389eefd1a475ce49dd1e781e70519bed0a081c1b2296bb19be6ca6e50feefa0abb9660749a6
|
data/lib/config/pagy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Pagy initializer file (5.3.
|
3
|
+
# Pagy initializer file (5.3.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
data/lib/pagy/calendar.rb
CHANGED
@@ -32,7 +32,7 @@ class Pagy # :nodoc:
|
|
32
32
|
end
|
33
33
|
|
34
34
|
# Generate a label for each page, with the specific `Time` period it refers to
|
35
|
-
#
|
35
|
+
# (it can pass along the I18n gem opts when it's used with the i18n extra)
|
36
36
|
def label_for(page, **opts)
|
37
37
|
snap = snap(page.to_i)
|
38
38
|
time = case @unit
|
@@ -43,11 +43,11 @@ class Pagy # :nodoc:
|
|
43
43
|
else raise InternalError, "expected @unit to be in [:year, :month, :week, :day]; got #{@unit.inspect}"
|
44
44
|
end
|
45
45
|
opts[:format] ||= @vars[:"#{@unit}_format"]
|
46
|
-
|
46
|
+
localize(time, **opts)
|
47
47
|
end
|
48
48
|
|
49
49
|
# The label for the current page
|
50
|
-
#
|
50
|
+
# (it can pass along the I18n gem opts when it's used with the i18n extra)
|
51
51
|
def label(**opts)
|
52
52
|
label_for(@page, **opts)
|
53
53
|
end
|
@@ -69,7 +69,7 @@ class Pagy # :nodoc:
|
|
69
69
|
|
70
70
|
min, max = @vars[:local_minmax]
|
71
71
|
raise VariableError.new(self, :local_minmax, 'to be a an Array of min and max local Time instances', @vars[:local_minmax]) \
|
72
|
-
unless min.is_a?(Time) && max.is_a?(Time) && !min.utc? && !
|
72
|
+
unless min.is_a?(Time) && max.is_a?(Time) && !min.utc? && !max.utc? && min <= max \
|
73
73
|
&& (@utc_offset = min.utc_offset) == max.utc_offset
|
74
74
|
|
75
75
|
send :"setup_#{@unit}_vars", min, max
|
@@ -118,8 +118,9 @@ class Pagy # :nodoc:
|
|
118
118
|
@utc_to = @utc_from + DAY
|
119
119
|
end
|
120
120
|
|
121
|
-
#
|
122
|
-
|
121
|
+
# Apply the strftime format to the time
|
122
|
+
# (overridden by the i18n extra when localization is required)
|
123
|
+
def localize(time, **opts)
|
123
124
|
time.strftime(opts[:format])
|
124
125
|
end
|
125
126
|
|
data/lib/pagy/extras/calendar.rb
CHANGED
@@ -25,11 +25,11 @@ class Pagy # :nodoc:
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# This method should be implemented in the application and should return the records
|
28
|
-
# for the unit by selecting the records with
|
28
|
+
# for the unit by selecting the records with Time from pagy.utc_from to pagy.utc_to
|
29
29
|
def pagy_calendar_get_items(_collection, _pagy)
|
30
|
-
# collection.your_own_method_to_get_the_items_with(pagy.
|
30
|
+
# collection.your_own_method_to_get_the_items_with(pagy.utc_from, pagy.utc_to)
|
31
31
|
raise NoMethodError, 'The pagy_calendar_get_items method must be implemented in the application and must return ' \
|
32
|
-
'the items for the unit by selecting the records with Time from pagy.
|
32
|
+
'the items for the unit by selecting the records with Time from pagy.utc_from to pagy.utc_to'
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
data/lib/pagy/extras/i18n.rb
CHANGED
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.3.
|
4
|
+
version: 5.3.1
|
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-12 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Agnostic pagination in plain ruby. It does it all. Better.
|
14
14
|
email:
|