pagy 0.19.1 → 0.19.2
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/locales/pagy.yml +27 -1
- data/lib/pagy.rb +1 -1
- data/lib/pagy/extras/trim.rb +12 -9
- 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: 873814564a714a56ca4ca46cf037554bdda04416d0fe2b39f80886a228d383a9
|
4
|
+
data.tar.gz: f5643dcac7efbd25cd5afc6a05c3fd6aa4ea52355bb3186dcc91d9c996e94bb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59bc87a3c93b060a7cd19b5fd9606b2fe47c841b47b41571931a08f17e27d0363a46b5b463976127caaa8760c928031daa628f1dd3369a9263b164806a739f6d
|
7
|
+
data.tar.gz: 0d65814a39a0c99d641914fd18a221322e60af0a777e09aff25ce1a89195204fd478358e110ba1fc51d7272a33e9e5d4a3dbeb99e9bc2c8ecf9f675c83ef7543
|
data/lib/config/pagy.rb
CHANGED
@@ -52,7 +52,7 @@
|
|
52
52
|
|
53
53
|
# Feature Extras
|
54
54
|
|
55
|
-
# Items: Allow the client to request a custom number of items per page with
|
55
|
+
# Items: Allow the client to request a custom number of items per page with an optional selector UI
|
56
56
|
# See https://ddnexus.github.io/pagy/extras/items
|
57
57
|
# require 'pagy/extras/items'
|
58
58
|
# Pagy::VARS[:items_param] = :items # default
|
data/lib/locales/pagy.yml
CHANGED
@@ -35,7 +35,7 @@ es:
|
|
35
35
|
zero: "Sin resultados"
|
36
36
|
one: "Mostrando 1 %{item_name}"
|
37
37
|
other: "Mostrando %{count} %{item_name}"
|
38
|
-
multiple_pages: "Mostrando %{item_name}
|
38
|
+
multiple_pages: "Mostrando %{item_name} %{from}-%{to} de %{count} en total"
|
39
39
|
item_name:
|
40
40
|
zero: "ítems"
|
41
41
|
one: "ítem"
|
@@ -68,5 +68,31 @@ tr:
|
|
68
68
|
items:
|
69
69
|
show: "Göster"
|
70
70
|
items: "sayfa başı"
|
71
|
+
ru:
|
72
|
+
pagy:
|
73
|
+
nav:
|
74
|
+
prev: "‹ Назад"
|
75
|
+
next: "Вперёд ›"
|
76
|
+
gap: "…"
|
77
|
+
current: "Вы на странице"
|
78
|
+
info:
|
79
|
+
single_page:
|
80
|
+
zero: "Пока %{item_name} нет"
|
81
|
+
one: "<b>1</b> %{item_name}"
|
82
|
+
few: "<b>%{count}</b> %{item_name}"
|
83
|
+
many: "Всего <b>%{count}</b> %{item_name}"
|
84
|
+
other: "Всего <b>%{count}</b> %{item_name}"
|
85
|
+
multiple_pages: "Всего <b>%{count}</b> %{item_name}, показаны с <b>%{from}</b> по <b>%{to}</b>"
|
86
|
+
item_name:
|
87
|
+
one: "запись"
|
88
|
+
few: "записи"
|
89
|
+
many: "записей"
|
90
|
+
other: "записей"
|
91
|
+
compact:
|
92
|
+
page: "Страница"
|
93
|
+
of: "из"
|
94
|
+
items:
|
95
|
+
show: "Показать"
|
96
|
+
items: "записей на странице"
|
71
97
|
|
72
98
|
# PR for other languages are very welcome. Thanks!
|
data/lib/pagy.rb
CHANGED
data/lib/pagy/extras/trim.rb
CHANGED
@@ -8,23 +8,26 @@ class Pagy
|
|
8
8
|
# boolean used by the compact navs
|
9
9
|
TRIM = true
|
10
10
|
|
11
|
-
def pagy_trim_url(url, param_string)
|
12
|
-
url.sub(/((?:[?&])#{param_string}\z|\b(?<=[?&])#{param_string}&)/, '')
|
13
|
-
end
|
14
|
-
|
15
11
|
alias_method :pagy_link_proc_without_trim, :pagy_link_proc
|
16
12
|
def pagy_link_proc_with_trim(pagy, link_extra='')
|
17
13
|
p_prev, p_next, p_vars = pagy.prev, pagy.next, pagy.vars
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
a, b = %(<a href="#{
|
22
|
-
-> (n, text=n, extra='') { start = n.to_i == 1 ?
|
14
|
+
marker_url = pagy_url_for(MARKER, pagy)
|
15
|
+
page1_url = pagy_trim_url(marker_url, "#{p_vars[:page_param]}=#{MARKER}")
|
16
|
+
page1_link = %(<a href="#{page1_url}" #{p_vars[:link_extra]} #{link_extra})
|
17
|
+
a, b = %(<a href="#{marker_url}" #{p_vars[:link_extra]} #{link_extra}).split(MARKER, 2)
|
18
|
+
-> (n, text=n, extra='') { start = n.to_i == 1 ? page1_link : "#{a}#{n}#{b}"
|
23
19
|
"#{start}#{ if n == p_prev ; ' rel="prev"'
|
24
20
|
elsif n == p_next ; ' rel="next"'
|
25
21
|
else '' end } #{extra}>#{text}</a>" }
|
26
22
|
end
|
27
23
|
alias_method :pagy_link_proc, :pagy_link_proc_with_trim
|
28
24
|
|
25
|
+
private
|
26
|
+
|
27
|
+
# separate method easier to test
|
28
|
+
def pagy_trim_url(url, param_string)
|
29
|
+
url.sub(/((?:[?&])#{param_string}\z|\b(?<=[?&])#{param_string}&)/, '')
|
30
|
+
end
|
31
|
+
|
29
32
|
end
|
30
33
|
end
|
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: 0.19.
|
4
|
+
version: 0.19.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Domizio Demichelis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09-
|
11
|
+
date: 2018-09-21 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,
|