pagy 3.4.1 → 3.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6623351e17c1612e6a27f72491dc2dc3402550295f1d58b41f222de35195577a
4
- data.tar.gz: 51127de303671a68cc3c219f4fa4423ae461a5281eca74e4aec71fa78aa53d3e
3
+ metadata.gz: a1cd0c46c7653c9ca234cdc26c4582ba9aed45de1e9041aad2fd5f7bf19c6b0f
4
+ data.tar.gz: 4c8527dd62f9a5f6e32e660a78df65e92ab72a26c97e148149927eea0043b8fb
5
5
  SHA512:
6
- metadata.gz: 8385841d14b773eba91ee9bff068765698fa6b09736dc1dfdbfbd5bb8b6c022db58d495c8e0d7fc423ca5837f2543f9672c2594a7d8f271eb0fa4bbcfa6400aa
7
- data.tar.gz: 7889d3d82b6928ed58c4a095e540d5c227619a0ab102eff77afb0ac93f481af25fe5513cba0d1cd54beda7a23cceb97ab83a17792f9610800edb53605cda7c70
6
+ metadata.gz: 450fb7112761bee9bcceb85dfcdd38c03e7914e29c8ea7f6816e8bebbbd7c742a39f77e9eec698b420bd481dbbaced929d023437e8991482fa087184c1664b9c
7
+ data.tar.gz: f2d32c23c141e7d440715550856876152153c47d1fb98954ef4451e1ad483b6b81939c8cb9e1c559c14332ca42b4a014f751ab169f50d3ab3908bc299154c780
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.4.1)
4
+ # Pagy initializer file (3.5.0)
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,6 +89,14 @@
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.
93
+ # See https://ddnexus.github.io/pagy/extras/metadata
94
+ # you must require the shared internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
95
+ # require 'pagy/extras/shared'
96
+ # require 'pagy/extras/metadata'
97
+ # For performance reason, you should explicitly set ONLY the metadata you use in the frontend
98
+ # Pagy::VARS[:metadata] = [:scaffold_url, :count, :page, :prev, :next, :last] # example
99
+
92
100
  # Trim extra: Remove the page=1 param from links
93
101
  # See https://ddnexus.github.io/pagy/extras/trim
94
102
  # require 'pagy/extras/trim'
@@ -2,7 +2,7 @@
2
2
 
3
3
  function Pagy(){}
4
4
 
5
- Pagy.version = '3.4.1';
5
+ Pagy.version = '3.5.0';
6
6
 
