pagy-extras 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8da20721f683aac5052287cdbb6672a7e81493676a3325682a821be46d8f612f
4
- data.tar.gz: '086cf64662314bf33b28a5fdb44bd05d206f4a459dab4e825191eb54209c5083'
3
+ metadata.gz: 92a12e4d92cdb183028f474da6cdc2e0468a2957a217f41d79fe24e8070126ce
4
+ data.tar.gz: a67240b6affeed1565773b7dfb403a8da43b159f1678b2aa9b7b014eadceb3bb
5
5
  SHA512:
6
- metadata.gz: c7f92ccc55f9711f9c495e07b56f57071dcf1a5b788289cced9c88735934ec58ae3d561c5400b608e960753569690c072fa0b2cdd0294846444686c53b83692e
7
- data.tar.gz: 613045cdb7cbd51a83a7491c5f596295f509f1b01ace9724f681cf18ba33495d24329680758a8af1d11fe06ae1c846544576f838985aa62eb10e27adc4ba4df6
6
+ metadata.gz: 1b06fb2e67cdb66f5c6baf234f03b131caa169e3411f2245edad0a54ac62855844a24db1da95bfbea6a6034023cd6f0356499eb411b2e900f72b849c4244fe49
7
+ data.tar.gz: d3cccfbbb924e54d859e1a367896ad7d0999797fa78fa911e438509e973ac03f446318caf99bcfe032b18ed7b314249a9f2af4df1658b1a6407fac3523a619e9
@@ -6,6 +6,18 @@ class Pagy
6
6
 
7
7
  VARS[:breakpoints] = { 0 => [1,4,4,1] }
8
8
 
9
+ # Helper for building the page_nav with javascript. For example:
10
+ # with an object like:
11
+ # Pagy.new count:1000, page: 20, breakpoints: {0 => [1,2,2,1], 350 => [2,3,3,2], 550 => [3,4,4,3]}
12
+ # it returns something like:
13
+ # { :items => [1, :gap, 18, 19, "20", 21, 22, 50, 2, 17, 23, 49, 3, 16, 24, 48],
14
+ # :series => { 0 =>[1, :gap, 18, 19, "20", 21, 22, :gap, 50],
15
+ # 350 =>[1, 2, :gap, 17, 18, 19, "20", 21, 22, 23, :gap, 49, 50],
16
+ # 550 =>[1, 2, 3, :gap, 16, 17, 18, 19, "20", 21, 22, 23, 24, :gap, 48, 49, 50] },
17
+ # :widths => [550, 350, 0] }
18
+ # where :items is the unordered array union of all the page numbers for all sizes (passed to the PagyResponsive javascript function)
19
+ # :series is the hash of the series keyed by width (used by the *_responsive helpers to create the JSON string)
20
+ # :widths is the desc-ordered array of widths (passed to the PagyResponsive javascript function)
9
21
  def responsive
10
22
  @responsive ||= {items: [], series: {}, widths:[]}.tap do |r|
11
23
  @vars[:breakpoints].key?(0) || raise(ArgumentError, "expected :breakpoints to contain the 0 size; got #{@vars[:breakpoint].inspect}")
@@ -5,7 +5,7 @@ require 'date'
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = 'pagy-extras'
8
- s.version = '0.1.1'
8
+ s.version = '0.1.2'
9
9
  s.authors = ['Domizio Demichelis']
10
10
  s.email = ['dd.nexus@gmail.com']
11
11
  s.date = Date.today.to_s
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagy-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domizio Demichelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-04-28 00:00:00.000000000 Z
11
+ date: 2018-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pagy