pagy 8.6.3 → 9.0.1
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 +1 -1
- data/apps/demo.ru +4 -4
- data/apps/keyset_ar.ru +236 -0
- data/apps/keyset_s.ru +238 -0
- data/apps/rails.ru +5 -5
- data/apps/repro.ru +4 -4
- 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 -1
- data/apps/tmp/{pagy-keyset.sqlite3 → pagy-keyset-ar.sqlite3} +0 -0
- data/apps/tmp/{pagy-keyset.sqlite3-shm → 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/bin/pagy +4 -2
- data/config/pagy.rb +13 -13
- data/javascripts/pagy.min.js +2 -2
- data/javascripts/pagy.min.js.map +2 -2
- data/javascripts/pagy.mjs +2 -2
- data/lib/pagy/b64.rb +33 -0
- data/lib/pagy/backend.rb +21 -17
- data/lib/pagy/calendar/day.rb +1 -1
- data/lib/pagy/calendar/month.rb +1 -1
- data/lib/pagy/calendar/quarter.rb +1 -1
- data/lib/pagy/calendar/unit.rb +7 -10
- data/lib/pagy/calendar/week.rb +1 -1
- data/lib/pagy/calendar/year.rb +1 -1
- data/lib/pagy/calendar.rb +5 -5
- data/lib/pagy/countless.rb +10 -14
- data/lib/pagy/extras/arel.rb +8 -10
- data/lib/pagy/extras/array.rb +4 -6
- data/lib/pagy/extras/bootstrap.rb +5 -5
- data/lib/pagy/extras/bulma.rb +10 -7
- data/lib/pagy/extras/calendar.rb +4 -5
- data/lib/pagy/extras/countless.rb +15 -13
- data/lib/pagy/extras/elasticsearch_rails.rb +15 -15
- data/lib/pagy/extras/gearbox.rb +18 -18
- data/lib/pagy/extras/headers.rb +25 -24
- data/lib/pagy/extras/js_tools.rb +4 -4
- data/lib/pagy/extras/jsonapi.rb +26 -16
- 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 +2 -2
- data/lib/pagy/extras/overflow.rb +5 -5
- data/lib/pagy/extras/pagy.rb +16 -16
- data/lib/pagy/extras/searchkick.rb +11 -11
- data/lib/pagy/extras/size.rb +1 -1
- data/lib/pagy/extras/standalone.rb +6 -6
- data/lib/pagy/extras/trim.rb +2 -2
- data/lib/pagy/frontend.rb +32 -33
- 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 +97 -0
- data/lib/pagy/url_helpers.rb +5 -5
- data/lib/pagy.rb +73 -65
- data/locales/ar.yml +1 -1
- data/locales/be.yml +1 -1
- data/locales/bg.yml +1 -1
- data/locales/bs.yml +1 -1
- data/locales/ca.yml +1 -1
- data/locales/ckb.yml +1 -1
- data/locales/cs.yml +1 -1
- data/locales/da.yml +1 -1
- data/locales/de.yml +1 -1
- data/locales/en.yml +1 -1
- data/locales/es.yml +1 -1
- data/locales/fr.yml +1 -1
- data/locales/hr.yml +1 -1
- data/locales/id.yml +1 -1
- data/locales/it.yml +1 -1
- data/locales/ja.yml +1 -1
- data/locales/km.yml +1 -1
- data/locales/ko.yml +1 -1
- data/locales/nb.yml +1 -1
- data/locales/nl.yml +1 -1
- data/locales/nn.yml +1 -1
- data/locales/pl.yml +1 -1
- data/locales/pt-BR.yml +1 -1
- data/locales/pt.yml +1 -1
- data/locales/ru.yml +1 -1
- data/locales/sr.yml +1 -1
- data/locales/sv-SE.yml +1 -1
- data/locales/sv.yml +1 -1
- data/locales/sw.yml +1 -1
- data/locales/ta.yml +1 -1
- data/locales/tr.yml +1 -1
- data/locales/uk.yml +1 -1
- data/locales/vi.yml +1 -1
- data/locales/zh-CN.yml +1 -1
- data/locales/zh-HK.yml +1 -1
- data/locales/zh-TW.yml +1 -1
- metadata +15 -18
- data/apps/tmp/pagy-keyset.sqlite3-wal +0 -0
- data/lib/pagy/extras/foundation.rb +0 -95
- data/lib/pagy/extras/items.rb +0 -64
- data/lib/pagy/extras/materialize.rb +0 -100
- data/lib/pagy/extras/semantic.rb +0 -94
- data/lib/pagy/extras/uikit.rb +0 -98
data/lib/pagy/extras/uikit.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
warn '[PAGY WARNING] The uikit extra has been discontinued and it will be removed in v9 ' \
|
4
|
-
'(https://github.com/ddnexus/pagy/discussions/672#discussioncomment-9212328)'
|
5
|
-
|
6
|
-
require_relative 'js_tools'
|
7
|
-
|
8
|
-
class Pagy # :nodoc:
|
9
|
-
# Frontend modules are specially optimized for performance.
|
10
|
-
# The resulting code may not look very elegant, but produces the best benchmarks
|
11
|
-
module UikitExtra
|
12
|
-
# Pagination for uikit: it returns the html with the series of links to the pages
|
13
|
-
def pagy_uikit_nav(pagy, id: nil, aria_label: nil, **vars)
|
14
|
-
id = %( id="#{id}") if id
|
15
|
-
a = pagy_anchor(pagy)
|
16
|
-
|
17
|
-
html = %(<ul#{id} class="pagy-uikit nav uk-pagination uk-flex-center" role="navigation" #{
|
18
|
-
nav_aria_label(pagy, aria_label:)}>#{
|
19
|
-
uikit_prev_html(pagy, a)})
|
20
|
-
pagy.series(**vars).each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
21
|
-
html << case item
|
22
|
-
when Integer
|
23
|
-
%(<li>#{a.(item)}</li>)
|
24
|
-
when String
|
25
|
-
%(<li class="uk-active"><span role="link" aria-current="page" aria-disabled="true">#{
|
26
|
-
pagy.label_for(item)}</span></li>)
|
27
|
-
when :gap
|
28
|
-
%(<li class="uk-disabled"><span>#{pagy_t 'pagy.gap'}</span></li>)
|
29
|
-
else
|
30
|
-
raise InternalError, "expected item types in series to be Integer, String or :gap; got #{item.inspect}"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
html << %(#{uikit_next_html(pagy, a)}</ul>)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Javascript pagination for uikit: it returns a nav with a data-pagy attribute used by the pagy.js file
|
37
|
-
def pagy_uikit_nav_js(pagy, id: nil, aria_label: nil, **vars)
|
38
|
-
sequels = pagy.sequels(**vars)
|
39
|
-
id = %( id="#{id}") if id
|
40
|
-
a = pagy_anchor(pagy)
|
41
|
-
tokens = { 'before' => uikit_prev_html(pagy, a),
|
42
|
-
'a' => %(<li>#{a.(PAGE_TOKEN, LABEL_TOKEN)}</li>),
|
43
|
-
'current' => %(<li class="uk-active"><span role="link" aria-current="page" aria-disabled="true">#{
|
44
|
-
LABEL_TOKEN}</span></li>),
|
45
|
-
'gap' => %(<li class="uk-disabled"><span>#{pagy_t 'pagy.gap'}</span></li>),
|
46
|
-
'after' => uikit_next_html(pagy, a) }
|
47
|
-
|
48
|
-
%(<ul#{id} class="#{'pagy-rjs ' if sequels.size > 1}pagy-uikit nav-js uk-pagination uk-flex-center" role="navigation" #{
|
49
|
-
nav_aria_label(pagy, aria_label:)} #{
|
50
|
-
pagy_data(pagy, :nav, tokens, sequels, pagy.label_sequels(sequels))
|
51
|
-
}></ul>)
|
52
|
-
end
|
53
|
-
|
54
|
-
# Javascript combo pagination for uikit: it returns a nav with a data-pagy attribute used by the pagy.js file
|
55
|
-
def pagy_uikit_combo_nav_js(pagy, id: nil, aria_label: nil)
|
56
|
-
id = %( id="#{id}") if id
|
57
|
-
a = pagy_anchor(pagy)
|
58
|
-
pages = pagy.pages
|
59
|
-
|
60
|
-
page_input = %(<input name="page" type="number" min="1" max="#{pages}" value="#{pagy.page}" aria-current="page" ) <<
|
61
|
-
%(style="text-align: center; width: #{pages.to_s.length + 1}rem;">#{JSTools::A_TAG})
|
62
|
-
|
63
|
-
%(<ul#{id} class="pagy-uikit combo-nav-js uk-button-group uk-pagination uk-flex-center" role="navigation" #{
|
64
|
-
nav_aria_label(pagy, aria_label:)} #{
|
65
|
-
pagy_data(pagy, :combo, pagy_url_for(pagy, PAGE_TOKEN))
|
66
|
-
}>#{
|
67
|
-
uikit_prev_html(pagy, a)
|
68
|
-
}<li><label>#{
|
69
|
-
pagy_t('pagy.combo_nav_js', page_input:, pages:)
|
70
|
-
}</label></li>#{
|
71
|
-
uikit_next_html(pagy, a)
|
72
|
-
}</ul>)
|
73
|
-
end
|
74
|
-
|
75
|
-
private
|
76
|
-
|
77
|
-
def uikit_prev_html(pagy, a)
|
78
|
-
span = %(<span uk-pagination-previous></span>)
|
79
|
-
if (p_prev = pagy.prev)
|
80
|
-
%(<li>#{a.(p_prev, span, aria_label: pagy_t('pagy.aria_label.prev'))}</li>)
|
81
|
-
else
|
82
|
-
%(<li class="uk-disabled"><a role="link" aria-disabled="true" aria-label="#{
|
83
|
-
pagy_t('pagy.aria_label.prev')}">#{span}</a></li>)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def uikit_next_html(pagy, a)
|
88
|
-
span = %(<span uk-pagination-next></span>)
|
89
|
-
if (p_next = pagy.next)
|
90
|
-
%(<li>#{a.(p_next, span, aria_label: pagy_t('pagy.aria_label.prev'))}</li>)
|
91
|
-
else
|
92
|
-
%(<li class="uk-disabled"><a role="link" aria-disabled="true" aria-label="#{
|
93
|
-
pagy_t('pagy.aria_label.next')}">#{span}</a></li>)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
Frontend.include UikitExtra
|
98
|
-
end
|