7
7
  Pagy.init = function(arg){
8
8
  var target = arg instanceof Event || arg === undefined ? document : arg,
@@ -0,0 +1,22 @@
1
+ # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
+
3
+ ca:
4
+ pagy:
5
+
6
+ item_name:
7
+ one: "element"
8
+ other: "elements"
9
+
10
+ nav:
11
+ prev: "‹ Anterior"
12
+ next: "Següent ›"
13
+ gap: "…"
14
+
15
+ info:
16
+ no_items: "No s'ha trobat cap resultat"
17
+ single_page: "Mostrant <b>%{count}</b> %{item_name}"
18
+ multiple_pages: "Mostrant %{item_name} <b>%{from}-%{to}</b> de <b>%{count}</b> en total"
19
+
20
+ combo_nav_js: "Pàgina %{page_input} de %{pages}"
21
+
22
+ items_selector_js: "Mostra %{items_input} %{item_name} per pàgina"
@@ -0,0 +1,20 @@
1
+ # :other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
+
3
+ ko:
4
+ pagy:
5
+
6
+ item_name: "항목"
7
+
8
+ nav:
9
+ prev: "&lsaquo;&nbsp;이전"
10
+ next: "이후&nbsp;&rsaquo;"
11
+ gap: "&hellip;"
12
+
13
+ info:
14
+ no_items: "%{item_name} 없음"
15
+ single_page: "<b>%{count}</b>개의 %{item_name} 표시됨"
16
+ multiple_pages: "총 <b>%{count}</b>개의 %{item_name} 중 <b>%{from}-%{to}</b>"
17
+
18
+ combo_nav_js: "총 %{pages} 중 %{page_input} 페이지"
19
+
20
+ items_selector_js: "페이지 당 %{items_input}개 표시%"
@@ -63,6 +63,7 @@ plurals = Hash.new(p11n[:one_other]).tap do |hash|
63
63
  hash['id'] = p11n[:other]
64
64
  hash['fr'] = p11n[:one_upto_two_other]
65
65
  hash['ja'] = p11n[:other]
66
+ hash['ko'] = p11n[:other]
66
67
  hash['pl'] = p11n[:polish]
67
68
  hash['ru'] = p11n[:east_slavic]
68
69
  hash['se'] = p11n[:one_two_other]
data/lib/pagy.rb CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  require 'pathname'
6
6
 
7
- class Pagy ; VERSION = '3.4.1'
7
+ class Pagy ; VERSION = '3.5.0'
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
@@ -0,0 +1,37 @@
1
+ # See the Pagy documentation: https://ddnexus.github.io/pagy/extras/metadata
2
+ # encoding: utf-8
3
+ # frozen_string_literal: true
4
+
5
+ class Pagy
6
+ # Add a specialized backend method for pagination metadata
7
+ module Backend ; private
8
+
9
+ METADATA = [ :scaffold_url, :first_url, :prev_url, :page_url, :next_url, :last_url,
10
+ :count, :page, :items, :vars, :pages, :last, :from, :to, :prev, :next, :series ]
11
+ METADATA << :sequels if VARS.key?(:steps) # :steps gets defined along with the #sequels method
12
+
13
+ VARS[:metadata] = METADATA.dup
14
+
15
+ include Helpers
16
+
17
+ def pagy_metadata(pagy, url=false)
18
+ names = pagy.vars[:metadata]
19
+ (unknown = names - METADATA).empty? or raise(VariableError.new(pagy), "unknown metadata #{unknown.inspect}")
20
+ scaffold_url = pagy_url_for(Frontend::MARK, pagy, url)
21
+ metadata = {}
22
+ names.each do |key|
23
+ metadata[key] = case key
24
+ when :scaffold_url ; scaffold_url
25
+ when :first_url ; scaffold_url.sub(Frontend::MARK, 1.to_s)
26
+ when :prev_url ; scaffold_url.sub(Frontend::MARK, pagy.prev.to_s)
27
+ when :page_url ; scaffold_url.sub(Frontend::MARK, pagy.page.to_s)
28
+ when :next_url ; scaffold_url.sub(Frontend::MARK, pagy.next.to_s)
29
+ when :last_url ; scaffold_url.sub(Frontend::MARK, pagy.last.to_s)
30
+ else pagy.send(key)
31
+ end
32
+ end
33
+ metadata
34
+ end
35
+
36
+ end
37
+ 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: 3.4.1
4
+ version: 3.5.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: 2019-07-23 00:00:00.000000000 Z
11
+ date: 2019-08-20 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,
@@ -24,12 +24,14 @@ files:
24
24
  - lib/javascripts/pagy.js
25
25
  - lib/locales/README.md
26
26
  - lib/locales/bg.yml
27
+ - lib/locales/ca.yml
27
28
  - lib/locales/de.yml
28
29
  - lib/locales/en.yml
29
30
  - lib/locales/es.yml
30
31
  - lib/locales/fr.yml
31
32
  - lib/locales/id.yml
32
33
  - lib/locales/ja.yml
34
+ - lib/locales/ko.yml
33
35
  - lib/locales/nb.yml
34
36
  - lib/locales/nl.yml
35
37
  - lib/locales/pl.yml
@@ -57,6 +59,7 @@ files:
57
59
  - lib/pagy/extras/i18n.rb
58
60
  - lib/pagy/extras/items.rb
59
61
  - lib/pagy/extras/materialize.rb
62
+ - lib/pagy/extras/metadata.rb
60
63
  - lib/pagy/extras/navs.rb
61
64
  - lib/pagy/extras/overflow.rb
62
65
  - lib/pagy/extras/pagy_search.rb