pagy 5.5.0 → 5.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 78c55595ac8caaa34c73688103333dc62e9ebb395696725e7c305e5ace3d7f42
4
- data.tar.gz: 3e259f8f72025fc7955fb6107920be08025539d5178e5c4c714173d26aa05da1
3
+ metadata.gz: e23922e820d30e39dee31d0b1931e79da25f9fd6fa4ee4c5f75a25f383ca99bc
4
+ data.tar.gz: 863360e18514c2250c2746d7fdfac4b11e65e0b04488150bee078466877a8b33
5
5
  SHA512:
6
- metadata.gz: fede5003b2a686ee972d7dd93a80b5221704518212adb8faa7b133c309b2ece0094f3fbe72575fb4e29b706a819f5dc447fc6f3a89b4c3fe202e23542dfee310
7
- data.tar.gz: 15840445b0afa7e343c9f0f4ad196b847cb564d8d2a5da56b94a9a59ac348731fc6bb104c282343f77654a0d07090dd501957e751c843c88de208779581dbbae
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.0)
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
 
@@ -5,7 +5,7 @@
5
5
  // Container of the whole pagy stuff
6
6
  function Pagy(){}
7
7
 
8
- Pagy.version = '5.5.0'
8
+ Pagy.version = '5.5.1'
9
9
 
10
10
  // Used by the waitForMe function
11
11
  Pagy.delay = 100
@@ -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 = time_for(@page)
19
+ @from = start_for(@page)
20
20
  @to = @from + DAY
21
21
  end
22
22
 
23
23
  # Time for the page
24
- def time_for(page)
24
+ def start_for(page)
25
25
  @initial + (snap(page) * DAY)
26
26
  end
27
27
  end
@@ -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 = time_for(@page)
19
+ @from = start_for(@page)
20
20
  @to = bump_month(@from)
21
21
  end
22
22
 
23
23
  # Time for the page
24
- def time_for(page)
24
+ def start_for(page)
25
25
  bump_month(@initial, snap(page))
26
26
  end
27
27
 
@@ -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 = time_for(@page)
21
+ @from = start_for(@page)
22
22
  @to = @from + WEEK
23
23
  end
24
24
 
25
25
  # Time for the page
26
- def time_for(page)
26
+ def start_for(page)
27
27
  @initial + (snap(page) * WEEK)
28
28
  end
29
29
 
@@ -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 = time_for(@page)
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 time_for(page)
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(time_for(page.to_i), **opts)
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 into its ordered position, without actually reordering anything in the internal structure.
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 @@ require 'pathname'
5
5
 
6
6
  # Core class
7
7
  class Pagy
8
- VERSION = '5.5.0'
8
+ VERSION = '5.5.1'
9
9
 
10
10
  # Root pathname to get the path of Pagy files like templates or dictionaries
11
11
  def self.root
@@ -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.0
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-22 00:00:00.000000000 Z
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: