pagy 2.1.1 → 2.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: 2226375f9b2e7c4789d60aa45d08ba7f5842fc00caa3980586e0f1cf51a611ee
4
- data.tar.gz: 76aedcccf63588b2dd27e83e5b616485b36a768383e424df7048c863433e9f80
3
+ metadata.gz: cb2ad8b0a66d5a1d73d3e9424e7cf24982bd8afe30a19d9ecb4b128900045785
4
+ data.tar.gz: 185999aba7ea86b9db281ea40895c73825db1468800b64f27bdae7490a7e789e
5
5
  SHA512:
6
- metadata.gz: 4992b2396dc45b7226ae0de2d6cde8bacd93716152ef8a0f6b5fb643387451527db0d3f2bc5f830e361ea0e3fb789e4a3d343b4f16a828f9764912ad2531213e
7
- data.tar.gz: 459cb889d1c9ee9b653a0db42cb54923fa3755d42260482c66aa077244d1cd54a15323e769b8683a371dab6186c93eaf20c74214c15660de37d3139a9e31be98
6
+ metadata.gz: fe5a44fb9a9f0c6d6ea55cfa1ac88af5001ef9fbdb9b6093a63c8d1ab70f4cde3d38c451d9ea8d697c077a02e339d20e901fd80dd51d0d7b9fde508c0841f071
7
+ data.tar.gz: b3e76636525450e4dcb91abd60db0c466cdeae202b5590a2238adb55aa60df53646b75d958251c1428bccc4e171011a288500f61a7b787a442d9addff0937e25
data/lib/config/pagy.rb CHANGED
@@ -68,7 +68,7 @@
68
68
  # Headers extra: http response headers (and other helpers) useful for API pagination
69
69
  # See http://ddnexus.github.io/pagy/extras/headers
70
70
  # require 'pagy/extras/headers'
71
- # Pagy::VARS[:headers] = { items: 'Page-Items', count: 'Total-Count', pages: 'Total-Pages' } # default
71
+ # Pagy::VARS[:headers] = { page: 'Current-Page', items: 'Page-Items', count: 'Total-Count', pages: 'Total-Pages' } # default
72
72
 
73
73
  # Support extra: Extra support for features like: incremental, infinite, auto-scroll pagination
74
74
  # See https://ddnexus.github.io/pagy/extras/support
data/lib/pagy.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  require 'pathname'
6
6
 
7
- class Pagy ; VERSION = '2.1.1'
7
+ class Pagy ; VERSION = '2.1.2'
8
8
 
9
9
  class OverflowError < StandardError; attr_reader :pagy; def initialize(pagy) @pagy = pagy end; end
10
10
 
@@ -6,7 +6,7 @@ class Pagy
6
6
  # Add specialized backend methods to add pagination response headers
7
7
  module Backend ; private
8
8
 
9
- VARS[:headers] = { items: 'Page-Items', count: 'Total-Count', pages: 'Total-Pages' }
9
+ VARS[:headers] = { page: 'Current-Page', items: 'Page-Items', count: 'Total-Count', pages: 'Total-Pages' }
10
10
 
11
11
  include Helpers
12
12
 
@@ -26,6 +26,7 @@ class Pagy
26
26
  url_str = pagy_url_for(Frontend::MARKER, pagy, :url)
27
27
  hash = { 'Link' => Hash[rels.map{|rel, n|[rel, url_str.sub(Frontend::MARKER, n.to_s)] if n}.compact] }
28
28
  headers = pagy.vars[:headers]
29
+ hash[headers[:page]] = pagy.page if headers[:page]
29
30
  hash[headers[:items]] = pagy.vars[:items] if headers[:items]
30
31
  unless countless
31
32
  hash[headers[:pages]] = pagy.pages if headers[:pages]
data/lib/pagy/frontend.rb CHANGED
@@ -17,8 +17,6 @@ class Pagy
17
17
  "#{request.send(path_or_url)}?#{Rack::Utils.build_nested_query(pagy_get_params(params))}#{p_vars[:anchor]}"
18
18
  end
19
19
 
20
-
21
-
22
20
  # Sub-method called only by #pagy_url_for: here for easy customization of params by overriding
23
21
  def pagy_get_params(params) params end
24
22
  end
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: 2.1.1
4
+ version: 2.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: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2019-03-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: 'Agnostic pagination in plain ruby: it works with any framework, ORM
14
14
  and DB type, with all kinds of collections, even pre-paginated, scopes, Arrays,