pagy 3.2.0 → 3.2.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 +1 -1
- data/lib/javascripts/pagy.js +1 -1
- data/lib/pagy.rb +1 -1
- data/lib/pagy/extras/i18n.rb +2 -2
- data/lib/pagy/extras/overflow.rb +4 -4
- data/lib/pagy/extras/trim.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 660aa79dcf4de07d2377f7f7706897a14e637eae0f8ddff1799094361da5e76c
|
4
|
+
data.tar.gz: eef332aa68f610aa89df84822d91c99274facf0c84162268c5a7d0c97a28163e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cff58fe6379393d1156aafa83a85fdc0d3ebfa6e8d193215e42f7d40c59fb3f476420325ae1cce84624d8b11dddf670f874cb1fbf69c40f7a7b32f6cf6db3752
|
7
|
+
data.tar.gz: 718f1a9dd1f829488228e9e4620938f48ea471b40b89ccabf610ff76b73811b57b25a5c9729ca7147ae8bbefce8b82f73d37fe76a95d9fb037c6571fe6078ee7
|
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.2.
|
4
|
+
# Pagy initializer file (3.2.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
|
|
data/lib/javascripts/pagy.js
CHANGED
@@ -98,6 +98,6 @@ Pagy.addInputEventListeners = function(input, handler){
|
|
98
98
|
};
|
99
99
|
|
100
100
|
Pagy.trim = function(html, param){
|
101
|
-
var re = new RegExp('[?&]' + param + '=1(
|
101
|
+
var re = new RegExp('[?&]' + param + '=1\b(?!&)|\b' + param + '=1&');
|
102
102
|
return html.replace(re, '');
|
103
103
|
};
|
data/lib/pagy.rb
CHANGED
data/lib/pagy/extras/i18n.rb
CHANGED
@@ -10,9 +10,9 @@ class Pagy
|
|
10
10
|
|
11
11
|
Pagy::I18n.clear.instance_eval { undef :load; undef :t } # unload the pagy default constant for efficiency
|
12
12
|
|
13
|
-
|
13
|
+
alias_method :pagy_without_i18n, :pagy_t
|
14
14
|
def pagy_t_with_i18n(*args) ::I18n.t(*args) end
|
15
|
-
|
15
|
+
alias_method :pagy_t, :pagy_t_with_i18n
|
16
16
|
|
17
17
|
end
|
18
18
|
end
|
data/lib/pagy/extras/overflow.rb
CHANGED
@@ -10,7 +10,7 @@ class Pagy
|
|
10
10
|
|
11
11
|
def overflow?; @overflow end
|
12
12
|
|
13
|
-
|
13
|
+
alias_method :initialize_without_overflow, :initialize
|
14
14
|
def initialize_with_overflow(vars)
|
15
15
|
@overflow ||= false # don't override if :last_page re-run the method after an overflow
|
16
16
|
initialize_without_overflow(vars)
|
@@ -31,7 +31,7 @@ class Pagy
|
|
31
31
|
raise ArgumentError, "expected :overflow variable in [:last_page, :empty_page, :exception]; got #{@vars[:overflow].inspect}"
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
alias_method :initialize, :initialize_with_overflow
|
35
35
|
|
36
36
|
module Series
|
37
37
|
def series(size=@vars[:size])
|
@@ -48,7 +48,7 @@ class Pagy
|
|
48
48
|
if defined?(Pagy::Countless)
|
49
49
|
class Countless
|
50
50
|
|
51
|
-
|
51
|
+
alias_method :finalize_without_overflow, :finalize
|
52
52
|
def finalize_with_overflow(items)
|
53
53
|
@overflow = false
|
54
54
|
finalize_without_overflow(items)
|
@@ -65,7 +65,7 @@ class Pagy
|
|
65
65
|
raise ArgumentError, "expected :overflow variable in [:empty_page, :exception]; got #{@vars[:overflow].inspect}"
|
66
66
|
end
|
67
67
|
end
|
68
|
-
|
68
|
+
alias_method :finalize, :finalize_with_overflow
|
69
69
|
|
70
70
|
end
|
71
71
|
end
|
data/lib/pagy/extras/trim.rb
CHANGED
@@ -10,11 +10,11 @@ class Pagy
|
|
10
10
|
|
11
11
|
alias_method :pagy_link_proc_without_trim, :pagy_link_proc
|
12
12
|
def pagy_link_proc_with_trim(pagy, link_extra='')
|
13
|
-
link_proc
|
14
|
-
|
13
|
+
link_proc = pagy_link_proc_without_trim(pagy, link_extra)
|
14
|
+
re = /[?&]#{pagy.vars[:page_param]}=1\b(?!&)|\b#{pagy.vars[:page_param]}=1&/
|
15
15
|
lambda do |n, text=n, extra=''|
|
16
16
|
link = link_proc.call(n, text, extra)
|
17
|
-
n == 1 ? link.sub(
|
17
|
+
n == 1 ? link.sub(re, '') : link
|
18
18
|
end
|
19
19
|
end
|
20
20
|
alias_method :pagy_link_proc, :pagy_link_proc_with_trim
|
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.2.
|
4
|
+
version: 3.2.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-05-
|
11
|
+
date: 2019-05-24 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,
|