pagy 3.5.0 → 3.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: a1cd0c46c7653c9ca234cdc26c4582ba9aed45de1e9041aad2fd5f7bf19c6b0f
4
- data.tar.gz: 4c8527dd62f9a5f6e32e660a78df65e92ab72a26c97e148149927eea0043b8fb
3
+ metadata.gz: 5d5bc9d035a9a4d9f5f807a6e95cdad150a705ab17df7fc964ea3103614a7a7d
4
+ data.tar.gz: 6cee7bf4ccb841d55b1d38619f4cac613f765f8040fbe2162e2cf1ec99e84655
5
5
  SHA512:
6
- metadata.gz: 450fb7112761bee9bcceb85dfcdd38c03e7914e29c8ea7f6816e8bebbbd7c742a39f77e9eec698b420bd481dbbaced929d023437e8991482fa087184c1664b9c
7
- data.tar.gz: f2d32c23c141e7d440715550856876152153c47d1fb98954ef4451e1ad483b6b81939c8cb9e1c559c14332ca42b4a014f751ab169f50d3ab3908bc299154c780
6
+ metadata.gz: 883c2262141419d5f1e1270ef6a443bfce351c54fa1a893a477dc8dfd00ab0af1b75c7f8670e26a1a73a406723006a1ac23667a2ba9b652390eab5b46e5964d9
7
+ data.tar.gz: cdb1bd1461caf095f22407eab5de315d306dbdfb1f2cc2a733f811c92f5fdef475f1995264317e32ec8d775a019e46757b801426b8f4f7c160ff4eb9bbad799e
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- # Pagy initializer file (3.5.0)
4
+ # Pagy initializer file (3.5.1)
5
5
  # Customize only what you really need and notice that Pagy works also without any of the following lines.
6
6
  # Should you just cherry pick part of this file, please maintain the require-order of the extras
7
7
 
@@ -89,7 +89,7 @@
89
89
  # require 'pagy/extras/overflow'
90
90
  # Pagy::VARS[:overflow] = :empty_page # default (other options: :last_page and :exception)
91
91
 
92
- # Metadata extra: Provides the pagination metadata to Javascrtipt frameworks like Vue.js, react.js, etc.
92
+ # Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
93
93
  # See https://ddnexus.github.io/pagy/extras/metadata
94
94
  # you must require the shared internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
95
95
  # require 'pagy/extras/shared'
@@ -2,7 +2,7 @@
2
2
 
3
3
  function Pagy(){}
4
4
 
5
- Pagy.version = '3.5.0';
5
+ Pagy.version = '3.5.1';
6
6
 
7
7
  Pagy.init = function(arg){
8
8
  var target = arg instanceof Event || arg === undefined ? document : arg,
@@ -4,7 +4,7 @@
4
4
 
5
5
  require 'pathname'
6
6
 
7
- class Pagy ; VERSION = '3.5.0'
7
+ class Pagy ; VERSION = '3.5.1'
8
8
 
9
9
  # Root pathname to get the path of Pagy files like templates or dictionaries
10
10
  def self.root; @root ||= Pathname.new(__FILE__).dirname.freeze end
@@ -13,7 +13,8 @@ class Pagy
13
13
  def self.new_from_elasticsearch_rails(response, vars={})
14
14
  vars[:items] = response.search.options[:size] || 10
15
15
  vars[:page] = (response.search.options[:from] || 0) / vars[:items] + 1
16
- vars[:count] = response.raw_response['hits']['total']
16
+ total = response.raw_response['hits']['total']
17
+ vars[:count] = total.is_a?(Hash) ? total['value'] : total
17
18
  new(vars)
18
19
  end
19
20
 
@@ -27,7 +28,8 @@ class Pagy
27
28
  search_args[-1][:size] = vars[:items]
28
29
  search_args[-1][:from] = vars[:items] * (vars[:page] - 1)
29
30
  response = model.search(*search_args)
30
- vars[:count] = response.raw_response['hits']['total']
31
+ total = response.raw_response['hits']['total']
32
+ vars[:count] = total.is_a?(Hash) ? total['value'] : total
31
33
  pagy = Pagy.new(vars)
32
34
  # with :last_page overflow we need to re-run the method in order to get the hits
33
35
  if defined?(OVERFLOW) && pagy.overflow? && pagy.vars[:overflow] == :last_page
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: 3.5.0
4
+ version: 3.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: 2019-08-20 00:00:00.000000000 Z
11
+ date: 2019-08-31 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,