pagy 4.0.0 → 4.5.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 +30 -24
- data/lib/javascripts/pagy.js +104 -93
- data/lib/locales/bs.yml +24 -0
- data/lib/locales/hr.yml +24 -0
- data/lib/locales/sr.yml +23 -0
- data/lib/locales/utils/i18n.rb +0 -1
- data/lib/locales/utils/loader.rb +7 -5
- data/lib/locales/utils/p11n.rb +27 -20
- data/lib/pagy.rb +50 -26
- data/lib/pagy/backend.rb +5 -3
- data/lib/pagy/countless.rb +12 -9
- data/lib/pagy/deprecation.rb +27 -0
- data/lib/pagy/exceptions.rb +7 -5
- data/lib/pagy/extras/arel.rb +4 -3
- data/lib/pagy/extras/array.rb +4 -3
- data/lib/pagy/extras/bootstrap.rb +62 -30
- data/lib/pagy/extras/bulma.rb +61 -38
- data/lib/pagy/extras/countless.rb +7 -5
- data/lib/pagy/extras/elasticsearch_rails.rb +8 -6
- data/lib/pagy/extras/foundation.rb +62 -32
- data/lib/pagy/extras/headers.rb +13 -9
- data/lib/pagy/extras/i18n.rb +7 -4
- data/lib/pagy/extras/items.rb +21 -26
- data/lib/pagy/extras/materialize.rb +59 -35
- data/lib/pagy/extras/metadata.rb +27 -21
- data/lib/pagy/extras/navs.rb +45 -20
- data/lib/pagy/extras/overflow.rb +12 -13
- data/lib/pagy/extras/searchkick.rb +9 -7
- data/lib/pagy/extras/semantic.rb +56 -30
- data/lib/pagy/extras/shared.rb +12 -11
- data/lib/pagy/extras/standalone.rb +71 -0
- data/lib/pagy/extras/support.rb +20 -11
- data/lib/pagy/extras/trim.rb +14 -9
- data/lib/pagy/extras/uikit.rb +65 -35
- data/lib/pagy/frontend.rb +62 -30
- metadata +8 -5
- data/lib/locales/README.md +0 -35
- data/pagy.gemspec +0 -16
data/lib/pagy/extras/support.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/support
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
class Pagy
|
@@ -7,29 +6,39 @@ class Pagy
|
|
7
6
|
module Frontend
|
8
7
|
|
9
8
|
def pagy_prev_url(pagy)
|
10
|
-
pagy_url_for(pagy
|
9
|
+
pagy_url_for(pagy, pagy.prev) if pagy.prev
|
11
10
|
end
|
12
11
|
|
13
12
|
def pagy_next_url(pagy)
|
14
|
-
pagy_url_for(pagy
|
13
|
+
pagy_url_for(pagy, pagy.next) if pagy.next
|
15
14
|
end
|
16
15
|
|
17
|
-
def pagy_prev_link(pagy,
|
18
|
-
|
19
|
-
|
16
|
+
def pagy_prev_link(pagy, deprecated_text=nil, deprecated_link_extra=nil, text: pagy_t('pagy.nav.prev'), link_extra: '')
|
17
|
+
text = Pagy.deprecated_arg(:text, deprecated_text, :text, text) if deprecated_text
|
18
|
+
link_extra = Pagy.deprecated_arg(:link_extra, deprecated_link_extra, :link_extra, link_extra) if deprecated_link_extra
|
19
|
+
if pagy.prev
|
20
|
+
%(<span class="page prev"><a href="#{pagy_url_for(pagy, pagy.prev)}" rel="prev" aria-label="previous" #{pagy.vars[:link_extra]} #{link_extra}>#{text}</a></span>)
|
21
|
+
else
|
22
|
+
%(<span class="page prev disabled">#{text}</span>)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
|
22
|
-
def pagy_next_link(pagy,
|
23
|
-
|
24
|
-
|
26
|
+
def pagy_next_link(pagy, deprecated_text=nil, deprecated_link_extra=nil, text: pagy_t('pagy.nav.next'), link_extra: '')
|
27
|
+
text = Pagy.deprecated_arg(:text, deprecated_text, :text, text) if deprecated_text
|
28
|
+
link_extra = Pagy.deprecated_arg(:link_extra, deprecated_link_extra, :link_extra, link_extra) if deprecated_link_extra
|
29
|
+
if pagy.next
|
30
|
+
%(<span class="page next"><a href="#{pagy_url_for(pagy, pagy.next)}" rel="next" aria-label="next" #{pagy.vars[:link_extra]} #{link_extra}>#{text}</a></span>)
|
31
|
+
else
|
32
|
+
%(<span class="page next disabled">#{text}</span>)
|
33
|
+
end
|
25
34
|
end
|
26
35
|
|
27
36
|
def pagy_prev_link_tag(pagy)
|
28
|
-
%(<link href="#{pagy_url_for(pagy
|
37
|
+
%(<link href="#{pagy_url_for(pagy, pagy.prev)}" rel="prev"/>) if pagy.prev
|
29
38
|
end
|
30
39
|
|
31
40
|
def pagy_next_link_tag(pagy)
|
32
|
-
%(<link href="#{pagy_url_for(pagy
|
41
|
+
%(<link href="#{pagy_url_for(pagy, pagy.next)}" rel="next"/>) if pagy.next
|
33
42
|
end
|
34
43
|
|
35
44
|
end
|
data/lib/pagy/extras/trim.rb
CHANGED
@@ -1,19 +1,24 @@
|
|
1
1
|
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/trim
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
class Pagy
|
6
5
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
VARS[:enable_trim_extra] = true
|
7
|
+
|
8
|
+
module UseTrimExtra
|
9
|
+
|
10
|
+
def pagy_link_proc(pagy, deprecated_link_extra=nil, link_extra: '')
|
11
|
+
link_extra = Pagy.deprecated_arg(:link_extra, deprecated_link_extra, :link_extra, link_extra) if deprecated_link_extra
|
12
|
+
link_proc = super(pagy, link_extra: link_extra)
|
13
|
+
return link_proc unless pagy.vars[:enable_trim_extra]
|
14
|
+
lambda do |num, text=num, extra=''|
|
15
|
+
link = link_proc.call(num, text, extra)
|
16
|
+
return link unless num == 1
|
17
|
+
link.sub!(/[?&]#{pagy.vars[:page_param]}=1\b(?!&)|\b#{pagy.vars[:page_param]}=1&/, '')
|
14
18
|
end
|
15
19
|
end
|
20
|
+
|
16
21
|
end
|
17
|
-
Frontend.prepend
|
22
|
+
Frontend.prepend UseTrimExtra
|
18
23
|
|
19
24
|
end
|
data/lib/pagy/extras/uikit.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/uikit
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
require 'pagy/extras/shared'
|
@@ -8,55 +7,86 @@ class Pagy
|
|
8
7
|
module Frontend
|
9
8
|
|
10
9
|
# Pagination for uikit: it returns the html with the series of links to the pages
|
11
|
-
def pagy_uikit_nav(pagy)
|
12
|
-
|
10
|
+
def pagy_uikit_nav(pagy, pagy_id: nil, link_extra: '')
|
11
|
+
p_id = %( id="#{pagy_id}") if pagy_id
|
12
|
+
link = pagy_link_proc(pagy, link_extra: link_extra)
|
13
13
|
|
14
|
-
|
15
|
-
html = (p_prev ? %(<li>#{link.call p_prev, previous_span}</li>)
|
16
|
-
: %(<li class="uk-disabled"><a href="#">#{previous_span}</a></li>))
|
14
|
+
html = %(<ul#{p_id} class="pagy-uikit-nav uk-pagination uk-flex-center">#{pagy_uikit_prev_html pagy, link})
|
17
15
|
pagy.series.each do |item|
|
18
|
-
html <<
|
19
|
-
|
20
|
-
|
16
|
+
html << case item
|
17
|
+
when Integer then %(<li>#{link.call item}</li>)
|
18
|
+
when String then %(<li class="uk-active"><span>#{item}</span></li>)
|
19
|
+
when :gap then %(<li class="uk-disabled"><span>#{pagy_t 'pagy.nav.gap'}</span></li>)
|
21
20
|
end
|
22
21
|
end
|
23
|
-
|
24
|
-
html <<
|
25
|
-
: %(<li class="uk-disabled"><a href="#">#{next_span}</a></li>))
|
26
|
-
%(<ul class="pagy-uikit-nav uk-pagination uk-flex-center">#{html}</ul>)
|
22
|
+
html << pagy_uikit_next_html(pagy, link)
|
23
|
+
html << %(</ul>)
|
27
24
|
end
|
28
25
|
|
29
26
|
# Javascript pagination for uikit: it returns a nav and a JSON tag used by the Pagy.nav javascript
|
30
|
-
def pagy_uikit_nav_js(pagy,
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
tags = { 'before' =>
|
35
|
-
: %(<li class="uk-disabled"><a href="#">#{previous_span}</a></li>),
|
27
|
+
def pagy_uikit_nav_js(pagy, deprecated_id=nil, pagy_id: nil, link_extra: '', steps: nil)
|
28
|
+
pagy_id = Pagy.deprecated_arg(:id, deprecated_id, :pagy_id, pagy_id) if deprecated_id
|
29
|
+
p_id = %( id="#{pagy_id}") if pagy_id
|
30
|
+
link = pagy_link_proc(pagy, link_extra: link_extra)
|
31
|
+
tags = { 'before' => pagy_uikit_prev_html(pagy, link),
|
36
32
|
'link' => %(<li>#{link.call(PAGE_PLACEHOLDER)}</li>),
|
37
33
|
'active' => %(<li class="uk-active"><span>#{PAGE_PLACEHOLDER}</span></li>),
|
38
|
-
'gap' => %(<li class="uk-disabled"><span>#{pagy_t
|
39
|
-
'after' =>
|
40
|
-
|
41
|
-
%(<ul
|
34
|
+
'gap' => %(<li class="uk-disabled"><span>#{pagy_t 'pagy.nav.gap'}</span></li>),
|
35
|
+
'after' => pagy_uikit_next_html(pagy, link) }
|
36
|
+
|
37
|
+
html = %(<ul#{p_id} class="pagy-njs pagy-uikit-nav-js uk-pagination uk-flex-center"></ul>)
|
38
|
+
html << pagy_json_tag(pagy, :nav, tags, pagy.sequels(steps))
|
42
39
|
end
|
43
40
|
|
44
41
|
# Javascript combo pagination for uikit: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
|
45
|
-
def pagy_uikit_combo_nav_js(pagy,
|
46
|
-
|
42
|
+
def pagy_uikit_combo_nav_js(pagy, deprecated_id=nil, pagy_id: nil, link_extra: '')
|
43
|
+
pagy_id = Pagy.deprecated_arg(:id, deprecated_id, :pagy_id, pagy_id) if deprecated_id
|
44
|
+
p_id = %( id="#{pagy_id}") if pagy_id
|
45
|
+
link = pagy_link_proc(pagy, link_extra: link_extra)
|
46
|
+
p_page = pagy.page
|
47
|
+
p_pages = pagy.pages
|
48
|
+
input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" class="uk-input" style="padding: 0; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
|
49
|
+
|
50
|
+
%(<div#{p_id} class="pagy-uikit-combo-nav-js uk-button-group">#{
|
51
|
+
if (p_prev = pagy.prev)
|
52
|
+
link.call p_prev, pagy_t('pagy.nav.prev'), 'class="uk-button uk-button-default"'
|
53
|
+
else
|
54
|
+
%(<button class="uk-button uk-button-default" disabled>#{pagy_t 'pagy.nav.prev'}</button>)
|
55
|
+
end
|
56
|
+
}<div class="uk-text-middle uk-margin-left uk-margin-right">#{
|
57
|
+
pagy_t 'pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages
|
58
|
+
}</div>#{
|
59
|
+
if (p_next = pagy.next)
|
60
|
+
link.call p_next, pagy_t('pagy.nav.next'), 'class="uk-button uk-button-default"'
|
61
|
+
else
|
62
|
+
%(<button class="uk-button uk-button-default" disabled>#{pagy_t 'pagy.nav.next'}</button>)
|
63
|
+
end
|
64
|
+
}</div>#{
|
65
|
+
pagy_json_tag pagy, :combo_nav, p_page, pagy_marked_link(link)
|
66
|
+
})
|
67
|
+
end
|
47
68
|
|
48
|
-
html = %(<div id="#{id}" class="pagy-uikit-combo-nav-js uk-button-group">)
|
49
|
-
html = html + (p_prev ? link.call(p_prev, pagy_t('pagy.nav.prev'), 'class="uk-button uk-button-default"')
|
50
|
-
: %(<button class="uk-button uk-button-default" disabled>#{pagy_t('pagy.nav.prev')}</button>))
|
51
69
|
|
52
|
-
html << %(<div class="uk-text-middle uk-margin-left uk-margin-right">)
|
53
|
-
input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" class="uk-input" style="padding: 0; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
|
54
|
-
html << pagy_t('pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages) + '</div>'
|
55
70
|
|
56
|
-
|
57
|
-
|
71
|
+
private
|
72
|
+
|
73
|
+
def pagy_uikit_prev_html(pagy, link)
|
74
|
+
previous_span = %(<span uk-pagination-previous>#{pagy_t 'pagy.nav.prev'}</span>)
|
75
|
+
if (p_prev = pagy.prev)
|
76
|
+
%(<li>#{link.call p_prev, previous_span}</li>)
|
77
|
+
else
|
78
|
+
%(<li class="uk-disabled"><a href="#">#{previous_span}</a></li>)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def pagy_uikit_next_html(pagy, link)
|
83
|
+
next_span = %(<span uk-pagination-next>#{pagy_t 'pagy.nav.next'}</span>)
|
84
|
+
if (p_next = pagy.next)
|
85
|
+
%(<li>#{link.call p_next, next_span}</li>)
|
86
|
+
else
|
87
|
+
%(<li class="uk-disabled"><a href="#">#{next_span}</a></li>)
|
88
|
+
end
|
89
|
+
end
|
58
90
|
|
59
|
-
html << %(</div>#{pagy_json_tag(pagy, :combo_nav, id, p_page, pagy_marked_link(link))})
|
60
|
-
end
|
61
91
|
end
|
62
92
|
end
|
data/lib/pagy/frontend.rb
CHANGED
@@ -1,26 +1,31 @@
|
|
1
1
|
# See Pagy::Frontend API documentation: https://ddnexus.github.io/pagy/api/frontend
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
require 'yaml'
|
6
5
|
|
7
6
|
class Pagy
|
8
7
|
|
9
|
-
PAGE_PLACEHOLDER
|
8
|
+
PAGE_PLACEHOLDER = '__pagy_page__' # string used for search and replace, hardcoded also in the pagy.js file
|
10
9
|
|
11
10
|
# I18n static hash loaded at startup, used as default alternative to the i18n gem.
|
12
11
|
# see https://ddnexus.github.io/pagy/api/frontend#i18n
|
13
|
-
I18n = eval
|
12
|
+
I18n = eval Pagy.root.join('locales', 'utils', 'i18n.rb').read #rubocop:disable Security/Eval
|
14
13
|
|
15
14
|
module Helpers
|
16
15
|
# This works with all Rack-based frameworks (Sinatra, Padrino, Rails, ...)
|
17
|
-
def pagy_url_for(page,
|
18
|
-
|
19
|
-
|
16
|
+
def pagy_url_for(pagy, page, deprecated_url=nil, absolute: nil)
|
17
|
+
absolute = Pagy.deprecated_arg(:url, deprecated_url, :absolute, absolute) if deprecated_url
|
18
|
+
pagy, page = Pagy.deprecated_order(pagy, page) if page.is_a?(Pagy)
|
19
|
+
p_vars = pagy.vars
|
20
|
+
params = request.GET.merge(p_vars[:params])
|
21
|
+
params[p_vars[:page_param].to_s] = page
|
22
|
+
params[p_vars[:items_param].to_s] = p_vars[:items] if defined?(UseItemsExtra)
|
23
|
+
query_string = "?#{Rack::Utils.build_nested_query(pagy_get_params(params))}" unless params.empty?
|
24
|
+
"#{request.base_url if absolute}#{request.path}#{query_string}#{p_vars[:fragment]}"
|
20
25
|
end
|
21
26
|
|
22
27
|
# Sub-method called only by #pagy_url_for: here for easy customization of params by overriding
|
23
|
-
def pagy_get_params(params) params
|
28
|
+
def pagy_get_params(params) = params
|
24
29
|
end
|
25
30
|
|
26
31
|
# All the code here has been optimized for performance: it may not look very pretty
|
@@ -30,43 +35,70 @@ class Pagy
|
|
30
35
|
include Helpers
|
31
36
|
|
32
37
|
# Generic pagination: it returns the html with the series of links to the pages
|
33
|
-
def pagy_nav(pagy)
|
34
|
-
|
38
|
+
def pagy_nav(pagy, pagy_id: nil, link_extra: '')
|
39
|
+
p_id = %( id="#{pagy_id}") if pagy_id
|
40
|
+
link = pagy_link_proc(pagy, link_extra: link_extra)
|
41
|
+
p_prev = pagy.prev
|
42
|
+
p_next = pagy.next
|
35
43
|
|
36
|
-
html
|
37
|
-
|
44
|
+
html = +%(<nav#{p_id} class="pagy-nav pagination" role="navigation" aria-label="pager">)
|
45
|
+
html << if p_prev
|
46
|
+
%(<span class="page prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</span> )
|
47
|
+
else
|
48
|
+
%(<span class="page prev disabled">#{pagy_t('pagy.nav.prev')}</span> )
|
49
|
+
end
|
38
50
|
pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
39
|
-
html <<
|
40
|
-
|
41
|
-
|
51
|
+
html << case item
|
52
|
+
when Integer then %(<span class="page">#{link.call item}</span> ) # page link
|
53
|
+
when String then %(<span class="page active">#{item}</span> ) # current page
|
54
|
+
when :gap then %(<span class="page gap">#{pagy_t('pagy.nav.gap')}</span> ) # page gap
|
42
55
|
end
|
43
56
|
end
|
44
|
-
html <<
|
45
|
-
|
46
|
-
|
57
|
+
html << if p_next
|
58
|
+
%(<span class="page next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</span>)
|
59
|
+
else
|
60
|
+
%(<span class="page next disabled">#{pagy_t('pagy.nav.next')}</span>)
|
61
|
+
end
|
62
|
+
html << %(</nav>)
|
47
63
|
end
|
48
64
|
|
49
65
|
# Return examples: "Displaying items 41-60 of 324 in total" of "Displaying Products 41-60 of 324 in total"
|
50
|
-
def pagy_info(pagy,
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
66
|
+
def pagy_info(pagy, deprecated_item_name=nil, pagy_id: nil, item_name: nil, i18n_key: nil)
|
67
|
+
p_id = %( id="#{pagy_id}") if pagy_id
|
68
|
+
item_name = Pagy.deprecated_arg(:item_name, deprecated_item_name, :item_name, item_name) if deprecated_item_name
|
69
|
+
p_count = pagy.count
|
70
|
+
key = if p_count.zero? then 'pagy.info.no_items'
|
71
|
+
elsif pagy.pages == 1 then 'pagy.info.single_page'
|
72
|
+
else 'pagy.info.multiple_pages'
|
73
|
+
end
|
74
|
+
|
75
|
+
%(<span#{p_id} class="pagy-info">#{
|
76
|
+
pagy_t key, item_name: item_name || pagy_t(i18n_key || pagy.vars[:i18n_key], count: p_count),
|
77
|
+
count: p_count, from: pagy.from, to: pagy.to
|
78
|
+
}</span>)
|
55
79
|
end
|
56
80
|
|
57
81
|
# Returns a performance optimized proc to generate the HTML links
|
58
82
|
# Benchmarked on a 20 link nav: it is ~22x faster and uses ~18x less memory than rails' link_to
|
59
|
-
def pagy_link_proc(pagy, link_extra
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
83
|
+
def pagy_link_proc(pagy, deprecated_link_extra=nil, link_extra: '')
|
84
|
+
link_extra = Pagy.deprecated_arg(:link_extra, deprecated_link_extra, :link_extra, link_extra) if deprecated_link_extra
|
85
|
+
p_prev = pagy.prev
|
86
|
+
p_next = pagy.next
|
87
|
+
left, right = %(<a href="#{pagy_url_for pagy, PAGE_PLACEHOLDER}" #{pagy.vars[:link_extra]} #{link_extra}).split(PAGE_PLACEHOLDER, 2)
|
88
|
+
lambda do |num, text=num, extra_attrs=''|
|
89
|
+
%(#{left}#{num}#{right}#{ case num
|
90
|
+
when p_prev then ' rel="prev"'
|
91
|
+
when p_next then ' rel="next"'
|
92
|
+
else ''
|
93
|
+
end } #{extra_attrs}>#{text}</a>)
|
94
|
+
end
|
65
95
|
end
|
66
96
|
|
67
97
|
# Similar to I18n.t: just ~18x faster using ~10x less memory
|
68
|
-
# (@pagy_locale explicitly
|
69
|
-
def pagy_t(key, **opts)
|
98
|
+
# (@pagy_locale explicitly initialized in order to avoid warning)
|
99
|
+
def pagy_t(key, **opts)
|
100
|
+
Pagy::I18n.t @pagy_locale||=nil, key, **opts
|
101
|
+
end
|
70
102
|
|
71
103
|
end
|
72
104
|
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: 4.
|
4
|
+
version: 4.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: 2021-
|
11
|
+
date: 2021-04-30 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,
|
@@ -22,8 +22,8 @@ files:
|
|
22
22
|
- LICENSE.txt
|
23
23
|
- lib/config/pagy.rb
|
24
24
|
- lib/javascripts/pagy.js
|
25
|
-
- lib/locales/README.md
|
26
25
|
- lib/locales/bg.yml
|
26
|
+
- lib/locales/bs.yml
|
27
27
|
- lib/locales/ca.yml
|
28
28
|
- lib/locales/cs.yml
|
29
29
|
- lib/locales/da.yml
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- lib/locales/en.yml
|
32
32
|
- lib/locales/es.yml
|
33
33
|
- lib/locales/fr.yml
|
34
|
+
- lib/locales/hr.yml
|
34
35
|
- lib/locales/id.yml
|
35
36
|
- lib/locales/it.yml
|
36
37
|
- lib/locales/ja.yml
|
@@ -42,6 +43,7 @@ files:
|
|
42
43
|
- lib/locales/pt-BR.yml
|
43
44
|
- lib/locales/pt.yml
|
44
45
|
- lib/locales/ru.yml
|
46
|
+
- lib/locales/sr.yml
|
45
47
|
- lib/locales/sv-SE.yml
|
46
48
|
- lib/locales/sv.yml
|
47
49
|
- lib/locales/sw.yml
|
@@ -55,6 +57,7 @@ files:
|
|
55
57
|
- lib/pagy.rb
|
56
58
|
- lib/pagy/backend.rb
|
57
59
|
- lib/pagy/countless.rb
|
60
|
+
- lib/pagy/deprecation.rb
|
58
61
|
- lib/pagy/exceptions.rb
|
59
62
|
- lib/pagy/extras/arel.rb
|
60
63
|
- lib/pagy/extras/array.rb
|
@@ -73,6 +76,7 @@ files:
|
|
73
76
|
- lib/pagy/extras/searchkick.rb
|
74
77
|
- lib/pagy/extras/semantic.rb
|
75
78
|
- lib/pagy/extras/shared.rb
|
79
|
+
- lib/pagy/extras/standalone.rb
|
76
80
|
- lib/pagy/extras/support.rb
|
77
81
|
- lib/pagy/extras/trim.rb
|
78
82
|
- lib/pagy/extras/uikit.rb
|
@@ -92,7 +96,6 @@ files:
|
|
92
96
|
- lib/templates/uikit_nav.html.erb
|
93
97
|
- lib/templates/uikit_nav.html.haml
|
94
98
|
- lib/templates/uikit_nav.html.slim
|
95
|
-
- pagy.gemspec
|
96
99
|
homepage: https://github.com/ddnexus/pagy
|
97
100
|
licenses:
|
98
101
|
- MIT
|
@@ -112,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
115
|
- !ruby/object:Gem::Version
|
113
116
|
version: '0'
|
114
117
|
requirements: []
|
115
|
-
rubygems_version: 3.2.
|
118
|
+
rubygems_version: 3.2.15
|
116
119
|
signing_key:
|
117
120
|
specification_version: 4
|
118
121
|
summary: The Ultimate Pagination Ruby Gem
|
data/lib/locales/README.md
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# Pagy locales
|
2
|
-
|
3
|
-
### Please, submit your translation!
|
4
|
-
|
5
|
-
If you find that some translation could be improved, please, create an issue.
|
6
|
-
|
7
|
-
If you are using pagy with some language missing from the dictionary files, please, submit your translation!
|
8
|
-
|
9
|
-
You can create a Pull Request for your language, and get all the help you need to correctly complete it. Here is a check list.
|
10
|
-
|
11
|
-
### Check list for a new dictionary file:
|
12
|
-
|
13
|
-
- [ ] Find the pluralization rule for your language
|
14
|
-
|
15
|
-
- [ ] Find the locale file you need in the [list of pluralizations](https://github.com/svenfuchs/rails-i18n/tree/master/rails/pluralization) and check the pluralization rule in it. For example it is `::RailsI18n::Pluralization::OneOther.with_locale(:en)` for `en.rb`. Note the rule part i.e. `OneOther`. In pagy that translates to the symbol `:one_other`.
|
16
|
-
|
17
|
-
- [ ] If the pluralization rule of your language is not the `:one_other` default, confirm that the [p11n.rb](https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb) file already defines the pluralization rule of your dictionary file:
|
18
|
-
|
19
|
-
- [ ] If the rule is not defined, you can either: a) Add the rule as a new rule/lambda entry in the `p11n` variable hash and relative tests or b) Just create an issue requesting the addition to the rule/lambda entry and tests.
|
20
|
-
|
21
|
-
- [ ] Add your language to the `plurals` hash in the file.
|
22
|
-
|
23
|
-
- [ ] add/edit the first line comment in the language rule in your dictionary file (e.g. `# :one_other pluralization ...`
|
24
|
-
|
25
|
-
- [ ] The mandatory pluralized entry in the dictionary file is the `item_name`. Please, provide all the plurals needed by your language. E.g. if your language uses the `:east_slavic` you should provide the plurals for `one`, `few`, `many` and `other`, if it uses `:one_other`, you should provide `one` and `other` plurals. If it uses `:other` you should only provide a single value. Look into other dictionary files to get some example. Ask if in doubt.
|
26
|
-
|
27
|
-
- [ ] The other entries in the dictionary file don't need any plural variant in most languages since the pluralization of the `item_name` in the sentence is enough. However, in some language, a whole sentence might need to be written in different ways for different counts. In that case you should add the different plurals for the sentence and the `count` will trigger the one that applies.
|
28
|
-
|
29
|
-
Feel free to ask for help in your Pull Request.
|
30
|
-
|
31
|
-
### Useful Links
|
32
|
-
|
33
|
-
* [Pagy I18n Documentation](https://ddnexus.github.io/pagy/api/frontend#i18n)
|
34
|
-
* [I18n Extra](https://ddnexus.github.io/pagy/extras/i18n)
|
35
|
-
|