pagy 0.20.0 → 0.21.0
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 +4 -4
- data/lib/config/pagy.rb +5 -1
- data/lib/locales/plurals.rb +3 -2
- data/lib/pagy.rb +1 -1
- data/lib/pagy/extras/elasticsearch_rails.rb +18 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bfbf0d56b4b48272f392235024917f193e34bbb503dda18ed5a22cbe26a3f31
|
4
|
+
data.tar.gz: b69e31bebaef1fa2898419c69a83b98f2b017039201336a79bc64921e13d9e62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05dbed50a79d4d124fa0c4c1220033744bfd592afeb2a0954b3f0ce6bbae364366b7dfc183dbb1756ddb49980439739d477b52112cd43561b7abd53a7111686f
|
7
|
+
data.tar.gz: dc3b2a46c2d240507ca371b03fe71ea202d10e96aaece4e29a1570cae885842376eff49cd24dd6809653e98915b392c1b3dc2368906c32c6802d517dc8229c6c
|
data/lib/config/pagy.rb
CHANGED
@@ -12,7 +12,11 @@
|
|
12
12
|
# See https://ddnexus.github.io/pagy/extras/array
|
13
13
|
# require 'pagy/extras/array'
|
14
14
|
|
15
|
-
#
|
15
|
+
# Elasticsearch Rails: Paginate `ElasticsearchRails::Results` objects efficiently, avoiding expensive object-wrapping and without overriding.
|
16
|
+
# See https://ddnexus.github.io/pagy/extras/elasticsearch_rails
|
17
|
+
# require 'pagy/extras/elasticsearch_rails'
|
18
|
+
|
19
|
+
# Searchkick: Paginate `Searchkick::Results` objects efficiently, avoiding expensive object-wrapping and without overriding.
|
16
20
|
# See https://ddnexus.github.io/pagy/extras/searchkick
|
17
21
|
# require 'pagy/extras/searchkick'
|
18
22
|
|
data/lib/locales/plurals.rb
CHANGED
@@ -25,8 +25,9 @@ plurals = {
|
|
25
25
|
}
|
26
26
|
|
27
27
|
# Languages (language/plural pairs)
|
28
|
-
# Contain all the entries for all the languages defined in the
|
29
|
-
# The default plural for
|
28
|
+
# Contain all the entries for all the languages defined in the dictionaries.
|
29
|
+
# The default plural for languages not explicitly listed here
|
30
|
+
# is the :zero_one_other plural (used for English)
|
30
31
|
Hash.new(plurals[:zero_one_other]).tap do |languages|
|
31
32
|
languages['en'] = plurals[:zero_one_other]
|
32
33
|
languages['ru'] = plurals[:one_few_many_other]
|
data/lib/pagy.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/elasticsearch_rails
|
2
|
+
|
3
|
+
class Pagy
|
4
|
+
# Add specialized backend methods to paginate ElasticsearchRails::Results
|
5
|
+
module Backend ; private
|
6
|
+
# Return Pagy object and items
|
7
|
+
def pagy_elasticsearch_rails(results, vars={})
|
8
|
+
pagy = Pagy.new(pagy_elasticsearch_rails_get_vars(results, vars))
|
9
|
+
return pagy, results.offset(pagy.offset).limit(pagy.items)
|
10
|
+
end
|
11
|
+
|
12
|
+
def pagy_elasticsearch_rails_get_vars(results, vars)
|
13
|
+
# Return the merged variables to initialize the Pagy object
|
14
|
+
{ count: results.total,
|
15
|
+
page: (params[:page] || 1)}.merge!(vars)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
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: 0.
|
4
|
+
version: 0.21.0
|
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-10-
|
11
|
+
date: 2018-10-18 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,
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- lib/pagy/extras/array.rb
|
38
38
|
- lib/pagy/extras/bootstrap.rb
|
39
39
|
- lib/pagy/extras/bulma.rb
|
40
|
+
- lib/pagy/extras/elasticsearch_rails.rb
|
40
41
|
- lib/pagy/extras/foundation.rb
|
41
42
|
- lib/pagy/extras/i18n.rb
|
42
43
|
- lib/pagy/extras/items.rb
|