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 +4 -4
- data/lib/config/pagy.rb +2 -2
- data/lib/javascripts/pagy.js +1 -1
- data/lib/pagy.rb +1 -1
- data/lib/pagy/extras/elasticsearch_rails.rb +4 -2
- 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: 5d5bc9d035a9a4d9f5f807a6e95cdad150a705ab17df7fc964ea3103614a7a7d
|
4
|
+
data.tar.gz: 6cee7bf4ccb841d55b1d38619f4cac613f765f8040fbe2162e2cf1ec99e84655
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 883c2262141419d5f1e1270ef6a443bfce351c54fa1a893a477dc8dfd00ab0af1b75c7f8670e26a1a73a406723006a1ac23667a2ba9b652390eab5b46e5964d9
|
7
|
+
data.tar.gz: cdb1bd1461caf095f22407eab5de315d306dbdfb1f2cc2a733f811c92f5fdef475f1995264317e32ec8d775a019e46757b801426b8f4f7c160ff4eb9bbad799e
|
data/lib/config/pagy.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
# Pagy initializer file (3.5.
|
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
|
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'
|
data/lib/javascripts/pagy.js
CHANGED
data/lib/pagy.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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.
|
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-
|
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,
|