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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49b0fb6295766ee5a4272b21ac33cba767e8f2b0b0aa9b419f9ce436b4b2cd9a
4
- data.tar.gz: 1036ef5fc880a856423baf0442bb16ef6e21d8dc91696182aebbf9a4eae77ecb
3
+ metadata.gz: 873814564a714a56ca4ca46cf037554bdda04416d0fe2b39f80886a228d383a9
4
+ data.tar.gz: f5643dcac7efbd25cd5afc6a05c3fd6aa4ea52355bb3186dcc91d9c996e94bb1
5
5
  SHA512:
6
- metadata.gz: a8259eade988ebec0c2d0c7edba17721e7b88c9238ecbcd84213be41a97c7570f7b4a6b29c2f9f20cdacd7f20d43076d70cb87b6575ded375b447aa5e9821ddf
7
- data.tar.gz: 0b7796b7e7b673c11696990ec90cf9b62d454e5a21696ab0116ca0372ccbc3cc503f6d03ab55837af382bc6f8b50c2c3ee50531a335d92f8851fab80bae3ba6a
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 a ready to use selector UI
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}s %{from}-%{to} de %{count} en total"
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
@@ -3,7 +3,7 @@
3
3
 
4
4
  require 'pathname'
5
5
 
6
- class Pagy ; VERSION = '0.19.1'
6
+ class Pagy ; VERSION = '0.19.2'
7
7
 
8
8
  class OutOfRangeError < StandardError; attr_reader :pagy; def initialize(pagy) @pagy = pagy end; end
9
9
 
@@ -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
- url = pagy_url_for(MARKER, pagy)
19
- p1url = pagy_trim_url(url, "#{p_vars[:page_param]}=#{MARKER}")
20
- p1 = %(<a href="#{p1url}" #{p_vars[:link_extra]} #{link_extra})
21
- a, b = %(<a href="#{url}" #{p_vars[:link_extra]} #{link_extra}).split(MARKER, 2)
22
- -> (n, text=n, extra='') { start = n.to_i == 1 ? p1 : "#{a}#{n}#{b}"
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.1
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-17 00:00:00.000000000 Z
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,