pagy 3.8.1 → 3.11.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/LICENSE.txt +1 -1
- data/lib/config/pagy.rb +1 -1
- data/lib/javascripts/pagy.js +1 -1
- data/lib/locales/cs.yml +22 -0
- data/lib/locales/pt.yml +22 -0
- data/lib/locales/sw.yml +22 -0
- data/lib/locales/utils/p11n.rb +9 -1
- data/lib/pagy.rb +1 -1
- data/lib/pagy/extras/navs.rb +1 -1
- data/lib/pagy/extras/support.rb +10 -2
- data/lib/pagy/frontend.rb +3 -2
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cadf66aafed63e69474727fab67e77da2038ad95e9a1430d5546da2b5f9d1a2
|
4
|
+
data.tar.gz: 6a716cef53d59459b3406e0e330d44536b8f5ec738d0661140d3fd805ef613ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 563e233579eab779aa3210751143c617369d3e0f34bd5365a7e50ed6bd07346b1aa052a3a2fec8b25b375dbc6d837836639915ab01160aff857938fbac515412
|
7
|
+
data.tar.gz: 02a8a1d45a18b5ea644e24c3fa50b6d4cdb48c3fd27fb135ece5fd981ea246da568759427f1daba2cf29705fe1dbcaf6e52f97f8cca84744fd285bee0cca4338
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017-
|
3
|
+
Copyright (c) 2017-2020 Domizio Demichelis
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
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
|
+
# Pagy initializer file (3.11.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
|
|
data/lib/javascripts/pagy.js
CHANGED
data/lib/locales/cs.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# :czech pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
|
2
|
+
|
3
|
+
cs:
|
4
|
+
pagy:
|
5
|
+
item_name:
|
6
|
+
one: "položka"
|
7
|
+
few: "položek"
|
8
|
+
other: "položky"
|
9
|
+
|
10
|
+
nav:
|
11
|
+
prev: "‹ Předchozí"
|
12
|
+
next: "Další ›"
|
13
|
+
gap: "…"
|
14
|
+
|
15
|
+
info:
|
16
|
+
no_items: "Nic nebylo nalezeno"
|
17
|
+
single_page: "Zobrazeno <b>%{count}</b> %{item_name}"
|
18
|
+
multiple_pages: "Zobrazeno %{item_name} <b>%{from}-%{to}</b> z <b>%{count}</b> celkem"
|
19
|
+
|
20
|
+
combo_nav_js: "Strana %{page_input} z %{pages}"
|
21
|
+
|
22
|
+
items_selector_js: "Zobrazit %{items_input} %{item_name} na stránce"
|
data/lib/locales/pt.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
|
2
|
+
|
3
|
+
pt:
|
4
|
+
pagy:
|
5
|
+
|
6
|
+
item_name:
|
7
|
+
one: "item"
|
8
|
+
other: "itens"
|
9
|
+
|
10
|
+
nav:
|
11
|
+
prev: "‹ Anterior"
|
12
|
+
next: "Próximo ›"
|
13
|
+
gap: "…"
|
14
|
+
|
15
|
+
info:
|
16
|
+
no_items: "Sem resultados"
|
17
|
+
single_page: "Mostrando %{count} %{item_name}"
|
18
|
+
multiple_pages: "Mostrando %{item_name} %{from}-%{to} de um total de %{count}"
|
19
|
+
|
20
|
+
combo_nav_js: "Página %{page_input} de %{pages}"
|
21
|
+
|
22
|
+
items_selector_js: "Mostrar %{items_input} %{item_name} por página"
|
data/lib/locales/sw.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# :one_other pluralization
|
2
|
+
|
3
|
+
sw:
|
4
|
+
pagy:
|
5
|
+
|
6
|
+
item_name:
|
7
|
+
one: "kifaa"
|
8
|
+
other: "vifaa"
|
9
|
+
|
10
|
+
nav:
|
11
|
+
prev: "‹ Awali"
|
12
|
+
next: "Ifuatayo ›"
|
13
|
+
gap: "…"
|
14
|
+
|
15
|
+
info:
|
16
|
+
no_items: "Hamna %{item_name} vilivyopatikana"
|
17
|
+
single_page: "Inaonyesha %{item_name} <b>%{count}</b>"
|
18
|
+
multiple_pages: "Inaonyesha %{item_name} <b>%{from}-%{to}</b> ya <b>%{count}</b> kwa jumla"
|
19
|
+
|
20
|
+
combo_nav_js: "Kurasa %{page_input} ya %{pages}"
|
21
|
+
|
22
|
+
items_selector_js: "Onyesha %{items_input} %{item_name} kwa kila ukurasa"
|
data/lib/locales/utils/p11n.rb
CHANGED
@@ -32,6 +32,13 @@ p11n = {
|
|
32
32
|
end
|
33
33
|
end,
|
34
34
|
|
35
|
+
west_slavic: lambda do |n|
|
36
|
+
if n == 1 ; 'one'
|
37
|
+
elsif [2, 3, 4].include?(n) ; 'few'
|
38
|
+
else ; 'other'
|
39
|
+
end
|
40
|
+
end,
|
41
|
+
|
35
42
|
one_two_other: lambda do |n|
|
36
43
|
if n == 1 ; 'one'
|
37
44
|
elsif n == 2 ; 'two'
|
@@ -60,9 +67,11 @@ p11n = {
|
|
60
67
|
# The default pluralization for locales not explicitly listed here
|
61
68
|
# is the :one_other pluralization proc (used for English)
|
62
69
|
plurals = Hash.new(p11n[:one_other]).tap do |hash|
|
70
|
+
hash['cs'] = p11n[:west_slavic]
|
63
71
|
hash['id'] = p11n[:other]
|
64
72
|
hash['fr'] = p11n[:one_upto_two_other]
|
65
73
|
hash['ja'] = p11n[:other]
|
74
|
+
hash['km'] = p11n[:other]
|
66
75
|
hash['ko'] = p11n[:other]
|
67
76
|
hash['pl'] = p11n[:polish]
|
68
77
|
hash['ru'] = p11n[:east_slavic]
|
@@ -72,7 +81,6 @@ plurals = Hash.new(p11n[:one_other]).tap do |hash|
|
|
72
81
|
hash['zh-CN'] = p11n[:other]
|
73
82
|
hash['zh-HK'] = p11n[:other]
|
74
83
|
hash['zh-TW'] = p11n[:other]
|
75
|
-
hash['km'] = p11n[:other]
|
76
84
|
end
|
77
85
|
|
78
86
|
[ plurals, p11n ]
|
data/lib/pagy.rb
CHANGED
data/lib/pagy/extras/navs.rb
CHANGED
@@ -24,7 +24,7 @@ class Pagy
|
|
24
24
|
def pagy_combo_nav_js(pagy, id=pagy_id)
|
25
25
|
link, p_prev, p_next, p_page, p_pages = pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.page, pagy.pages
|
26
26
|
|
27
|
-
html = EMPTY + %(<nav id="#{id}" class="pagy-combo-nav-js
|
27
|
+
html = EMPTY + %(<nav id="#{id}" class="pagy-combo-nav-js pagination" role="navigation" aria-label="pager">)
|
28
28
|
html << (p_prev ? %(<span class="page prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</span> )
|
29
29
|
: %(<span class="page prev disabled">#{pagy_t('pagy.nav.prev')}</span> ))
|
30
30
|
input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 0; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
|
data/lib/pagy/extras/support.rb
CHANGED
@@ -15,15 +15,23 @@ class Pagy
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def pagy_prev_link(pagy, text = pagy_t('pagy.nav.prev'), link_extra = '')
|
18
|
-
pagy.prev ? %(<span class="page prev"><a href="#{
|
18
|
+
pagy.prev ? %(<span class="page prev"><a href="#{pagy_url_for(pagy.prev, pagy)}" rel="prev" aria-label="previous" #{pagy.vars[:link_extra]} #{link_extra}>#{text}</a></span>)
|
19
19
|
: %(<span class="page prev disabled">#{text}</span>)
|
20
20
|
end
|
21
21
|
|
22
22
|
def pagy_next_link(pagy, text = pagy_t('pagy.nav.next'), link_extra = '')
|
23
|
-
pagy.next ? %(<span class="page next"><a href="#{
|
23
|
+
pagy.next ? %(<span class="page next"><a href="#{pagy_url_for(pagy.next, pagy)}" rel="next" aria-label="next" #{pagy.vars[:link_extra]} #{link_extra}>#{text}</a></span>)
|
24
24
|
: %(<span class="page next disabled">#{text}</span>)
|
25
25
|
end
|
26
26
|
|
27
|
+
def pagy_prev_link_tag(pagy)
|
28
|
+
%(<link href="#{pagy_url_for(pagy.prev, pagy)}" rel="prev"/>) if pagy.prev
|
29
|
+
end
|
30
|
+
|
31
|
+
def pagy_next_link_tag(pagy)
|
32
|
+
%(<link href="#{pagy_url_for(pagy.next, pagy)}" rel="next"/>) if pagy.next
|
33
|
+
end
|
34
|
+
|
27
35
|
end
|
28
36
|
|
29
37
|
end
|
data/lib/pagy/frontend.rb
CHANGED
@@ -50,11 +50,11 @@ class Pagy
|
|
50
50
|
end
|
51
51
|
|
52
52
|
# Return examples: "Displaying items 41-60 of 324 in total" of "Displaying Products 41-60 of 324 in total"
|
53
|
-
def pagy_info(pagy)
|
53
|
+
def pagy_info(pagy, item_name=nil)
|
54
54
|
path = if (count = pagy.count) == 0 ; 'pagy.info.no_items'
|
55
55
|
else pagy.pages == 1 ? 'pagy.info.single_page' : 'pagy.info.multiple_pages'
|
56
56
|
end
|
57
|
-
pagy_t(path, item_name: pagy_t(pagy.vars[:i18n_key], count: count), count: count, from: pagy.from, to: pagy.to)
|
57
|
+
pagy_t(path, item_name: item_name || pagy_t(pagy.vars[:i18n_key], count: count), count: count, from: pagy.from, to: pagy.to)
|
58
58
|
end
|
59
59
|
|
60
60
|
# Returns a performance optimized proc to generate the HTML links
|
@@ -68,6 +68,7 @@ class Pagy
|
|
68
68
|
end
|
69
69
|
|
70
70
|
# Similar to I18n.t: just ~18x faster using ~10x less memory
|
71
|
+
# (@pagy_locale explicitly initilized in order to avoid warning)
|
71
72
|
def pagy_t(path, vars={}) Pagy::I18n.t(@pagy_locale||=nil, path, vars) end
|
72
73
|
|
73
74
|
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
|
+
version: 3.11.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:
|
11
|
+
date: 2021-02-14 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,
|
@@ -25,6 +25,7 @@ files:
|
|
25
25
|
- lib/locales/README.md
|
26
26
|
- lib/locales/bg.yml
|
27
27
|
- lib/locales/ca.yml
|
28
|
+
- lib/locales/cs.yml
|
28
29
|
- lib/locales/da.yml
|
29
30
|
- lib/locales/de.yml
|
30
31
|
- lib/locales/en.yml
|
@@ -39,9 +40,11 @@ files:
|
|
39
40
|
- lib/locales/nl.yml
|
40
41
|
- lib/locales/pl.yml
|
41
42
|
- lib/locales/pt-BR.yml
|
43
|
+
- lib/locales/pt.yml
|
42
44
|
- lib/locales/ru.yml
|
43
45
|
- lib/locales/sv-SE.yml
|
44
46
|
- lib/locales/sv.yml
|
47
|
+
- lib/locales/sw.yml
|
45
48
|
- lib/locales/tr.yml
|
46
49
|
- lib/locales/utils/i18n.rb
|
47
50
|
- lib/locales/utils/loader.rb
|