pagy 0.19.4 → 0.20.0
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 +3 -2
- data/lib/locales/en.yml +20 -0
- data/lib/locales/es.yml +20 -0
- data/lib/locales/id.yml +20 -0
- data/lib/locales/ja.yml +20 -0
- data/lib/locales/plurals.rb +17 -5
- data/lib/locales/pt-br.yml +20 -0
- data/lib/locales/ru.yml +25 -0
- data/lib/locales/tr.yml +20 -0
- data/lib/locales/zh-cn.yml +20 -0
- data/lib/pagy.rb +1 -1
- data/lib/pagy/extras/bootstrap.rb +1 -1
- data/lib/pagy/extras/bulma.rb +2 -2
- data/lib/pagy/extras/foundation.rb +8 -8
- data/lib/pagy/extras/i18n.rb +1 -1
- data/lib/pagy/extras/items.rb +1 -1
- data/lib/pagy/extras/materialize.rb +1 -1
- data/lib/pagy/extras/navs.rb +1 -1
- data/lib/pagy/extras/semantic.rb +2 -2
- data/lib/pagy/frontend.rb +1 -1
- data/lib/templates/nav_foundation.html.erb +2 -2
- data/lib/templates/nav_foundation.html.haml +2 -5
- data/lib/templates/nav_foundation.html.slim +1 -4
- metadata +10 -3
- data/lib/locales/pagy.yml +0 -188
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 575c195847961ea0480d52ab96a6a1cff02684261069c254979437596d443244
|
4
|
+
data.tar.gz: 52a796fa7f8c7323a5445082f24d0ebbd77ee7931870af203836ee3fe686ab36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f907980d15f3056b660ee7acf17fa2f414ad2b1e2b0eca4538aa1c79103ffe052a7b0fa47a31e11258f68f3d74d0042768bb19683edec6e273832cea2c5bf733
|
7
|
+
data.tar.gz: 444b734960e91e64fc1d115a71e50a2d729fd93f1c99da97cd6c8e364d0bfcae26bc1dd5f24b9d7c44e2aee0b19d21a0b39f3e18f7cc48554b0853f87ef9f3b1
|
data/lib/config/pagy.rb
CHANGED
@@ -101,8 +101,9 @@
|
|
101
101
|
# I18n: faster internal pagy implementation (does not use the I18n gem)
|
102
102
|
# Use only for single language apps that don't need dynamic translation between multiple languages
|
103
103
|
# See https://ddnexus.github.io/pagy/api/frontend#i18n
|
104
|
-
# Notice: Do not use the following
|
105
|
-
# Pagy::Frontend::I18N.load(file:'
|
104
|
+
# Notice: Do not use any of the following lines if you use the i18n extra below
|
105
|
+
# Pagy::Frontend::I18N.load(file: Pagy.root.join('locale', 'es.yml'), language:'es') # load 'es' pagy language file
|
106
|
+
# Pagy::Frontend::I18N.load(file:'path/to/dictionary.yml', language:'en') # load a custom 'en' file
|
106
107
|
# Pagy::Frontend::I18N[:plural] = -> (count) {(['zero', 'one'][count] || 'other')} # default
|
107
108
|
|
108
109
|
# I18n: Use the `I18n` gem instead of the pagy implementation
|
data/lib/locales/en.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
en:
|
2
|
+
pagy:
|
3
|
+
nav:
|
4
|
+
prev: "‹ Prev"
|
5
|
+
next: "Next ›"
|
6
|
+
gap: "…"
|
7
|
+
info:
|
8
|
+
single_page:
|
9
|
+
zero: "No %{item_name} found"
|
10
|
+
one: "Displaying <b>1</b> %{item_name}"
|
11
|
+
other: "Displaying <b>all %{count}</b> %{item_name}"
|
12
|
+
multiple_pages: "Displaying %{item_name} <b>%{from}-%{to}</b> of <b>%{count}</b> in total"
|
13
|
+
item_name:
|
14
|
+
zero: "items"
|
15
|
+
one: "item"
|
16
|
+
other: "items"
|
17
|
+
compact: "Page %{page_input} of %{pages}"
|
18
|
+
items:
|
19
|
+
one: "Show %{items_input} item per page"
|
20
|
+
other: "Show %{items_input} items per page"
|
data/lib/locales/es.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
es:
|
2
|
+
pagy:
|
3
|
+
nav:
|
4
|
+
prev: "‹ Prev"
|
5
|
+
next: "Siguiente ›"
|
6
|
+
gap: "…"
|
7
|
+
info:
|
8
|
+
single_page:
|
9
|
+
zero: "Sin resultados"
|
10
|
+
one: "Mostrando 1 %{item_name}"
|
11
|
+
other: "Mostrando %{count} %{item_name}"
|
12
|
+
multiple_pages: "Mostrando %{item_name} %{from}-%{to} de %{count} en total"
|
13
|
+
item_name:
|
14
|
+
zero: "ítems"
|
15
|
+
one: "ítem"
|
16
|
+
other: "ítems"
|
17
|
+
compact: "Página %{page_input} de %{pages}"
|
18
|
+
items:
|
19
|
+
one: "Mostrar %{items_input} ítem por página"
|
20
|
+
other: "Mostrar %{items_input} ítems por página"
|
data/lib/locales/id.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
id:
|
2
|
+
pagy:
|
3
|
+
nav:
|
4
|
+
prev: "‹ Balik"
|
5
|
+
next: "Lanjut ›"
|
6
|
+
gap: "…"
|
7
|
+
info:
|
8
|
+
single_page:
|
9
|
+
zero: "Tidak ditemukan %{item_name}"
|
10
|
+
one: "Menampilkan <b>1</b> %{item_name}"
|
11
|
+
other: "Menampilkan <b>semua %{count}</b> %{item_name}"
|
12
|
+
multiple_pages: "Menampilkan %{item_name} <b>%{from}-%{to}</b> dari total <b>%{count}</b>"
|
13
|
+
item_name:
|
14
|
+
zero: "item"
|
15
|
+
one: "item"
|
16
|
+
other: "item"
|
17
|
+
compact: "Halaman %{page_input} dari %{pages}"
|
18
|
+
items:
|
19
|
+
one: "Tampilkan %{items_input} item per halaman"
|
20
|
+
other: "Tampilkan %{items_input} item per halaman"
|
data/lib/locales/ja.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
ja:
|
2
|
+
pagy:
|
3
|
+
nav:
|
4
|
+
prev: "‹ 前へ"
|
5
|
+
next: "次へ ›"
|
6
|
+
gap: "…"
|
7
|
+
info:
|
8
|
+
single_page:
|
9
|
+
zero: "見つかりませんでした"
|
10
|
+
one: "<b>1</b> 件の%{item_name}"
|
11
|
+
other: "<b>%{count}</b> 件の%{item_name}"
|
12
|
+
multiple_pages: "<b>%{count}</b> 件中 <b>%{from}-%{to}</b> 件目の%{item_name}を表示中"
|
13
|
+
item_name:
|
14
|
+
zero: "結果"
|
15
|
+
one: "結果"
|
16
|
+
other: "結果"
|
17
|
+
compact: "%{page_input} / %{pages} ページ"
|
18
|
+
items:
|
19
|
+
one: "%{items_input} 件ずつ表示"
|
20
|
+
other: "%{items_input} 件ずつ表示"
|
data/lib/locales/plurals.rb
CHANGED
@@ -3,13 +3,25 @@
|
|
3
3
|
# frozen_string_literal: true
|
4
4
|
|
5
5
|
# utility variables
|
6
|
-
zero_one
|
6
|
+
zero_one = ['zero', 'one']
|
7
|
+
from2to4 = (2..4)
|
8
|
+
from5to9 = (5..9)
|
9
|
+
from11to14 = (11..14)
|
10
|
+
from12to14 = (12..14)
|
7
11
|
|
8
12
|
# Plurals
|
9
13
|
# A plural proc returns a plural type string based on the passed count
|
10
14
|
# Each plural proc may apply to one or more languages below
|
11
15
|
plurals = {
|
12
|
-
zero_one_other:
|
16
|
+
zero_one_other: -> (count) {zero_one[count] || 'other'},
|
17
|
+
one_few_many_other: -> (count) do
|
18
|
+
mod10, mod100 = count % 10, count % 100
|
19
|
+
if mod10 == 1 && mod100 != 11 ; 'one'
|
20
|
+
elsif from2to4.cover?(mod10) && !from12to14.cover?(mod100) ; 'few'
|
21
|
+
elsif mod10 == 0 || from5to9.cover?(mod10) || from11to14.cover?(mod100) ; 'many'
|
22
|
+
else 'other'
|
23
|
+
end
|
24
|
+
end
|
13
25
|
}
|
14
26
|
|
15
27
|
# Languages (language/plural pairs)
|
@@ -17,7 +29,7 @@ plurals = {
|
|
17
29
|
# The default plural for missing languages is the :zero_one_other plural (used for English)
|
18
30
|
Hash.new(plurals[:zero_one_other]).tap do |languages|
|
19
31
|
languages['en'] = plurals[:zero_one_other]
|
20
|
-
|
21
|
-
# PR for other languages and plurals are very welcome. Thanks!
|
22
|
-
|
32
|
+
languages['ru'] = plurals[:one_few_many_other]
|
23
33
|
end
|
34
|
+
|
35
|
+
# PR for other languages and plurals are very welcome. Thanks!
|
@@ -0,0 +1,20 @@
|
|
1
|
+
pt-br:
|
2
|
+
pagy:
|
3
|
+
nav:
|
4
|
+
prev: "‹ Anterior"
|
5
|
+
next: "Próximo ›"
|
6
|
+
gap: "…"
|
7
|
+
info:
|
8
|
+
single_page:
|
9
|
+
zero: "Sem resultados"
|
10
|
+
one: "Mostrando 1 %{item_name}"
|
11
|
+
other: "Mostrando %{count} %{item_name}"
|
12
|
+
multiple_pages: "Mostrando %{item_name} %{from}-%{to} no total de %{count}"
|
13
|
+
item_name:
|
14
|
+
zero: "itens"
|
15
|
+
one: "item"
|
16
|
+
other: "itens"
|
17
|
+
compact: "Página %{page_input} de %{pages}"
|
18
|
+
items:
|
19
|
+
one: "Mostrar %{items_input} iten por página"
|
20
|
+
other: "Mostrar %{items_input} itens por página"
|
data/lib/locales/ru.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
ru:
|
2
|
+
pagy:
|
3
|
+
nav:
|
4
|
+
prev: "‹ Назад"
|
5
|
+
next: "Вперёд ›"
|
6
|
+
gap: "…"
|
7
|
+
info:
|
8
|
+
single_page:
|
9
|
+
zero: "Пока %{item_name} нет"
|
10
|
+
one: "<b>1</b> %{item_name}"
|
11
|
+
few: "<b>%{count}</b> %{item_name}"
|
12
|
+
many: "Всего <b>%{count}</b> %{item_name}"
|
13
|
+
other: "Всего <b>%{count}</b> %{item_name}"
|
14
|
+
multiple_pages: "Всего <b>%{count}</b> %{item_name}, показаны с <b>%{from}</b> по <b>%{to}</b>"
|
15
|
+
item_name:
|
16
|
+
one: "запись"
|
17
|
+
few: "записи"
|
18
|
+
many: "записей"
|
19
|
+
other: "записей"
|
20
|
+
compact: "Страница %{page_input} из %{pages}"
|
21
|
+
items:
|
22
|
+
one: "Показать %{items_input} записей на странице"
|
23
|
+
few: "Показать %{items_input} записей на странице"
|
24
|
+
many: "Показать %{items_input} записей на странице"
|
25
|
+
other: "Показать %{items_input} записей на странице"
|
data/lib/locales/tr.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
tr:
|
2
|
+
pagy:
|
3
|
+
nav:
|
4
|
+
prev: "‹ Önceki"
|
5
|
+
next: "Sonraki ›"
|
6
|
+
gap: "…"
|
7
|
+
info:
|
8
|
+
single_page:
|
9
|
+
zero: "Hiç %{item_name} bulunamadı."
|
10
|
+
one: "<b>1</b> %{item_name} gösteriliyor."
|
11
|
+
other: "Toplam <b>%{count}</b> %{item_name} gösteriliyor."
|
12
|
+
multiple_pages: "<b>%{count}</b> %{item_name} içerisinden <b>%{from}-%{to}</b> kadarı gösteriliyor."
|
13
|
+
item_name:
|
14
|
+
zero: "kayıt"
|
15
|
+
one: "kayıt"
|
16
|
+
other: "kayıt"
|
17
|
+
compact: "Sayfa %{page_input} / %{pages}"
|
18
|
+
items:
|
19
|
+
one: "Sayfada %{items_input} kayıt göster"
|
20
|
+
other: "Sayfada %{items_input} kayıt göster"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
zh-cn:
|
2
|
+
pagy:
|
3
|
+
nav:
|
4
|
+
prev: "‹ 上一页"
|
5
|
+
next: "下一页 ›"
|
6
|
+
gap: "…"
|
7
|
+
info:
|
8
|
+
single_page:
|
9
|
+
zero: "%{item_name}未找到"
|
10
|
+
one: "显示 <b>1</b> 项%{item_name}"
|
11
|
+
other: "显示<b>所有 %{count}</b> 项%{item_name}"
|
12
|
+
multiple_pages: "共 <b>%{count}</b> 项%{item_name},显示 <b>%{from}-%{to}</b>"
|
13
|
+
item_name:
|
14
|
+
zero: "项目"
|
15
|
+
one: ""
|
16
|
+
other: ""
|
17
|
+
compact: "第 %{page_input} / %{pages} 页"
|
18
|
+
items:
|
19
|
+
one: "每页显示 %{items_input} 条"
|
20
|
+
other: "每页显示 %{items_input} 条"
|
data/lib/pagy.rb
CHANGED
@@ -35,7 +35,7 @@ class Pagy
|
|
35
35
|
html << (p_prev ? link.call(p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous" class="prev btn btn-primary"')
|
36
36
|
: %(<a class="prev btn btn-primary disabled" href="#">#{pagy_t('pagy.nav.prev')}</a>))
|
37
37
|
input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" class="text-primary" style="padding: 0; border: none; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
|
38
|
-
html << %(<div class="pagy-compact-input btn btn-primary disabled">#{pagy_t('pagy.compact
|
38
|
+
html << %(<div class="pagy-compact-input btn btn-primary disabled">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</div>)
|
39
39
|
html << (p_next ? link.call(p_next, pagy_t('pagy.nav.next'), 'aria-label="next" class="next btn btn-primary"')
|
40
40
|
: %(<a class="next btn btn-primary disabled" href="#">#{pagy_t('pagy.nav.next')}</a>))
|
41
41
|
html << %(</div></nav><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
|
data/lib/pagy/extras/bulma.rb
CHANGED
@@ -36,8 +36,8 @@ class Pagy
|
|
36
36
|
html << %(<div class="field is-grouped is-grouped-centered" role="group">)
|
37
37
|
html << (p_prev ? %(<p class="control">#{link.call(p_prev, pagy_t('pagy.nav.prev'), 'class="button" aria-label="previous page"')}</p>)
|
38
38
|
: %(<p class="control"><a class="button" disabled>#{pagy_t('pagy.nav.prev')}</a></p>))
|
39
|
-
input = %(<input class="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;">)
|
40
|
-
html << %(<div class="pagy-compact-input control level is-mobile">#{pagy_t('pagy.compact
|
39
|
+
input = %(<input class="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; margin:0 0.3rem;">)
|
40
|
+
html << %(<div class="pagy-compact-input control level is-mobile">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</div>)
|
41
41
|
html << (p_next ? %(<p class="control">#{link.call(p_next, pagy_t('pagy.nav.next'), 'class="button" aria-label="next page"')}</p>)
|
42
42
|
: %(<p class="control"><a class="button" disabled>#{pagy_t('pagy.nav.next')}</a></p>))
|
43
43
|
html << %(</div></nav><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
|
@@ -13,9 +13,9 @@ class Pagy
|
|
13
13
|
html << (p_prev ? %(<li class="prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</li>)
|
14
14
|
: %(<li class="prev disabled">#{pagy_t('pagy.nav.prev')}</li>))
|
15
15
|
pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
16
|
-
html << if item.is_a?(Integer); %(<li>#{link.call item}</li>)
|
17
|
-
elsif item.is_a?(String) ; %(<li class="current"
|
18
|
-
elsif item == :gap ; %(<li class="ellipsis" aria-hidden="true"></li>)
|
16
|
+
html << if item.is_a?(Integer); %(<li>#{link.call item}</li>) # page link
|
17
|
+
elsif item.is_a?(String) ; %(<li class="current">#{item}</li>) # active page
|
18
|
+
elsif item == :gap ; %(<li class="ellipsis gap" aria-hidden="true"></li>) # page gap
|
19
19
|
end
|
20
20
|
end
|
21
21
|
html << (p_next ? %(<li class="next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</li>)
|
@@ -34,8 +34,8 @@ class Pagy
|
|
34
34
|
html << %(<div class="input-group">)
|
35
35
|
html << (p_prev ? link.call(p_prev, pagy_t('pagy.nav.prev'), 'style="margin-bottom: 0px;" aria-label="previous" class="prev button primary"')
|
36
36
|
: %(<a style="margin-bottom: 0px;" class="prev button primary disabled" href="#">#{pagy_t('pagy.nav.prev')}</a>))
|
37
|
-
input = %(<input class="input-group-field cell shrink" type="number" min="1" max="#{p_pages}" value="#{p_page}" style="width: #{p_pages.to_s.length+1
|
38
|
-
html << %(<span class="input-group-label">#{pagy_t('pagy.compact
|
37
|
+
input = %(<input class="input-group-field cell shrink" type="number" min="1" max="#{p_pages}" value="#{p_page}" style="width: #{p_pages.to_s.length+1}rem; padding: 0 0.3rem; margin: 0 0.3rem;">)
|
38
|
+
html << %(<span class="input-group-label">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</span>)
|
39
39
|
html << (p_next ? link.call(p_next, pagy_t('pagy.nav.next'), 'style="margin-bottom: 0px;" aria-label="next" class="next button primary"')
|
40
40
|
: %(<a style="margin-bottom: 0px;" class="next button primary disabled" href="#">#{pagy_t('pagy.nav.next')}</a>))
|
41
41
|
html << %(</div></nav><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
|
@@ -50,9 +50,9 @@ class Pagy
|
|
50
50
|
tags['before'] << (p_prev ? %(<li class="prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</li>)
|
51
51
|
: %(<li class="prev disabled">#{pagy_t('pagy.nav.prev')}</li>))
|
52
52
|
responsive[:items].each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
53
|
-
tags[item.to_s] = if item.is_a?(Integer); %(<li>#{link.call item}</li>)
|
54
|
-
elsif item.is_a?(String) ; %(<li class="current"
|
55
|
-
elsif item == :gap ; %(<li class="gap
|
53
|
+
tags[item.to_s] = if item.is_a?(Integer); %(<li>#{link.call item}</li>) # page link
|
54
|
+
elsif item.is_a?(String) ; %(<li class="current">#{item}</li>) # active page
|
55
|
+
elsif item == :gap ; %(<li class="ellipsis gap" aria-hidden="true"></li>) # page gap
|
56
56
|
end
|
57
57
|
end
|
58
58
|
tags['after'] = +(p_next ? %(<li class="next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</li>)
|
data/lib/pagy/extras/i18n.rb
CHANGED
data/lib/pagy/extras/items.rb
CHANGED
@@ -36,7 +36,7 @@ class Pagy
|
|
36
36
|
html = +%(<span id="pagy-items-#{id}">)
|
37
37
|
html << %(<a href="#{pagy_url_for("#{MARKER}-page-", pagy)}"></a>)
|
38
38
|
input = %(<input type="number" min="1" max="#{p_vars[:max_items]}" value="#{p_items}" style="padding: 0; text-align: center; width: #{p_items.to_s.length+1}rem;">)
|
39
|
-
html << %(#{pagy_t('pagy.items
|
39
|
+
html << %(#{pagy_t('pagy.items', items_input: input, count: p_items)})
|
40
40
|
html << %(</span><script type="application/json" class="pagy-items-json">["#{id}", "#{MARKER}", #{pagy.from}]</script>)
|
41
41
|
end
|
42
42
|
|
@@ -36,7 +36,7 @@ class Pagy
|
|
36
36
|
html << (p_prev ? %(<li class="waves-effect prev" #{li_style}>#{link.call p_prev, '<i class="material-icons">chevron_left</i>', 'aria-label="previous"'}</li>)
|
37
37
|
: %(<li class="prev disabled" #{li_style}><a href="#"><i class="material-icons">chevron_left</i></a></li>))
|
38
38
|
input = %(<input type="number" class="browser-default" min="1" max="#{p_pages}" value="#{p_page}" style="padding: 2px; border: none; border-radius: 2px; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
|
39
|
-
html << %(<div class="pagy-compact-input btn-flat" style="cursor: default; padding: 0px">#{pagy_t('pagy.compact
|
39
|
+
html << %(<div class="pagy-compact-input btn-flat" style="cursor: default; padding: 0px">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</div>)
|
40
40
|
html << (p_next ? %(<li class="waves-effect next" #{li_style}>#{link.call p_next, '<i class="material-icons">chevron_right</i>', 'aria-label="next"'}</li>)
|
41
41
|
: %(<li class="next disabled" #{li_style}><a href="#"><i class="material-icons">chevron_right</i></a></li>))
|
42
42
|
html << %(</ul></div><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
|
data/lib/pagy/extras/navs.rb
CHANGED
@@ -17,7 +17,7 @@ class Pagy
|
|
17
17
|
html << (p_prev ? %(<span class="page prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</span> )
|
18
18
|
: %(<span class="page prev disabled">#{pagy_t('pagy.nav.prev')}</span> ))
|
19
19
|
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;">)
|
20
|
-
html << %(<span class="pagy-compact-input" style="margin: 0 0.6rem;">#{pagy_t('pagy.compact
|
20
|
+
html << %(<span class="pagy-compact-input" style="margin: 0 0.6rem;">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</span> )
|
21
21
|
html << (p_next ? %(<span class="page next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</span>)
|
22
22
|
: %(<span class="page next disabled">#{pagy_t('pagy.nav.next')}</span>))
|
23
23
|
html << %(</nav><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
|
data/lib/pagy/extras/semantic.rb
CHANGED
@@ -33,8 +33,8 @@ class Pagy
|
|
33
33
|
(html << link.call(1, '', %(style="display: none;" ))) if defined?(TRIM)
|
34
34
|
html << (p_prev ? %(#{link.call p_prev, '<i class="left small chevron icon"></i>', 'aria-label="previous"'})
|
35
35
|
: %(<div class="item disabled"><i class="left small chevron icon"></i></div>))
|
36
|
-
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;">)
|
37
|
-
html << %(<div class="pagy-compact-input item">#{pagy_t('pagy.compact
|
36
|
+
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; margin: 0 0.3rem">)
|
37
|
+
html << %(<div class="pagy-compact-input item">#{pagy_t('pagy.compact', page_input: input, count: p_page, pages: p_pages)}</div> )
|
38
38
|
html << (p_next ? %(#{link.call p_next, '<i class="right small chevron icon"></i>', 'aria-label="next"'})
|
39
39
|
: %(<div class="item disabled"><i class="right small chevron icon"></i></div>))
|
40
40
|
html << %(</div><script type="application/json" class="pagy-compact-json">["#{id}", "#{MARKER}", "#{p_page}", #{!!defined?(TRIM)}]</script>)
|
data/lib/pagy/frontend.rb
CHANGED
@@ -55,7 +55,7 @@ class Pagy
|
|
55
55
|
end
|
56
56
|
|
57
57
|
# Pagy::Frontend::I18N
|
58
|
-
def (I18N = {data:{}}).load(file:Pagy.root.join('locales', '
|
58
|
+
def (I18N = {data:{}}).load(file:Pagy.root.join('locales', 'en.yml'), language: 'en')
|
59
59
|
self[:data] = YAML.load_file(file)[language]
|
60
60
|
self[:plural] = eval(Pagy.root.join('locales', 'plurals.rb').read)[language] #rubocop:disable Security/Eval
|
61
61
|
end; I18N.load
|
@@ -13,8 +13,8 @@
|
|
13
13
|
<% end -%>
|
14
14
|
<% pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
|
15
15
|
<% if item.is_a?(Integer) -%> <li><%== link.call(item) %></li>
|
16
|
-
<% elsif item.is_a?(String) -%> <li class="current"
|
17
|
-
<% elsif item == :gap -%> <li class="
|
16
|
+
<% elsif item.is_a?(String) -%> <li class="current"><%= item %></li>
|
17
|
+
<% elsif item == :gap -%> <li class="ellipsis gap" aria-hidden="true"></li>
|
18
18
|
<% end -%>
|
19
19
|
<% end -%>
|
20
20
|
<% if pagy.next -%> <li class="next"><%== link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"') %></li>
|
@@ -22,13 +22,10 @@
|
|
22
22
|
|
23
23
|
- elsif item.is_a?(String) # current page
|
24
24
|
%li.current
|
25
|
-
|
26
|
-
!= pagy_t('pagy.nav.current')
|
27
|
-
!= item
|
25
|
+
= item
|
28
26
|
|
29
27
|
- elsif item == :gap # page gap
|
30
|
-
%li.
|
31
|
-
!= pagy_t('pagy.nav.gap')
|
28
|
+
%li.ellipsis.gap{"aria-hidden" => true}
|
32
29
|
|
33
30
|
- if pagy.next
|
34
31
|
%li.next!= link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
|
@@ -22,13 +22,10 @@ nav.pagy-nav-foundation role="navigation" aria-label="Pagination"
|
|
22
22
|
|
23
23
|
- elsif item.is_a?(String) # current page
|
24
24
|
li.current
|
25
|
-
span.show-for-sr
|
26
|
-
== pagy_t('pagy.nav.current')
|
27
25
|
= item
|
28
26
|
|
29
27
|
- elsif item == :gap # page gap
|
30
|
-
li.
|
31
|
-
== pagy_t('pagy.nav.gap')
|
28
|
+
li.ellipsis.gap aria-hidden="true"
|
32
29
|
|
33
30
|
- if pagy.next
|
34
31
|
li.next == link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
|
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.20.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-
|
11
|
+
date: 2018-10-02 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,
|
@@ -23,8 +23,15 @@ files:
|
|
23
23
|
- LICENSE.txt
|
24
24
|
- lib/config/pagy.rb
|
25
25
|
- lib/javascripts/pagy.js
|
26
|
-
- lib/locales/
|
26
|
+
- lib/locales/en.yml
|
27
|
+
- lib/locales/es.yml
|
28
|
+
- lib/locales/id.yml
|
29
|
+
- lib/locales/ja.yml
|
27
30
|
- lib/locales/plurals.rb
|
31
|
+
- lib/locales/pt-br.yml
|
32
|
+
- lib/locales/ru.yml
|
33
|
+
- lib/locales/tr.yml
|
34
|
+
- lib/locales/zh-cn.yml
|
28
35
|
- lib/pagy.rb
|
29
36
|
- lib/pagy/backend.rb
|
30
37
|
- lib/pagy/extras/array.rb
|
data/lib/locales/pagy.yml
DELETED
@@ -1,188 +0,0 @@
|
|
1
|
-
# Standard pagy dictionary
|
2
|
-
|
3
|
-
en:
|
4
|
-
pagy:
|
5
|
-
nav:
|
6
|
-
prev: "‹ Prev"
|
7
|
-
next: "Next ›"
|
8
|
-
gap: "…"
|
9
|
-
current: "You're on page"
|
10
|
-
info:
|
11
|
-
single_page:
|
12
|
-
zero: "No %{item_name} found"
|
13
|
-
one: "Displaying <b>1</b> %{item_name}"
|
14
|
-
other: "Displaying <b>all %{count}</b> %{item_name}"
|
15
|
-
multiple_pages: "Displaying %{item_name} <b>%{from}-%{to}</b> of <b>%{count}</b> in total"
|
16
|
-
item_name:
|
17
|
-
zero: "items"
|
18
|
-
one: "item"
|
19
|
-
other: "items"
|
20
|
-
compact:
|
21
|
-
page: "Page"
|
22
|
-
of: "of"
|
23
|
-
items:
|
24
|
-
show: "Show"
|
25
|
-
items: "items per page"
|
26
|
-
es:
|
27
|
-
pagy:
|
28
|
-
nav:
|
29
|
-
prev: "‹ Prev"
|
30
|
-
next: "Siguiente ›"
|
31
|
-
gap: "…"
|
32
|
-
current: "Estás en la página"
|
33
|
-
info:
|
34
|
-
single_page:
|
35
|
-
zero: "Sin resultados"
|
36
|
-
one: "Mostrando 1 %{item_name}"
|
37
|
-
other: "Mostrando %{count} %{item_name}"
|
38
|
-
multiple_pages: "Mostrando %{item_name} %{from}-%{to} de %{count} en total"
|
39
|
-
item_name:
|
40
|
-
zero: "ítems"
|
41
|
-
one: "ítem"
|
42
|
-
other: "ítems"
|
43
|
-
compact:
|
44
|
-
page: "Página"
|
45
|
-
of: "de"
|
46
|
-
items:
|
47
|
-
show: "Mostrar"
|
48
|
-
items: "ítems por página"
|
49
|
-
id:
|
50
|
-
pagy:
|
51
|
-
nav:
|
52
|
-
prev: "‹ Balik"
|
53
|
-
next: "Lanjut ›"
|
54
|
-
gap: "…"
|
55
|
-
current: "Anda di halaman"
|
56
|
-
info:
|
57
|
-
single_page:
|
58
|
-
zero: "Tidak ditemukan %{item_name}"
|
59
|
-
one: "Menampilkan <b>1</b> %{item_name}"
|
60
|
-
other: "Menampilkan <b>semua %{count}</b> %{item_name}"
|
61
|
-
multiple_pages: "Menampilkan %{item_name} <b>%{from}-%{to}</b> dari total <b>%{count}</b>"
|
62
|
-
item_name:
|
63
|
-
zero: "item"
|
64
|
-
one: "item"
|
65
|
-
other: "item"
|
66
|
-
compact:
|
67
|
-
page: "Halaman"
|
68
|
-
of: "dari"
|
69
|
-
items:
|
70
|
-
show: "Tampilkan"
|
71
|
-
items: "item per halaman"
|
72
|
-
ja:
|
73
|
-
pagy:
|
74
|
-
nav:
|
75
|
-
prev: "‹ 前へ"
|
76
|
-
next: "次へ ›"
|
77
|
-
gap: "…"
|
78
|
-
info:
|
79
|
-
single_page:
|
80
|
-
zero: "見つかりませんでした"
|
81
|
-
one: "<b>1</b> 件の%{item_name}"
|
82
|
-
other: "<b>%{count}</b> 件の%{item_name}"
|
83
|
-
multiple_pages: "<b>%{count}</b> 件中 <b>%{from}-%{to}</b> 件目の%{item_name}を表示中"
|
84
|
-
item_name:
|
85
|
-
zero: "結果"
|
86
|
-
one: "結果"
|
87
|
-
other: "結果"
|
88
|
-
compact:
|
89
|
-
page: "ページ"
|
90
|
-
of: "/"
|
91
|
-
items:
|
92
|
-
show: ""
|
93
|
-
items: "件ずつ表示"
|
94
|
-
pt-br:
|
95
|
-
pagy:
|
96
|
-
nav:
|
97
|
-
prev: "‹ Anterior"
|
98
|
-
next: "Próximo ›"
|
99
|
-
gap: "…"
|
100
|
-
current: "Está na página"
|
101
|
-
info:
|
102
|
-
single_page:
|
103
|
-
zero: "Sem resultados"
|
104
|
-
one: "Mostrando 1 %{item_name}"
|
105
|
-
other: "Mostrando %{count} %{item_name}"
|
106
|
-
multiple_pages: "Mostrando %{item_name} %{from}-%{to} no total de %{count}"
|
107
|
-
item_name:
|
108
|
-
zero: "itens"
|
109
|
-
one: "item"
|
110
|
-
other: "itens"
|
111
|
-
compact:
|
112
|
-
page: "Página"
|
113
|
-
of: "de"
|
114
|
-
items:
|
115
|
-
show: "Mostrar"
|
116
|
-
items: "itens por página"
|
117
|
-
ru:
|
118
|
-
pagy:
|
119
|
-
nav:
|
120
|
-
prev: "‹ Назад"
|
121
|
-
next: "Вперёд ›"
|
122
|
-
gap: "…"
|
123
|
-
current: "Вы на странице"
|
124
|
-
info:
|
125
|
-
single_page:
|
126
|
-
zero: "Пока %{item_name} нет"
|
127
|
-
one: "<b>1</b> %{item_name}"
|
128
|
-
few: "<b>%{count}</b> %{item_name}"
|
129
|
-
many: "Всего <b>%{count}</b> %{item_name}"
|
130
|
-
other: "Всего <b>%{count}</b> %{item_name}"
|
131
|
-
multiple_pages: "Всего <b>%{count}</b> %{item_name}, показаны с <b>%{from}</b> по <b>%{to}</b>"
|
132
|
-
item_name:
|
133
|
-
one: "запись"
|
134
|
-
few: "записи"
|
135
|
-
many: "записей"
|
136
|
-
other: "записей"
|
137
|
-
compact:
|
138
|
-
page: "Страница"
|
139
|
-
of: "из"
|
140
|
-
items:
|
141
|
-
show: "Показать"
|
142
|
-
items: "записей на странице"
|
143
|
-
tr:
|
144
|
-
pagy:
|
145
|
-
nav:
|
146
|
-
prev: "‹ Önceki"
|
147
|
-
next: "Sonraki ›"
|
148
|
-
gap: "…"
|
149
|
-
info:
|
150
|
-
single_page:
|
151
|
-
zero: "Hiç %{item_name} bulunamadı."
|
152
|
-
one: "<b>1</b> %{item_name} gösteriliyor."
|
153
|
-
other: "Toplam <b>%{count}</b> %{item_name} gösteriliyor."
|
154
|
-
multiple_pages: "<b>%{count}</b> %{item_name} içerisinden <b>%{from}-%{to}</b> kadarı gösteriliyor."
|
155
|
-
item_name:
|
156
|
-
zero: "kayıt"
|
157
|
-
one: "kayıt"
|
158
|
-
other: "kayıt"
|
159
|
-
compact:
|
160
|
-
page: "Sayfa"
|
161
|
-
of: "/"
|
162
|
-
items:
|
163
|
-
show: "Göster"
|
164
|
-
items: "sayfa başı"
|
165
|
-
zh-cn:
|
166
|
-
pagy:
|
167
|
-
nav:
|
168
|
-
prev: "‹ 上一页"
|
169
|
-
next: "下一页 ›"
|
170
|
-
gap: "…"
|
171
|
-
info:
|
172
|
-
single_page:
|
173
|
-
zero: " %{item_name}未找到"
|
174
|
-
one: "显示 <b>1</b> 条%{item_name}"
|
175
|
-
other: "显示<b>所有 %{count}</b> 条%{item_name}"
|
176
|
-
multiple_pages: "共 <b>%{count}</b> 条%{item_name},显示 <b>%{from}-%{to}</b>"
|
177
|
-
item_name:
|
178
|
-
zero: "项目"
|
179
|
-
one: ""
|
180
|
-
other: ""
|
181
|
-
compact:
|
182
|
-
page: "页面"
|
183
|
-
of: "/"
|
184
|
-
items:
|
185
|
-
show: "每页显示"
|
186
|
-
items: "条"
|
187
|
-
|
188
|
-
# PR for other languages are very welcome. Thanks!
|