pagy 3.3.1 → 3.5.1
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 +13 -1
- data/lib/javascripts/pagy.js +18 -15
- data/lib/locales/ca.yml +22 -0
- data/lib/locales/ko.yml +20 -0
- data/lib/locales/utils/p11n.rb +1 -0
- data/lib/pagy.rb +1 -1
- data/lib/pagy/extras/elasticsearch_rails.rb +11 -9
- data/lib/pagy/extras/metadata.rb +37 -0
- data/lib/pagy/extras/pagy_search.rb +4 -2
- data/lib/pagy/extras/searchkick.rb +8 -8
- data/lib/pagy/extras/uikit.rb +62 -0
- data/lib/templates/uikit_nav.html.erb +15 -0
- data/lib/templates/uikit_nav.html.haml +28 -0
- data/lib/templates/uikit_nav.html.slim +28 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d5bc9d035a9a4d9f5f807a6e95cdad150a705ab17df7fc964ea3103614a7a7d
|
4
|
+
data.tar.gz: 6cee7bf4ccb841d55b1d38619f4cac613f765f8040fbe2162e2cf1ec99e84655
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 883c2262141419d5f1e1270ef6a443bfce351c54fa1a893a477dc8dfd00ab0af1b75c7f8670e26a1a73a406723006a1ac23667a2ba9b652390eab5b46e5964d9
|
7
|
+
data.tar.gz: cdb1bd1461caf095f22407eab5de315d306dbdfb1f2cc2a733f811c92f5fdef475f1995264317e32ec8d775a019e46757b801426b8f4f7c160ff4eb9bbad799e
|
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.5.1)
|
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
|
|
@@ -58,6 +58,10 @@
|
|
58
58
|
# See https://ddnexus.github.io/pagy/extras/semantic
|
59
59
|
# require 'pagy/extras/semantic'
|
60
60
|
|
61
|
+
# UIkit extra: Add nav helper and templates for UIkit pagination
|
62
|
+
# See https://ddnexus.github.io/pagy/extras/uikit
|
63
|
+
# require 'pagy/extras/uikit'
|
64
|
+
|
61
65
|
# Multi size var used by the *_nav_js helpers
|
62
66
|
# See https://ddnexus.github.io/pagy/extras/navs#steps
|
63
67
|
# Pagy::VARS[:steps] = { 0 => [2,3,3,2], 540 => [3,5,5,3], 720 => [5,7,7,5] } # example
|
@@ -85,6 +89,14 @@
|
|
85
89
|
# require 'pagy/extras/overflow'
|
86
90
|
# Pagy::VARS[:overflow] = :empty_page # default (other options: :last_page and :exception)
|
87
91
|
|
92
|
+
# Metadata extra: Provides the pagination metadata to Javascript frameworks like Vue.js, react.js, etc.
|
93
|
+
# See https://ddnexus.github.io/pagy/extras/metadata
|
94
|
+
# you must require the shared internal extra (BEFORE the metadata extra) ONLY if you need also the :sequels
|
95
|
+
# require 'pagy/extras/shared'
|
96
|
+
# require 'pagy/extras/metadata'
|
97
|
+
# For performance reason, you should explicitly set ONLY the metadata you use in the frontend
|
98
|
+
# Pagy::VARS[:metadata] = [:scaffold_url, :count, :page, :prev, :next, :last] # example
|
99
|
+
|
88
100
|
# Trim extra: Remove the page=1 param from links
|
89
101
|
# See https://ddnexus.github.io/pagy/extras/trim
|
90
102
|
# require 'pagy/extras/trim'
|
data/lib/javascripts/pagy.js
CHANGED
@@ -2,9 +2,15 @@
|
|
2
2
|
|
3
3
|
function Pagy(){}
|
4
4
|
|
5
|
+
Pagy.version = '3.5.1';
|
6
|
+
|
5
7
|
Pagy.init = function(arg){
|
6
8
|
var target = arg instanceof Event || arg === undefined ? document : arg,
|
7
9
|
jsonTags = target.getElementsByClassName('pagy-json');
|
10
|
+
if (target === document) { // reset resize-listeners on page load (#163)
|
11
|
+
for (var id in Pagy.navResizeListeners) { window.removeEventListener('resize', Pagy.navResizeListeners[id], true) }
|
12
|
+
Pagy.navResizeListeners = {};
|
13
|
+
}
|
8
14
|
for (var i = 0, len = jsonTags.length; i < len; i++) {
|
9
15
|
var args = JSON.parse(jsonTags[i].innerHTML);
|
10
16
|
Pagy[args.shift()].apply(null, args);
|
@@ -13,19 +19,20 @@ Pagy.init = function(arg){
|
|
13
19
|
|
14
20
|
Pagy.nav = function(id, tags, sequels, param){
|
15
21
|
var pagyEl = document.getElementById(id),
|
16
|
-
container = pagyEl.parentElement,
|
17
22
|
lastWidth = undefined,
|
18
23
|
timeoutId = 0,
|
19
24
|
pageREg = new RegExp(/__pagy_page__/g),
|
20
|
-
widths = []
|
25
|
+
widths = [],
|
26
|
+
rendering = function(){ clearTimeout(timeoutId); timeoutId = setTimeout(pagyEl.render, 150) }; // suppress rapid firing rendering
|
27
|
+
|
21
28
|
for (var width in sequels) { widths.push(parseInt(width)) } // fine with sequels structure
|
22
29
|
widths.sort(function(a, b){return b-a});
|
23
30
|
|
24
|
-
|
25
|
-
if (
|
31
|
+
pagyEl.render = function(){
|
32
|
+
if (this.parentElement.clientWidth === 0) { rendering() }
|
26
33
|
var width, i, len;
|
27
34
|
for (i = 0, len = widths.length; i < len; i++) {
|
28
|
-
if (
|
35
|
+
if (this.parentElement.clientWidth > widths[i]) { width = widths[i]; break }
|
29
36
|
}
|
30
37
|
if (width !== lastWidth) {
|
31
38
|
var html = tags.before,
|
@@ -38,21 +45,19 @@ Pagy.nav = function(id, tags, sequels, param){
|
|
38
45
|
else if (typeof(item) === 'string') { html += tags.active.replace(pageREg, item) }
|
39
46
|
}
|
40
47
|
html += tags.after;
|
41
|
-
|
42
|
-
|
48
|
+
this.innerHTML = '';
|
49
|
+
this.insertAdjacentHTML('afterbegin', html);
|
43
50
|
lastWidth = width;
|
44
51
|
}
|
45
|
-
}
|
46
|
-
// suppress rapid firing rendering
|
47
|
-
rendering = function(){ clearTimeout(timeoutId); timeoutId = setTimeout(render, 150) };
|
52
|
+
}.bind(pagyEl);
|
48
53
|
|
49
54
|
if (widths.length > 1) {
|
50
55
|
// refresh the window resize listener (avoiding rendering multiple times)
|
51
|
-
window.removeEventListener('resize', Pagy.
|
56
|
+
window.removeEventListener('resize', Pagy.navResizeListeners[id], true); // needed for AJAX init
|
52
57
|
window.addEventListener('resize', rendering, true);
|
53
|
-
Pagy.
|
58
|
+
Pagy.navResizeListeners[id] = rendering;
|
54
59
|
}
|
55
|
-
render();
|
60
|
+
pagyEl.render();
|
56
61
|
};
|
57
62
|
|
58
63
|
Pagy.combo_nav = function(id, page, link, param){
|
@@ -86,8 +91,6 @@ Pagy.items_selector = function(id, from, link, param){
|
|
86
91
|
Pagy.addInputEventListeners(input, go);
|
87
92
|
};
|
88
93
|
|
89
|
-
Pagy.windowListeners = {};
|
90
|
-
|
91
94
|
Pagy.addInputEventListeners = function(input, handler){
|
92
95
|
// select the content on click: easier for typing a number
|
93
96
|
input.addEventListener('click', function(){ this.select() });
|
data/lib/locales/ca.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
|
+
ca:
|
4
|
+
pagy:
|
5
|
+
|
6
|
+
item_name:
|
7
|
+
one: "element"
|
8
|
+
other: "elements"
|
9
|
+
|
10
|
+
nav:
|
11
|
+
prev: "‹ Anterior"
|
12
|
+
next: "Següent ›"
|
13
|
+
gap: "…"
|
14
|
+
|
15
|
+
info:
|
16
|
+
no_items: "No s'ha trobat cap resultat"
|
17
|
+
single_page: "Mostrant <b>%{count}</b> %{item_name}"
|
18
|
+
multiple_pages: "Mostrant %{item_name} <b>%{from}-%{to}</b> de <b>%{count}</b> en total"
|
19
|
+
|
20
|
+
combo_nav_js: "Pàgina %{page_input} de %{pages}"
|
21
|
+
|
22
|
+
items_selector_js: "Mostra %{items_input} %{item_name} per pàgina"
|
data/lib/locales/ko.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# :other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
|
2
|
+
|
3
|
+
ko:
|
4
|
+
pagy:
|
5
|
+
|
6
|
+
item_name: "항목"
|
7
|
+
|
8
|
+
nav:
|
9
|
+
prev: "‹ 이전"
|
10
|
+
next: "이후 ›"
|
11
|
+
gap: "…"
|
12
|
+
|
13
|
+
info:
|
14
|
+
no_items: "%{item_name} 없음"
|
15
|
+
single_page: "<b>%{count}</b>개의 %{item_name} 표시됨"
|
16
|
+
multiple_pages: "총 <b>%{count}</b>개의 %{item_name} 중 <b>%{from}-%{to}</b>"
|
17
|
+
|
18
|
+
combo_nav_js: "총 %{pages} 중 %{page_input} 페이지"
|
19
|
+
|
20
|
+
items_selector_js: "페이지 당 %{items_input}개 표시%"
|
data/lib/locales/utils/p11n.rb
CHANGED
@@ -63,6 +63,7 @@ plurals = Hash.new(p11n[:one_other]).tap do |hash|
|
|
63
63
|
hash['id'] = p11n[:other]
|
64
64
|
hash['fr'] = p11n[:one_upto_two_other]
|
65
65
|
hash['ja'] = p11n[:other]
|
66
|
+
hash['ko'] = p11n[:other]
|
66
67
|
hash['pl'] = p11n[:polish]
|
67
68
|
hash['ru'] = p11n[:east_slavic]
|
68
69
|
hash['se'] = p11n[:one_two_other]
|
data/lib/pagy.rb
CHANGED
@@ -13,7 +13,8 @@ class Pagy
|
|
13
13
|
def self.new_from_elasticsearch_rails(response, vars={})
|
14
14
|
vars[:items] = response.search.options[:size] || 10
|
15
15
|
vars[:page] = (response.search.options[:from] || 0) / vars[:items] + 1
|
16
|
-
|
16
|
+
total = response.raw_response['hits']['total']
|
17
|
+
vars[:count] = total.is_a?(Hash) ? total['value'] : total
|
17
18
|
new(vars)
|
18
19
|
end
|
19
20
|
|
@@ -21,17 +22,18 @@ class Pagy
|
|
21
22
|
module Backend ; private
|
22
23
|
|
23
24
|
# Return Pagy object and items
|
24
|
-
def pagy_elasticsearch_rails(
|
25
|
-
model,
|
26
|
-
vars
|
27
|
-
|
28
|
-
|
29
|
-
response
|
30
|
-
|
25
|
+
def pagy_elasticsearch_rails(pagy_search_args, vars={})
|
26
|
+
model, search_args, _block, *called = pagy_search_args
|
27
|
+
vars = pagy_elasticsearch_rails_get_vars(nil, vars)
|
28
|
+
search_args[-1][:size] = vars[:items]
|
29
|
+
search_args[-1][:from] = vars[:items] * (vars[:page] - 1)
|
30
|
+
response = model.search(*search_args)
|
31
|
+
total = response.raw_response['hits']['total']
|
32
|
+
vars[:count] = total.is_a?(Hash) ? total['value'] : total
|
31
33
|
pagy = Pagy.new(vars)
|
32
34
|
# with :last_page overflow we need to re-run the method in order to get the hits
|
33
35
|
if defined?(OVERFLOW) && pagy.overflow? && pagy.vars[:overflow] == :last_page
|
34
|
-
return pagy_elasticsearch_rails(
|
36
|
+
return pagy_elasticsearch_rails(pagy_search_args, vars.merge(page: pagy.page))
|
35
37
|
end
|
36
38
|
return pagy, called.empty? ? response : response.send(*called)
|
37
39
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/metadata
|
2
|
+
# encoding: utf-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
class Pagy
|
6
|
+
# Add a specialized backend method for pagination metadata
|
7
|
+
module Backend ; private
|
8
|
+
|
9
|
+
METADATA = [ :scaffold_url, :first_url, :prev_url, :page_url, :next_url, :last_url,
|
10
|
+
:count, :page, :items, :vars, :pages, :last, :from, :to, :prev, :next, :series ]
|
11
|
+
METADATA << :sequels if VARS.key?(:steps) # :steps gets defined along with the #sequels method
|
12
|
+
|
13
|
+
VARS[:metadata] = METADATA.dup
|
14
|
+
|
15
|
+
include Helpers
|
16
|
+
|
17
|
+
def pagy_metadata(pagy, url=false)
|
18
|
+
names = pagy.vars[:metadata]
|
19
|
+
(unknown = names - METADATA).empty? or raise(VariableError.new(pagy), "unknown metadata #{unknown.inspect}")
|
20
|
+
scaffold_url = pagy_url_for(Frontend::MARK, pagy, url)
|
21
|
+
metadata = {}
|
22
|
+
names.each do |key|
|
23
|
+
metadata[key] = case key
|
24
|
+
when :scaffold_url ; scaffold_url
|
25
|
+
when :first_url ; scaffold_url.sub(Frontend::MARK, 1.to_s)
|
26
|
+
when :prev_url ; scaffold_url.sub(Frontend::MARK, pagy.prev.to_s)
|
27
|
+
when :page_url ; scaffold_url.sub(Frontend::MARK, pagy.page.to_s)
|
28
|
+
when :next_url ; scaffold_url.sub(Frontend::MARK, pagy.next.to_s)
|
29
|
+
when :last_url ; scaffold_url.sub(Frontend::MARK, pagy.last.to_s)
|
30
|
+
else pagy.send(key)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
metadata
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
@@ -7,8 +7,10 @@ class Pagy
|
|
7
7
|
# returns an array used to delay the call of #search
|
8
8
|
# after the pagination variables are merged to the options
|
9
9
|
# it also pushes to the same array an eventually called method and arguments
|
10
|
-
|
11
|
-
|
10
|
+
# the last search argument must be a hash option
|
11
|
+
def pagy_search(*search_args, &block)
|
12
|
+
search_args << {} unless search_args[-1].is_a?(Hash)
|
13
|
+
[self, search_args, block].tap do |args|
|
12
14
|
args.define_singleton_method(:method_missing){|*a| args += a}
|
13
15
|
end
|
14
16
|
end
|
@@ -21,17 +21,17 @@ class Pagy
|
|
21
21
|
module Backend ; private
|
22
22
|
|
23
23
|
# Return Pagy object and results
|
24
|
-
def pagy_searchkick(
|
25
|
-
model,
|
26
|
-
vars
|
27
|
-
|
28
|
-
|
29
|
-
results
|
30
|
-
vars[:count]
|
24
|
+
def pagy_searchkick(pagy_search_args, vars={})
|
25
|
+
model, search_args, block, *called = pagy_search_args
|
26
|
+
vars = pagy_searchkick_get_vars(nil, vars)
|
27
|
+
search_args[-1][:per_page] = vars[:items]
|
28
|
+
search_args[-1][:page] = vars[:page]
|
29
|
+
results = model.search(*search_args, &block)
|
30
|
+
vars[:count] = results.total_count
|
31
31
|
pagy = Pagy.new(vars)
|
32
32
|
# with :last_page overflow we need to re-run the method in order to get the hits
|
33
33
|
if defined?(OVERFLOW) && pagy.overflow? && pagy.vars[:overflow] == :last_page
|
34
|
-
return pagy_searchkick(
|
34
|
+
return pagy_searchkick(pagy_search_args, vars.merge(page: pagy.page))
|
35
35
|
end
|
36
36
|
return pagy, called.empty? ? results : results.send(*called)
|
37
37
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/uikit
|
2
|
+
# encoding: utf-8
|
3
|
+
# frozen_string_literal: true
|
4
|
+
|
5
|
+
require 'pagy/extras/shared'
|
6
|
+
|
7
|
+
class Pagy
|
8
|
+
module Frontend
|
9
|
+
|
10
|
+
# Pagination for uikit: it returns the html with the series of links to the pages
|
11
|
+
def pagy_uikit_nav(pagy)
|
12
|
+
link, p_prev, p_next = pagy_link_proc(pagy), pagy.prev, pagy.next
|
13
|
+
|
14
|
+
previous_span = "<span uk-pagination-previous>#{pagy_t('pagy.nav.prev')}</span>"
|
15
|
+
html = EMPTY + (p_prev ? %(<li>#{link.call p_prev, previous_span}</li>)
|
16
|
+
: %(<li class="uk-disabled"><a href="#">#{previous_span}</a></li>))
|
17
|
+
pagy.series.each do |item|
|
18
|
+
html << if item.is_a?(Integer); %(<li>#{link.call item}</li>)
|
19
|
+
elsif item.is_a?(String) ; %(<li class="uk-active"><span>#{item}</span></li>)
|
20
|
+
elsif item == :gap ; %(<li class="uk-disabled"><span>#{pagy_t('pagy.nav.gap')}</span></li>)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
next_span = "<span uk-pagination-next>#{pagy_t('pagy.nav.next')}</span>"
|
24
|
+
html << (p_next ? %(<li>#{link.call p_next, next_span}</li>)
|
25
|
+
: %(<li class="uk-disabled"><a href="#">#{next_span}</a></li>))
|
26
|
+
%(<ul class="pagy-uikit-nav uk-pagination uk-flex-center">#{html}</ul>)
|
27
|
+
end
|
28
|
+
|
29
|
+
# 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, id=pagy_id)
|
31
|
+
link, p_prev, p_next = pagy_link_proc(pagy), pagy.prev, pagy.next
|
32
|
+
previous_span = "<span uk-pagination-previous>#{pagy_t('pagy.nav.prev')}</span>"
|
33
|
+
next_span = "<span uk-pagination-next>#{pagy_t('pagy.nav.next')}</span>"
|
34
|
+
tags = { 'before' => p_prev ? %(<li>#{link.call p_prev, previous_span}</li>)
|
35
|
+
: %(<li class="uk-disabled"><a href="#">#{previous_span}</a></li>),
|
36
|
+
'link' => %(<li>#{link.call(MARK)}</li>),
|
37
|
+
'active' => %(<li class="uk-active"><span>#{MARK}</span></li>),
|
38
|
+
'gap' => %(<li class="uk-disabled"><span>#{pagy_t('pagy.nav.gap')}</span></li>),
|
39
|
+
'after' => p_next ? %(<li>#{link.call p_next, next_span}</li>)
|
40
|
+
: %(<li class="uk-disabled"><a href="#">#{next_span}</a></li>) }
|
41
|
+
%(<ul id="#{id}" class="pagy-uikit-nav-js uk-pagination uk-flex-center"></ul>#{pagy_json_tag(:nav, id, tags, pagy.sequels, defined?(TRIM) && pagy.vars[:page_param])})
|
42
|
+
end
|
43
|
+
|
44
|
+
# 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, id=pagy_id)
|
46
|
+
link, p_prev, p_next, p_page, p_pages = pagy_link_proc(pagy), pagy.prev, pagy.next, pagy.page, pagy.pages
|
47
|
+
|
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
|
+
|
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
|
+
|
56
|
+
html << (p_next ? link.call(p_next, pagy_t('pagy.nav.next'), 'class="uk-button uk-button-default"')
|
57
|
+
: %(<button class="uk-button uk-button-default" disabled>#{pagy_t('pagy.nav.next')}</button>))
|
58
|
+
|
59
|
+
html << %(</div>#{pagy_json_tag(:combo_nav, id, p_page, pagy_marked_link(link), defined?(TRIM) && pagy.vars[:page_param])})
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% link = pagy_link_proc(pagy) -%>
|
2
|
+
<%# -%> <ul class="uk-pagination uk-flex-center">
|
3
|
+
<% if page.prev -%> <li><%== link.call(pagy.prev, "<span uk-pagination-previous>#{pagy_t('pagy.nav.prev')}</span>") %></li>
|
4
|
+
<% else -%> <li class="uk-disabled"><a href="#"><span uk-pagination-previous><%== pagy_t('pagy.nav.prev') %></span></a></li>
|
5
|
+
<% end -%>
|
6
|
+
<% pagy.series.each do |item| -%>
|
7
|
+
<% if item.is_a?(Integer) -%> <li><%== link.call(item) %></li>
|
8
|
+
<% elsif item.is_a?(String) -%> <li class="uk-active"><span><%== item %></span></li>
|
9
|
+
<% elsif item == :gap -%> <li class="uk-disabled"><span><%== pagy_t('pagy.nav.gap') %></span></li>
|
10
|
+
<% end -%>
|
11
|
+
<% end -%>
|
12
|
+
<% if pagy.next -%> <li><%== link.call(p_next, "<span uk-pagination-next>#{pagy_t('pagy.nav.next')}</span>") %></li>
|
13
|
+
<% else -%> <li class="uk-disabled"><a href="#"><span uk-pagination-next><%== pagy_t('pagy.nav.next') %></span></a></li>
|
14
|
+
<% end -%>
|
15
|
+
<%# -%> </ul>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
- link = pagy_link_proc(pagy)
|
2
|
+
|
3
|
+
%ul.uk-pagination.uk-flex-center
|
4
|
+
- if page.prev
|
5
|
+
%li!= link.call(pagy.prev, "<span uk-pagination-previous>#{pagy_t('pagy.nav.prev')}</span>")
|
6
|
+
- else
|
7
|
+
%li.uk-disabled
|
8
|
+
%a{href: "#"}
|
9
|
+
%span{"uk-pagination-previous" => ""}!= pagy_t('pagy.nav.prev')
|
10
|
+
|
11
|
+
- pagy.series.each do |item|
|
12
|
+
- if item.is_a?(Integer)
|
13
|
+
%li!= link.call(item)
|
14
|
+
|
15
|
+
- elsif item.is_a?(String)
|
16
|
+
%li.uk-active
|
17
|
+
%span!= item
|
18
|
+
|
19
|
+
- elsif item == :gap
|
20
|
+
%li.uk-disabled
|
21
|
+
%span!= pagy_t('pagy.nav.gap')
|
22
|
+
|
23
|
+
- if pagy.next
|
24
|
+
%li!= link.call(p_next, "<span uk-pagination-next>#{pagy_t('pagy.nav.next')}</span>")
|
25
|
+
- else
|
26
|
+
%li.uk-disabled
|
27
|
+
%a{href: "#"}
|
28
|
+
%span{"uk-pagination-next" => ""}!= pagy_t('pagy.nav.next')
|
@@ -0,0 +1,28 @@
|
|
1
|
+
- link = pagy_link_proc(pagy)
|
2
|
+
|
3
|
+
ul.uk-pagination.uk-flex-center
|
4
|
+
- if page.prev
|
5
|
+
li== link.call(pagy.prev, "<span uk-pagination-previous>#{pagy_t('pagy.nav.prev')}</span>")
|
6
|
+
- else
|
7
|
+
li.uk-disabled
|
8
|
+
a href="#"
|
9
|
+
span uk-pagination-previous="" == pagy_t('pagy.nav.prev')
|
10
|
+
|
11
|
+
- pagy.series.each do |item|
|
12
|
+
- if item.is_a?(Integer)
|
13
|
+
li== link.call(item)
|
14
|
+
|
15
|
+
- elsif item.is_a?(String)
|
16
|
+
li.uk-active
|
17
|
+
span== item
|
18
|
+
|
19
|
+
- elsif item == :gap
|
20
|
+
li.uk-disabled
|
21
|
+
span== pagy_t('pagy.nav.gap')
|
22
|
+
|
23
|
+
- if pagy.next
|
24
|
+
li== link.call(p_next, "<span uk-pagination-next>#{pagy_t('pagy.nav.next')}</span>")
|
25
|
+
- else
|
26
|
+
li.uk-disabled
|
27
|
+
a href="#"
|
28
|
+
span uk-pagination-next="" == pagy_t('pagy.nav.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: 3.
|
4
|
+
version: 3.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Domizio Demichelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-31 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,
|
@@ -24,12 +24,14 @@ files:
|
|
24
24
|
- lib/javascripts/pagy.js
|
25
25
|
- lib/locales/README.md
|
26
26
|
- lib/locales/bg.yml
|
27
|
+
- lib/locales/ca.yml
|
27
28
|
- lib/locales/de.yml
|
28
29
|
- lib/locales/en.yml
|
29
30
|
- lib/locales/es.yml
|
30
31
|
- lib/locales/fr.yml
|
31
32
|
- lib/locales/id.yml
|
32
33
|
- lib/locales/ja.yml
|
34
|
+
- lib/locales/ko.yml
|
33
35
|
- lib/locales/nb.yml
|
34
36
|
- lib/locales/nl.yml
|
35
37
|
- lib/locales/pl.yml
|
@@ -57,6 +59,7 @@ files:
|
|
57
59
|
- lib/pagy/extras/i18n.rb
|
58
60
|
- lib/pagy/extras/items.rb
|
59
61
|
- lib/pagy/extras/materialize.rb
|
62
|
+
- lib/pagy/extras/metadata.rb
|
60
63
|
- lib/pagy/extras/navs.rb
|
61
64
|
- lib/pagy/extras/overflow.rb
|
62
65
|
- lib/pagy/extras/pagy_search.rb
|
@@ -65,6 +68,7 @@ files:
|
|
65
68
|
- lib/pagy/extras/shared.rb
|
66
69
|
- lib/pagy/extras/support.rb
|
67
70
|
- lib/pagy/extras/trim.rb
|
71
|
+
- lib/pagy/extras/uikit.rb
|
68
72
|
- lib/pagy/frontend.rb
|
69
73
|
- lib/templates/bootstrap_nav.html.erb
|
70
74
|
- lib/templates/bootstrap_nav.html.haml
|
@@ -78,6 +82,9 @@ files:
|
|
78
82
|
- lib/templates/nav.html.erb
|
79
83
|
- lib/templates/nav.html.haml
|
80
84
|
- lib/templates/nav.html.slim
|
85
|
+
- lib/templates/uikit_nav.html.erb
|
86
|
+
- lib/templates/uikit_nav.html.haml
|
87
|
+
- lib/templates/uikit_nav.html.slim
|
81
88
|
- pagy.gemspec
|
82
89
|
homepage: https://github.com/ddnexus/pagy
|
83
90
|
licenses:
|