pagy 5.6.0 → 5.6.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 +14 -11
- data/lib/javascripts/pagy.js +1 -1
- data/lib/pagy/calendar/quarter.rb +8 -1
- data/lib/pagy/calendar.rb +4 -6
- 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: a5d3090b61a9b11c0763a7c2d103ee36f4a36f0618e7e99b32357bab408a29bc
|
4
|
+
data.tar.gz: d5c3c376deda1c84558bbcff43809c9235cb2fc9ced7492ecdfe8df6397c873e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6591de1571e9b6bdf1a26668cf730dcbba4c83ef9f2d3727b3a1bec5f98c49a69ae2d55aab363444d85a3310e3de65fe119fb3606ca63cfdf56202c14c591568
|
7
|
+
data.tar.gz: 02fea4991aab7911107460e58e73a66f507f9fff990261f1536fddf016b9523003165ed0dfd024013282ef43fec221cb7fcfa27b7f6b23c60a742f175adc0eae
|
data/lib/config/pagy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Pagy initializer file (5.6.
|
3
|
+
# Pagy initializer file (5.6.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
|
|
@@ -40,22 +40,25 @@
|
|
40
40
|
# See https://ddnexus.github.io/pagy/extras/array
|
41
41
|
# require 'pagy/extras/array'
|
42
42
|
|
43
|
-
# Calendar extra: Add pagination filtering by calendar time unit (
|
43
|
+
# Calendar extra: Add pagination filtering by calendar time unit (year, quartr, month, week, day)
|
44
44
|
# See https://ddnexus.github.io/pagy/extras/calendar
|
45
45
|
# require 'pagy/extras/calendar'
|
46
46
|
# Default for each unit
|
47
|
-
# Pagy::Calendar::Year::DEFAULT[:order]
|
48
|
-
# Pagy::Calendar::Year::DEFAULT[:format]
|
47
|
+
# Pagy::Calendar::Year::DEFAULT[:order] = :asc # Time direction of pagination
|
48
|
+
# Pagy::Calendar::Year::DEFAULT[:format] = '%Y' # strftime format
|
49
49
|
#
|
50
|
-
# Pagy::Calendar::
|
51
|
-
# Pagy::Calendar::
|
50
|
+
# Pagy::Calendar::Quarter::DEFAULT[:order] = :asc # Time direction of pagination
|
51
|
+
# Pagy::Calendar::Quarter::DEFAULT[:format] = '%Y-Q%q' # strftime format
|
52
52
|
#
|
53
|
-
# Pagy::Calendar::
|
54
|
-
# Pagy::Calendar::
|
55
|
-
# Pagy::Calendar::Week::DEFAULT[:offset] = 0 # Day offset from Sunday (0: Sunday; 1: Monday;... 6: Saturday)
|
53
|
+
# Pagy::Calendar::Month::DEFAULT[:order] = :asc # Time direction of pagination
|
54
|
+
# Pagy::Calendar::Month::DEFAULT[:format] = '%Y-%m' # strftime format
|
56
55
|
#
|
57
|
-
# Pagy::Calendar::
|
58
|
-
# Pagy::Calendar::
|
56
|
+
# Pagy::Calendar::Week::DEFAULT[:order] = :asc # Time direction of pagination
|
57
|
+
# Pagy::Calendar::Week::DEFAULT[:format] = '%Y-%W' # strftime format
|
58
|
+
# Pagy::Calendar::Week::DEFAULT[:offset] = 0 # Day offset from Sunday (0: Sunday; 1: Monday;... 6: Saturday)
|
59
|
+
#
|
60
|
+
# Pagy::Calendar::Day::DEFAULT[:order] = :asc # Time direction of pagination
|
61
|
+
# Pagy::Calendar::Day::DEFAULT[:format] = '%Y-%m-%d' # strftime format
|
59
62
|
#
|
60
63
|
# Uncomment the following block, if you need calendar localization without using the I18n extra
|
61
64
|
# module LocalizePagyCalendar
|
data/lib/javascripts/pagy.js
CHANGED
@@ -8,9 +8,16 @@ class Pagy # :nodoc:
|
|
8
8
|
# Calendar quarter subclass
|
9
9
|
class Quarter < Calendar
|
10
10
|
DEFAULT = { order: :asc, # rubocop:disable Style/MutableConstant
|
11
|
-
format: '%Y-Q%q' }
|
11
|
+
format: '%Y-Q%q' } # '%q' token
|
12
12
|
MONTHS = 3 # number of months of the unit
|
13
13
|
include MonthMixin
|
14
|
+
|
15
|
+
# The label for any page, with the substitution of the '%q' token
|
16
|
+
def label_for(page, opts = {})
|
17
|
+
start_time = start_for(page.to_i)
|
18
|
+
opts[:format] = (opts[:format] || @vars[:format]).gsub('%q') { (start_time.month / 4) + 1 }
|
19
|
+
localize(start_time, opts)
|
20
|
+
end
|
14
21
|
end
|
15
22
|
end
|
16
23
|
end
|
data/lib/pagy/calendar.rb
CHANGED
@@ -29,16 +29,14 @@ class Pagy # :nodoc:
|
|
29
29
|
end
|
30
30
|
|
31
31
|
# The label for the current page (it can pass along the I18n gem opts when it's used with the i18n extra)
|
32
|
-
def label(
|
33
|
-
label_for(@page,
|
32
|
+
def label(opts = {})
|
33
|
+
label_for(@page, opts)
|
34
34
|
end
|
35
35
|
|
36
36
|
# The label for any page (it can pass along the I18n gem opts when it's used with the i18n extra)
|
37
|
-
def label_for(page,
|
37
|
+
def label_for(page, opts = {})
|
38
38
|
opts[:format] ||= @vars[:format]
|
39
|
-
|
40
|
-
opts[:format] = opts[:format].gsub('%q') { (start.month / 4) + 1 }
|
41
|
-
localize(start, **opts)
|
39
|
+
localize(start_for(page.to_i), opts)
|
42
40
|
end
|
43
41
|
|
44
42
|
# Period of the active page (used for nested units)
|
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.6.
|
4
|
+
version: 5.6.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-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Agnostic pagination in plain ruby. It does it all. Better.
|
14
14
|
email:
|