pagy 8.0.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/apps/calendar.ru +745 -0
- data/{lib/apps → apps}/demo.ru +35 -52
- data/apps/keyset_ar.ru +236 -0
- data/apps/keyset_s.ru +238 -0
- data/{lib/apps → apps}/rails.ru +40 -33
- data/{lib/apps → apps}/repro.ru +33 -24
- data/apps/tmp/calendar.sqlite3 +0 -0
- data/apps/tmp/calendar.sqlite3-shm +0 -0
- data/apps/tmp/calendar.sqlite3-wal +0 -0
- data/apps/tmp/local_secret.txt +1 -0
- data/apps/tmp/pagy-keyset-ar.sqlite3 +0 -0
- data/apps/tmp/pagy-keyset-ar.sqlite3-shm +0 -0
- data/apps/tmp/pagy-keyset-ar.sqlite3-wal +0 -0
- data/apps/tmp/pagy-keyset-s.sqlite3 +0 -0
- data/{lib/bin → bin}/pagy +36 -17
- data/{lib/config → config}/pagy.rb +37 -68
- data/javascripts/pagy-module.js +100 -0
- data/javascripts/pagy.js +4 -0
- data/javascripts/pagy.min.js +4 -0
- data/javascripts/pagy.min.js.map +10 -0
- data/javascripts/pagy.mjs +100 -0
- data/lib/optimist.rb +1 -1
- data/lib/pagy/b64.rb +33 -0
- data/lib/pagy/backend.rb +24 -15
- data/lib/pagy/calendar/day.rb +5 -4
- data/lib/pagy/calendar/month.rb +5 -4
- data/lib/pagy/calendar/quarter.rb +5 -4
- data/lib/pagy/calendar/unit.rb +103 -0
- data/lib/pagy/calendar/week.rb +4 -4
- data/lib/pagy/calendar/year.rb +5 -4
- data/lib/pagy/calendar.rb +55 -99
- data/lib/pagy/console.rb +2 -2
- data/lib/pagy/countless.rb +17 -16
- data/lib/pagy/extras/arel.rb +8 -10
- data/lib/pagy/extras/array.rb +4 -6
- data/lib/pagy/extras/bootstrap.rb +7 -7
- data/lib/pagy/extras/bulma.rb +13 -9
- data/lib/pagy/extras/calendar.rb +35 -6
- data/lib/pagy/extras/countless.rb +7 -14
- data/lib/pagy/extras/elasticsearch_rails.rb +15 -15
- data/lib/pagy/extras/gearbox.rb +36 -35
- data/lib/pagy/extras/headers.rb +26 -25
- data/lib/pagy/extras/i18n.rb +1 -1
- data/lib/pagy/extras/js_tools.rb +12 -9
- data/lib/pagy/extras/jsonapi.rb +27 -17
- data/lib/pagy/extras/keyset.rb +26 -0
- data/lib/pagy/extras/limit.rb +63 -0
- data/lib/pagy/extras/meilisearch.rb +11 -11
- data/lib/pagy/extras/metadata.rb +7 -3
- data/lib/pagy/extras/overflow.rb +9 -8
- data/lib/pagy/extras/pagy.rb +18 -18
- data/lib/pagy/extras/searchkick.rb +11 -11
- data/lib/pagy/extras/size.rb +40 -0
- data/lib/pagy/extras/standalone.rb +8 -8
- data/lib/pagy/extras/trim.rb +3 -3
- data/lib/pagy/frontend.rb +39 -37
- data/lib/pagy/i18n.rb +1 -1
- data/lib/pagy/keyset/active_record.rb +38 -0
- data/lib/pagy/keyset/sequel.rb +51 -0
- data/lib/pagy/keyset.rb +99 -0
- data/lib/pagy/url_helpers.rb +11 -11
- data/lib/pagy.rb +96 -120
- data/{lib/locales → locales}/ar.yml +9 -10
- data/{lib/locales → locales}/be.yml +2 -2
- data/{lib/locales → locales}/bg.yml +2 -2
- data/{lib/locales → locales}/bs.yml +2 -2
- data/{lib/locales → locales}/ca.yml +5 -7
- data/{lib/locales → locales}/ckb.yml +2 -2
- data/{lib/locales → locales}/cs.yml +2 -2
- data/{lib/locales → locales}/da.yml +5 -7
- data/{lib/locales → locales}/de.yml +2 -2
- data/{lib/locales → locales}/en.yml +2 -2
- data/{lib/locales → locales}/es.yml +2 -2
- data/{lib/locales → locales}/fr.yml +2 -2
- data/{lib/locales → locales}/hr.yml +2 -2
- data/{lib/locales → locales}/id.yml +2 -2
- data/{lib/locales → locales}/it.yml +2 -2
- data/{lib/locales → locales}/ja.yml +2 -2
- data/{lib/locales → locales}/km.yml +2 -2
- data/{lib/locales → locales}/ko.yml +3 -5
- data/{lib/locales → locales}/nb.yml +2 -2
- data/{lib/locales → locales}/nl.yml +2 -2
- data/{lib/locales → locales}/nn.yml +2 -2
- data/{lib/locales → locales}/pl.yml +2 -2
- data/{lib/locales → locales}/pt-BR.yml +2 -2
- data/{lib/locales → locales}/pt.yml +2 -2
- data/{lib/locales → locales}/ru.yml +7 -9
- data/{lib/locales → locales}/sr.yml +2 -2
- data/{lib/locales → locales}/sv-SE.yml +2 -2
- data/{lib/locales → locales}/sv.yml +2 -2
- data/{lib/locales → locales}/sw.yml +2 -2
- data/{lib/locales → locales}/ta.yml +2 -2
- data/{lib/locales → locales}/tr.yml +2 -2
- data/{lib/locales → locales}/uk.yml +2 -2
- data/{lib/locales → locales}/vi.yml +2 -2
- data/{lib/locales → locales}/zh-CN.yml +2 -2
- data/{lib/locales → locales}/zh-HK.yml +2 -2
- data/{lib/locales → locales}/zh-TW.yml +2 -2
- data/pkg/pagy-9.0.0.gem +0 -0
- metadata +75 -70
- data/lib/apps/calendar.ru +0 -2196
- data/lib/javascripts/pagy-dev.js +0 -112
- data/lib/javascripts/pagy-module.js +0 -111
- data/lib/javascripts/pagy.js +0 -1
- data/lib/pagy/calendar/helper.rb +0 -65
- data/lib/pagy/extras/foundation.rb +0 -93
- data/lib/pagy/extras/items.rb +0 -64
- data/lib/pagy/extras/materialize.rb +0 -97
- data/lib/pagy/extras/semantic.rb +0 -91
- data/lib/pagy/extras/uikit.rb +0 -96
- /data/{lib/javascripts/pagy-module.d.ts → javascripts/pagy.d.ts} +0 -0
- /data/{lib/stylesheets → stylesheets}/pagy.css +0 -0
- /data/{lib/stylesheets → stylesheets}/pagy.scss +0 -0
- /data/{lib/stylesheets → stylesheets}/pagy.tailwind.css +0 -0
data/lib/pagy/extras/semantic.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
# See the Pagy documentation: https://ddnexus.github.io/pagy/docs/extras/semantic
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'pagy/extras/js_tools'
|
5
|
-
|
6
|
-
class Pagy # :nodoc:
|
7
|
-
# Frontend modules are specially optimized for performance.
|
8
|
-
# The resulting code may not look very elegant, but produces the best benchmarks
|
9
|
-
module SemanticExtra
|
10
|
-
# Pagination for semantic: it returns the html with the series of links to the pages
|
11
|
-
def pagy_semantic_nav(pagy, id: nil, aria_label: nil, **vars)
|
12
|
-
id = %( id="#{id}") if id
|
13
|
-
a = pagy_anchor(pagy)
|
14
|
-
|
15
|
-
html = %(<div#{id} role="navigation" class="pagy-semantic nav ui pagination menu" #{
|
16
|
-
nav_aria_label(pagy, aria_label:)}>#{semantic_prev_html(pagy, a)})
|
17
|
-
pagy.series(**vars).each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
18
|
-
html << case item
|
19
|
-
when Integer
|
20
|
-
a.(item, pagy.label_for(item), classes: 'item')
|
21
|
-
when String
|
22
|
-
%(<a role="link" class="item active" aria-current="page" aria-disabled="true">#{pagy.label_for(item)}</a>)
|
23
|
-
when :gap
|
24
|
-
%(<div class="disabled item">#{pagy_t 'pagy.gap'}</div>)
|
25
|
-
else
|
26
|
-
raise InternalError, "expected item types in series to be Integer, String or :gap; got #{item.inspect}"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
html << %(#{semantic_next_html(pagy, a)}</div>)
|
30
|
-
end
|
31
|
-
|
32
|
-
# Javascript pagination for semantic: it returns a nav with a data-pagy attribute used by the pagy.js file
|
33
|
-
def pagy_semantic_nav_js(pagy, id: nil, aria_label: nil, **vars)
|
34
|
-
sequels = pagy.sequels(**vars)
|
35
|
-
id = %( id="#{id}") if id
|
36
|
-
a = pagy_anchor(pagy)
|
37
|
-
tokens = { 'before' => semantic_prev_html(pagy, a),
|
38
|
-
'a' => a.(PAGE_TOKEN, LABEL_TOKEN, classes: 'item'),
|
39
|
-
'current' => %(<a role="link" class="item active" aria-current="page" aria-disabled="true">#{LABEL_TOKEN}</a>),
|
40
|
-
'gap' => %(<div class="disabled item">#{pagy_t('pagy.gap')}</div>),
|
41
|
-
'after' => semantic_next_html(pagy, a) }
|
42
|
-
|
43
|
-
%(<div#{id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-semantic nav-js ui pagination menu" role="navigation" #{
|
44
|
-
nav_aria_label(pagy, aria_label:)} #{
|
45
|
-
pagy_data(pagy, :nav, tokens, sequels, pagy.label_sequels(sequels))
|
46
|
-
}></div>)
|
47
|
-
end
|
48
|
-
|
49
|
-
# Combo pagination for semantic: it returns a nav with a data-pagy attribute used by the pagy.js file
|
50
|
-
def pagy_semantic_combo_nav_js(pagy, id: nil, aria_label: nil)
|
51
|
-
id = %( id="#{id}") if id
|
52
|
-
a = pagy_anchor(pagy)
|
53
|
-
pages = pagy.pages
|
54
|
-
|
55
|
-
page_input = %(<input name="page" type="number" min="1" max="#{pages}" value="#{pagy.page}" aria-current="page") <<
|
56
|
-
%(style="text-align: center; width: #{pages.to_s.length + 1}rem; padding: 0; margin: 0 0.3rem">)
|
57
|
-
|
58
|
-
%(<div#{id} class="pagy-semantic combo-nav-js ui compact menu" role="navigation" #{
|
59
|
-
nav_aria_label(pagy, aria_label:)} #{
|
60
|
-
pagy_data(pagy, :combo, pagy_url_for(pagy, PAGE_TOKEN))
|
61
|
-
}>#{
|
62
|
-
semantic_prev_html(pagy, a)
|
63
|
-
}<div class="item"><label>#{
|
64
|
-
pagy_t('pagy.combo_nav_js', page_input:, pages:)
|
65
|
-
}</label></div> #{
|
66
|
-
semantic_next_html(pagy, a)
|
67
|
-
}</div>)
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
def semantic_prev_html(pagy, a)
|
73
|
-
if (p_prev = pagy.prev)
|
74
|
-
a.(p_prev, pagy_t('pagy.prev'), classes: 'item', aria_label: pagy_t('pagy.aria_label.prev'))
|
75
|
-
else
|
76
|
-
%(<div class="item disabled" role="a" aria-disabled="true" aria-label="#{
|
77
|
-
pagy_t('pagy.aria_label.prev')}">#{pagy_t('pagy.prev')}</div>)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def semantic_next_html(pagy, a)
|
82
|
-
if (p_next = pagy.next)
|
83
|
-
a.(p_next, pagy_t('pagy.next'), classes: 'item', aria_label: pagy_t('pagy.aria_label.next'))
|
84
|
-
else
|
85
|
-
%(<div class="item disabled" role="link" aria-disabled="true" aria=label="#{
|
86
|
-
pagy_t('pagy.aria_label.prev')}">#{pagy_t('pagy.next')}</div>)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|
90
|
-
Frontend.prepend SemanticExtra
|
91
|
-
end
|
data/lib/pagy/extras/uikit.rb
DELETED
@@ -1,96 +0,0 @@
|
|
1
|
-
# See the Pagy documentation: https://ddnexus.github.io/pagy/docs/extras/uikit
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
require 'pagy/extras/js_tools'
|
5
|
-
|
6
|
-
class Pagy # :nodoc:
|
7
|
-
# Frontend modules are specially optimized for performance.
|
8
|
-
# The resulting code may not look very elegant, but produces the best benchmarks
|
9
|
-
module UikitExtra
|
10
|
-
# Pagination for uikit: it returns the html with the series of links to the pages
|
11
|
-
def pagy_uikit_nav(pagy, id: nil, aria_label: nil, **vars)
|
12
|
-
id = %( id="#{id}") if id
|
13
|
-
a = pagy_anchor(pagy)
|
14
|
-
|
15
|
-
html = %(<ul#{id} class="pagy-uikit nav uk-pagination uk-flex-center" role="navigation" #{
|
16
|
-
nav_aria_label(pagy, aria_label:)}>#{
|
17
|
-
uikit_prev_html(pagy, a)})
|
18
|
-
pagy.series(**vars).each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
19
|
-
html << case item
|
20
|
-
when Integer
|
21
|
-
%(<li>#{a.(item)}</li>)
|
22
|
-
when String
|
23
|
-
%(<li class="uk-active"><span role="link" aria-current="page" aria-disabled="true">#{
|
24
|
-
pagy.label_for(item)}</span></li>)
|
25
|
-
when :gap
|
26
|
-
%(<li class="uk-disabled"><span>#{pagy_t 'pagy.gap'}</span></li>)
|
27
|
-
else
|
28
|
-
raise InternalError, "expected item types in series to be Integer, String or :gap; got #{item.inspect}"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
html << %(#{uikit_next_html(pagy, a)}</ul>)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Javascript pagination for uikit: it returns a nav with a data-pagy attribute used by the pagy.js file
|
35
|
-
def pagy_uikit_nav_js(pagy, id: nil, aria_label: nil, **vars)
|
36
|
-
sequels = pagy.sequels(**vars)
|
37
|
-
id = %( id="#{id}") if id
|
38
|
-
a = pagy_anchor(pagy)
|
39
|
-
tokens = { 'before' => uikit_prev_html(pagy, a),
|
40
|
-
'a' => %(<li>#{a.(PAGE_TOKEN, LABEL_TOKEN)}</li>),
|
41
|
-
'current' => %(<li class="uk-active"><span role="link" aria-current="page" aria-disabled="true">#{
|
42
|
-
LABEL_TOKEN}</span></li>),
|
43
|
-
'gap' => %(<li class="uk-disabled"><span>#{pagy_t 'pagy.gap'}</span></li>),
|
44
|
-
'after' => uikit_next_html(pagy, a) }
|
45
|
-
|
46
|
-
%(<ul#{id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-uikit nav-js uk-pagination uk-flex-center" role="navigation" #{
|
47
|
-
nav_aria_label(pagy, aria_label:)} #{
|
48
|
-
pagy_data(pagy, :nav, tokens, sequels, pagy.label_sequels(sequels))
|
49
|
-
}></ul>)
|
50
|
-
end
|
51
|
-
|
52
|
-
# Javascript combo pagination for uikit: it returns a nav with a data-pagy attribute used by the pagy.js file
|
53
|
-
def pagy_uikit_combo_nav_js(pagy, id: nil, aria_label: nil)
|
54
|
-
id = %( id="#{id}") if id
|
55
|
-
a = pagy_anchor(pagy)
|
56
|
-
pages = pagy.pages
|
57
|
-
|
58
|
-
page_input = %(<input name="page" type="number" min="1" max="#{pages}" value="#{pagy.page}" aria-current="page" ) <<
|
59
|
-
%(style="text-align: center; width: #{pages.to_s.length + 1}rem;">)
|
60
|
-
|
61
|
-
%(<ul#{id} class="pagy-uikit combo-nav-js uk-button-group uk-pagination uk-flex-center" role="navigation" #{
|
62
|
-
nav_aria_label(pagy, aria_label:)} #{
|
63
|
-
pagy_data(pagy, :combo, pagy_url_for(pagy, PAGE_TOKEN))
|
64
|
-
}>#{
|
65
|
-
uikit_prev_html(pagy, a)
|
66
|
-
}<li><label>#{
|
67
|
-
pagy_t('pagy.combo_nav_js', page_input:, pages:)
|
68
|
-
}</label></li>#{
|
69
|
-
uikit_next_html(pagy, a)
|
70
|
-
}</ul>)
|
71
|
-
end
|
72
|
-
|
73
|
-
private
|
74
|
-
|
75
|
-
def uikit_prev_html(pagy, a)
|
76
|
-
span = %(<span uk-pagination-previous></span>)
|
77
|
-
if (p_prev = pagy.prev)
|
78
|
-
%(<li>#{a.(p_prev, span, aria_label: pagy_t('pagy.aria_label.prev'))}</li>)
|
79
|
-
else
|
80
|
-
%(<li class="uk-disabled"><a role="link" aria-disabled="true" aria-label="#{
|
81
|
-
pagy_t('pagy.aria_label.prev')}">#{span}</a></li>)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def uikit_next_html(pagy, a)
|
86
|
-
span = %(<span uk-pagination-next></span>)
|
87
|
-
if (p_next = pagy.next)
|
88
|
-
%(<li>#{a.(p_next, span, aria_label: pagy_t('pagy.aria_label.prev'))}</li>)
|
89
|
-
else
|
90
|
-
%(<li class="uk-disabled"><a role="link" aria-disabled="true" aria-label="#{
|
91
|
-
pagy_t('pagy.aria_label.next')}">#{span}</a></li>)
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
Frontend.include UikitExtra
|
96
|
-
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|