pagy 5.5.0 → 5.5.1
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/calendar/day.rb +2 -2
- data/lib/pagy/calendar/month.rb +2 -2
- data/lib/pagy/calendar/week.rb +2 -2
- data/lib/pagy/calendar/year.rb +2 -2
- data/lib/pagy/calendar.rb +2 -3
- data/lib/pagy.rb +1 -1
- data/lib/templates/bootstrap_nav.html.erb +1 -1
- data/lib/templates/bootstrap_nav.html.haml +1 -1
- data/lib/templates/bootstrap_nav.html.slim +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: e23922e820d30e39dee31d0b1931e79da25f9fd6fa4ee4c5f75a25f383ca99bc
|
4
|
+
data.tar.gz: 863360e18514c2250c2746d7fdfac4b11e65e0b04488150bee078466877a8b33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27819f1864544b94b0c916cca3d4d43a7bfd051c41a7a202b30818e9b5730fd754c2034247c912d48bb046d90ce46f95f4a18a636b2b75e8ed6b06203f1ddc81
|
7
|
+
data.tar.gz: '031559fa58448415d4555613c76cb16f3e5f1b1262400d6ea928c0817dd45a6902a28014052860aa1ac74f6da59d2313d142226635fd6d351578f12477e34439'
|
data/lib/config/pagy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Pagy initializer file (5.5.
|
3
|
+
# Pagy initializer file (5.5.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/day.rb
CHANGED
@@ -16,12 +16,12 @@ class Pagy # :nodoc:
|
|
16
16
|
@initial = new_time(@starting.year, @starting.month, @starting.day)
|
17
17
|
@final = new_time(@ending.year, @ending.month, @ending.day) + DAY
|
18
18
|
@pages = @last = (@final - @initial).to_i / DAY
|
19
|
-
@from =
|
19
|
+
@from = start_for(@page)
|
20
20
|
@to = @from + DAY
|
21
21
|
end
|
22
22
|
|
23
23
|
# Time for the page
|
24
|
-
def
|
24
|
+
def start_for(page)
|
25
25
|
@initial + (snap(page) * DAY)
|
26
26
|
end
|
27
27
|
end
|
data/lib/pagy/calendar/month.rb
CHANGED
@@ -16,12 +16,12 @@ class Pagy # :nodoc:
|
|
16
16
|
@initial = new_time(@starting.year, @starting.month)
|
17
17
|
@final = bump_month(@ending)
|
18
18
|
@pages = @last = months(@final) - months(@initial)
|
19
|
-
@from =
|
19
|
+
@from = start_for(@page)
|
20
20
|
@to = bump_month(@from)
|
21
21
|
end
|
22
22
|
|
23
23
|
# Time for the page
|
24
|
-
def
|
24
|
+
def start_for(page)
|
25
25
|
bump_month(@initial, snap(page))
|
26
26
|
end
|
27
27
|
|
data/lib/pagy/calendar/week.rb
CHANGED
@@ -18,12 +18,12 @@ class Pagy # :nodoc:
|
|
18
18
|
@initial = week_start(@starting)
|
19
19
|
@final = week_start(@ending) + WEEK
|
20
20
|
@pages = @last = (@final - @initial).to_i / WEEK
|
21
|
-
@from =
|
21
|
+
@from = start_for(@page)
|
22
22
|
@to = @from + WEEK
|
23
23
|
end
|
24
24
|
|
25
25
|
# Time for the page
|
26
|
-
def
|
26
|
+
def start_for(page)
|
27
27
|
@initial + (snap(page) * WEEK)
|
28
28
|
end
|
29
29
|
|
data/lib/pagy/calendar/year.rb
CHANGED
@@ -16,12 +16,12 @@ class Pagy # :nodoc:
|
|
16
16
|
@initial = new_time(@starting.year)
|
17
17
|
@final = new_time(@ending.year + 1)
|
18
18
|
@pages = @last = @final.year - @initial.year
|
19
|
-
@from =
|
19
|
+
@from = start_for(@page)
|
20
20
|
@to = new_time(@from.year + 1)
|
21
21
|
end
|
22
22
|
|
23
23
|
# Time for the page
|
24
|
-
def
|
24
|
+
def start_for(page)
|
25
25
|
new_time(@initial.year + snap(page))
|
26
26
|
end
|
27
27
|
end
|
data/lib/pagy/calendar.rb
CHANGED
@@ -34,7 +34,7 @@ class Pagy # :nodoc:
|
|
34
34
|
# The label for any page (it can pass along the I18n gem opts when it's used with the i18n extra)
|
35
35
|
def label_for(page, **opts)
|
36
36
|
opts[:format] ||= @vars[:format]
|
37
|
-
localize(
|
37
|
+
localize(start_for(page.to_i), **opts)
|
38
38
|
end
|
39
39
|
|
40
40
|
# Period of the active page (used for nested units)
|
@@ -61,8 +61,7 @@ class Pagy # :nodoc:
|
|
61
61
|
time.strftime(opts[:format])
|
62
62
|
end
|
63
63
|
|
64
|
-
# Simple trick to snap the page
|
65
|
-
# Tech note: use for @from but not for @to, which must be one period after @from also in :desc order!
|
64
|
+
# Simple trick to snap the page to its ordered start, without actually reordering anything in the internal structure.
|
66
65
|
def snap(page)
|
67
66
|
@order == :asc ? page - 1 : @pages - page
|
68
67
|
end
|
data/lib/pagy.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
The link variable is set to a proc that returns the link tag.
|
6
6
|
Usage: link.call( page_number [, text [, extra_attributes_string ]])
|
7
7
|
-%>
|
8
|
-
<% link = pagy_link_proc(pagy, 'class="page-link"') -%>
|
8
|
+
<% link = pagy_link_proc(pagy, link_extra: 'class="page-link"') -%>
|
9
9
|
<%# -%><nav aria-label="pager" class="pagy-bootstrap-nav" role="navigation">
|
10
10
|
<%# -%> <ul class="pagination">
|
11
11
|
<% if pagy.prev -%> <li class="page-item prev"><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"') %></li>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
-# The link variable is set to a proc that returns the link tag.
|
5
5
|
-# Usage: link.call( page_number [, text [, extra_attributes_string ]])
|
6
6
|
|
7
|
-
- link = pagy_link_proc(pagy, 'class="page-link"')
|
7
|
+
- link = pagy_link_proc(pagy, link_extra: 'class="page-link"')
|
8
8
|
|
9
9
|
%nav.pagy-bootstrap-nav{"aria-label" => "pager", :role => "navigation"}
|
10
10
|
|
@@ -4,7 +4,7 @@
|
|
4
4
|
/ The link variable is set to a proc that returns the link tag.
|
5
5
|
/ Usage: link.call( page_number [, text [, extra_attributes_string ]])
|
6
6
|
|
7
|
-
- link = pagy_link_proc(pagy, 'class="page-link"')
|
7
|
+
- link = pagy_link_proc(pagy, link_extra: 'class="page-link"')
|
8
8
|
|
9
9
|
nav.pagy-bootstrap-nav role="navigation" aria-label="pager"
|
10
10
|
|
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.5.
|
4
|
+
version: 5.5.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-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Agnostic pagination in plain ruby. It does it all. Better.
|
14
14
|
email:
|