pagy 4.7.1 → 4.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/lib/config/pagy.rb +1 -1
- data/lib/javascripts/pagy.js +1 -1
- data/lib/pagy.rb +1 -1
- data/lib/pagy/exceptions.rb +3 -1
- data/lib/pagy/extras/bulma.rb +1 -1
- data/lib/pagy/extras/headers.rb +2 -2
- data/lib/pagy/extras/i18n.rb +3 -1
- data/lib/pagy/extras/items.rb +1 -1
- data/lib/pagy/extras/overflow.rb +3 -1
- data/lib/pagy/extras/standalone.rb +5 -1
- data/lib/pagy/extras/trim.rb +1 -1
- data/lib/pagy/extras/uikit.rb +1 -1
- data/lib/pagy/frontend.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 487fac817e4547394310b019c71487100912f052b625708349f85bbae35d4ff4
|
4
|
+
data.tar.gz: 8965c695260c137926ff3cbaf1dbded460bb89cdeb95885af10e083ee61cdf89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b51db8c041d553a42248e503ed2824056dcd582d6b805cc531d741208e47ba812fc086a4783ef4b1f8f5140788d3bda179740cc7341427a8708de44f5f0bb51
|
7
|
+
data.tar.gz: 052426c9f52caa3727bfd967f60b2a861379e95ef49f0074c61c6c1ee4369ec01e2b6fbc73f2ec4d57f2b4125da522f13a76ef5efea779892aaef11a874c290a
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2017-
|
3
|
+
Copyright (c) 2017-2021 Domizio Demichelis
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/lib/config/pagy.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Pagy initializer file (4.
|
3
|
+
# Pagy initializer file (4.8.0)
|
4
4
|
# Customize only what you really need and notice that Pagy works also without any of the following lines.
|
5
5
|
# Should you just cherry pick part of this file, please maintain the require-order of the extras
|
6
6
|
|
data/lib/javascripts/pagy.js
CHANGED
data/lib/pagy.rb
CHANGED
data/lib/pagy/exceptions.rb
CHANGED
data/lib/pagy/extras/bulma.rb
CHANGED
@@ -66,7 +66,7 @@ class Pagy
|
|
66
66
|
private
|
67
67
|
|
68
68
|
def pagy_bulma_prev_next_html(pagy, link)
|
69
|
-
html = if (p_prev = pagy.prev)
|
69
|
+
html = +if (p_prev = pagy.prev)
|
70
70
|
link.call p_prev, pagy_t('pagy.nav.prev'), 'class="pagination-previous" aria-label="previous page"'
|
71
71
|
else
|
72
72
|
%(<a class="pagination-previous" disabled>#{pagy_t 'pagy.nav.prev'}</a>)
|
data/lib/pagy/extras/headers.rb
CHANGED
@@ -25,10 +25,10 @@ class Pagy
|
|
25
25
|
rels = { 'first' => 1, 'prev' => pagy.prev, 'next' => pagy.next }
|
26
26
|
rels['last'] = pagy.last unless countless
|
27
27
|
url_str = pagy_url_for(pagy, PAGE_PLACEHOLDER, absolute: true)
|
28
|
-
hash = { 'Link' => rels.
|
28
|
+
hash = { 'Link' => rels.map do |rel, num| # filter_map if ruby >=2.7
|
29
29
|
next unless num
|
30
30
|
[ rel, url_str.sub(PAGE_PLACEHOLDER, num.to_s) ]
|
31
|
-
end.to_h }
|
31
|
+
end.compact.to_h }
|
32
32
|
headers = pagy.vars[:headers]
|
33
33
|
hash[headers[:page]] = pagy.page.to_s if headers[:page]
|
34
34
|
hash[headers[:items]] = pagy.vars[:items].to_s if headers[:items]
|
data/lib/pagy/extras/i18n.rb
CHANGED
data/lib/pagy/extras/items.rb
CHANGED
@@ -40,7 +40,7 @@ class Pagy
|
|
40
40
|
link = pagy_marked_link(pagy_link_proc(pagy, link_extra: link_extra))
|
41
41
|
p_vars[:items] = p_items # restore the items
|
42
42
|
|
43
|
-
html =
|
43
|
+
html = +%(<span#{p_id} class="pagy-items-selector-js" #{pagy_json_attr pagy, :items_selector, pagy.from, link}>)
|
44
44
|
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;">)
|
45
45
|
html << pagy_t('pagy.items_selector_js', item_name: item_name || pagy_t(i18n_key || p_vars[:i18n_key], count: p_items),
|
46
46
|
items_input: input,
|
data/lib/pagy/extras/overflow.rb
CHANGED
@@ -46,7 +46,11 @@ class Pagy
|
|
46
46
|
"#{url_string}#{query_string}#{p_vars[:fragment]}"
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
|
50
|
+
# single line in order to avoid complicating simplecov already tested with other GitHub Actions
|
51
|
+
Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('3.0.0') \
|
52
|
+
&& Helpers.prepend(UseStandaloneExtra) \
|
53
|
+
|| ( Frontend.prepend(UseStandaloneExtra); Backend.prepend(UseStandaloneExtra) if defined?(Pagy::Backend::METADATA) ) # rubocop:disable Style/Semicolon
|
50
54
|
|
51
55
|
# defines a dummy #params method if not already defined in the including module
|
52
56
|
module Backend
|
data/lib/pagy/extras/trim.rb
CHANGED
@@ -12,7 +12,7 @@ class Pagy
|
|
12
12
|
link_proc = super(pagy, link_extra: link_extra)
|
13
13
|
return link_proc unless pagy.vars[:enable_trim_extra]
|
14
14
|
lambda do |num, text=num, extra=''|
|
15
|
-
link = link_proc.call(num, text, extra)
|
15
|
+
link = +link_proc.call(num, text, extra)
|
16
16
|
return link unless num == 1
|
17
17
|
link.sub!(/[?&]#{pagy.vars[:page_param]}=1\b(?!&)|\b#{pagy.vars[:page_param]}=1&/, '')
|
18
18
|
end
|
data/lib/pagy/extras/uikit.rb
CHANGED
@@ -11,7 +11,7 @@ class Pagy
|
|
11
11
|
p_id = %( id="#{pagy_id}") if pagy_id
|
12
12
|
link = pagy_link_proc(pagy, link_extra: link_extra)
|
13
13
|
|
14
|
-
html =
|
14
|
+
html = +%(<ul#{p_id} class="pagy-uikit-nav uk-pagination uk-flex-center">#{pagy_uikit_prev_html pagy, link})
|
15
15
|
pagy.series.each do |item|
|
16
16
|
html << case item
|
17
17
|
when Integer then %(<li>#{link.call item}</li>)
|
data/lib/pagy/frontend.rb
CHANGED
@@ -25,7 +25,9 @@ class Pagy
|
|
25
25
|
end
|
26
26
|
|
27
27
|
# Sub-method called only by #pagy_url_for: here for easy customization of params by overriding
|
28
|
-
def pagy_get_params(params)
|
28
|
+
def pagy_get_params(params)
|
29
|
+
params
|
30
|
+
end
|
29
31
|
end
|
30
32
|
|
31
33
|
# All the code here has been optimized for performance: it may not look very pretty
|
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.8.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-06-08 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,
|
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
110
|
requirements:
|
111
111
|
- - ">="
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: '
|
113
|
+
version: '2.5'
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - ">="
|