pagy 3.6.0 → 3.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1414283eb3f96c82e975d0436ebf6dee87cdc037d91c152ed13dd97a3a2cc58
4
- data.tar.gz: 907bc851219c314bbdfe95a373b77c562de51c81495ada5686d6c57b61be826c
3
+ metadata.gz: e979c20b3707bfa08719b0fca92c4af61815ef525a9473e73ca2ae7e90fb1edf
4
+ data.tar.gz: 70fbef96ca45c915f18f47a5e37ecd6c42c2721a808c07c6c7b4c295cc35e501
5
5
  SHA512:
6
- metadata.gz: 9a3c417007ffa03a904714ac4d807adc215645e5518429a14490a3430426374a9bac45d55882e5a0c4e3969bdd258c5a78dad2c04f7ed6f775c9d8aa43abc798
7
- data.tar.gz: 653e0bbd6b8b8c0b71b16f9983d3c7e5d2c14b33b176a5100a2cd7e63aaca41c565dbae0589bafcc2ee6c9e5b56939047a40668b2615e4db6f53fbeaf3cbc9d0
6
+ metadata.gz: f46df19bef1296acd3288e2bcc73dcc6824866ea6abb2ccb31629a4e511baad027dfbba4433cb768291d0c6268221e4e2f3ae32012edb3c0f28c4cbd21798115
7
+ data.tar.gz: f2b696abd64a438b605304c142c6dd37f2c2a8039cbb002d8959712784a6d072073165df64485250067f0a8b1b6df6ba1efccd3c02459e5e954b0902b9246cb1
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
- # Pagy initializer file (3.6.0)
4
+ # Pagy initializer file (3.7.4)
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
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  function Pagy(){}
4
4
 
5
- Pagy.version = '3.6.0';
5
+ Pagy.version = '3.7.4';
6
6
 
7
7
  Pagy.init = function(arg){
8
8
  var target = arg instanceof Event || arg === undefined ? document : arg,
@@ -8,7 +8,7 @@ es:
8
8
  other: "ítems"
9
9
 
10
10
  nav:
11
- prev: "‹ Prev"
11
+ prev: "‹ Anterior"
12
12
  next: "Siguiente ›"
13
13
  gap: "…"
14
14
 
@@ -4,8 +4,8 @@ fr:
4
4
  pagy:
5
5
 
6
6
  item_name:
7
- one: "élement"
8
- other: "élements"
7
+ one: "élément"
8
+ other: "éléments"
9
9
 
10
10
  nav:
11
11
  prev: "‹ Précédent"
@@ -0,0 +1,22 @@
1
+ # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
+
3
+ it:
4
+ pagy:
5
+
6
+ item_name:
7
+ one: "elemento"
8
+ other: "elementi"
9
+
10
+ nav:
11
+ prev: "‹ Precedente"
12
+ next: "Seguente ›"
13
+ gap: "…"
14
+
15
+ info:
16
+ no_items: "Nessun %{item_name} trovato"
17
+ single_page: "Visualizzazione di <b>%{count}</b> %{item_name}"
18
+ multiple_pages: "Visualizzazione %{item_name} <b>%{from}-%{to}</b> di <b>%{count}</b> in totale"
19
+
20
+ combo_nav_js: "Pagina %{page_input} di %{pages}"
21
+
22
+ items_selector_js: "Mostra %{items_input} %{item_name} per pagina"
@@ -1,6 +1,6 @@
1
1
  # :one_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
2
 
3
- pt-br:
3
+ pt-BR:
4
4
  pagy:
5
5
 
6
6
  item_name:
@@ -0,0 +1,23 @@
1
+ # :one_two_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
+
3
+ sv-SE:
4
+ pagy:
5
+
6
+ item_name:
7
+ one: "resultat"
8
+ two: "resultat"
9
+ other: "resultat"
10
+
11
+ nav:
12
+ prev: "&lsaquo;&nbsp;Föregående"
13
+ next: "Nästa&nbsp;&rsaquo;"
14
+ gap: "&hellip;"
15
+
16
+ info:
17
+ no_items: "Inga %{item_name} hittade"
18
+ single_page: "Visar <b>%{count}</b> %{item_name}"
19
+ multiple_pages: "Visar %{item_name} <b>%{from}-%{to}</b> av <b>%{count}</b> totalt"
20
+
21
+ combo_nav_js: "Sida %{page_input} av %{pages}"
22
+
23
+ items_selector_js: "Visa %{items_input} %{item_name} per sida"
@@ -1,6 +1,6 @@
1
1
  # :one_two_other pluralization (see https://github.com/ddnexus/pagy/blob/master/lib/locales/utils/p11n.rb)
2
2
 
3
- se:
3
+ sv:
4
4
  pagy:
5
5
 
6
6
  item_name:
@@ -4,15 +4,22 @@
4
4
 
5
5
  # this file returns the I18n hash used as default alternative to the i18n gem
6
6
 
7
- Hash.new{|h,_| h.first[1]}.tap do |i18n| # first loaded locale used as default
8
- i18n.define_singleton_method(:load) do |*args|
7
+ Pagy::DEPRECATED_LOCALES = {'pt-br' =>'pt-BR', 'se' => 'sv-SE'}
8
+
9
+ Hash.new{|h,_| h.first[1]}.tap do |i18n_hash| # first loaded locale used as default
10
+ i18n_hash.define_singleton_method(:load) do |*load_args|
9
11
  # eval: we don't need to keep the loader proc in memory
10
- eval(Pagy.root.join('locales', 'utils', 'loader.rb').read).call(i18n, *args) #rubocop:disable Security/Eval
12
+ eval(Pagy.root.join('locales', 'utils', 'loader.rb').read).call(i18n_hash, *load_args) #rubocop:disable Security/Eval
11
13
  end
12
- i18n.define_singleton_method(:t) do |locale, path, vars={}|
14
+ i18n_hash.define_singleton_method(:t) do |locale, path, vars={}|
15
+ if Pagy::DEPRECATED_LOCALES.key?(locale)
16
+ new_locale = Pagy::DEPRECATED_LOCALES[locale]
17
+ $stderr.puts("WARNING: the Pagy locale '#{locale}' is deprecated; use '#{new_locale}' instead")
18
+ locale = new_locale
19
+ end
13
20
  data, pluralize = self[locale]
14
21
  translate = data[path] || vars[:count] && data[path+=".#{pluralize.call(vars[:count])}"] or return %([translation missing: "#{path}"])
15
22
  translate.call(vars)
16
23
  end
17
- i18n.load(locale: 'en')
24
+ i18n_hash.load(locale: 'en')
18
25
  end
@@ -20,6 +20,11 @@ flatten = lambda do |hash, key=''|
20
20
  lambda do |i18n, *args|
21
21
  i18n.clear
22
22
  args.each do |arg|
23
+ if Pagy::DEPRECATED_LOCALES.key?(arg[:locale])
24
+ new_locale = Pagy::DEPRECATED_LOCALES[arg[:locale]]
25
+ $stderr.puts("WARNING: the Pagy locale '#{arg[:locale]}' is deprecated; use '#{new_locale}' instead")
26
+ arg[:locale] = new_locale
27
+ end
23
28
  arg[:filepath] ||= Pagy.root.join('locales', "#{arg[:locale]}.yml")
24
29
  arg[:pluralize] ||= plurals[arg[:locale]]
25
30
  hash = YAML.load(File.read(arg[:filepath], encoding: 'UTF-8')) #rubocop:disable Security/YAMLLoad
@@ -60,14 +60,15 @@ p11n = {
60
60
  # The default pluralization for locales not explicitly listed here
61
61
  # is the :one_other pluralization proc (used for English)
62
62
  plurals = Hash.new(p11n[:one_other]).tap do |hash|
63
- hash['id'] = p11n[:other]
64
- hash['fr'] = p11n[:one_upto_two_other]
65
- hash['ja'] = p11n[:other]
66
- hash['ko'] = p11n[:other]
67
- hash['pl'] = p11n[:polish]
68
- hash['ru'] = p11n[:east_slavic]
69
- hash['se'] = p11n[:one_two_other]
70
- hash['tr'] = p11n[:other]
63
+ hash['id'] = p11n[:other]
64
+ hash['fr'] = p11n[:one_upto_two_other]
65
+ hash['ja'] = p11n[:other]
66
+ hash['ko'] = p11n[:other]
67
+ hash['pl'] = p11n[:polish]
68
+ hash['ru'] = p11n[:east_slavic]
69
+ hash['sv'] = p11n[:one_two_other]
70
+ hash['sv-SE'] = p11n[:one_two_other]
71
+ hash['tr'] = p11n[:other]
71
72
  hash['zh-CN'] = p11n[:other]
72
73
  hash['zh-HK'] = p11n[:other]
73
74
  hash['zh-TW'] = p11n[:other]
@@ -4,7 +4,7 @@
4
4
 
5
5
  require 'pathname'
6
6
 
7
- class Pagy ; VERSION = '3.6.0'
7
+ class Pagy ; VERSION = '3.7.4'
8
8
 
9
9
  # Root pathname to get the path of Pagy files like templates or dictionaries
10
10
  def self.root; @root ||= Pathname.new(__FILE__).dirname.freeze end
@@ -23,7 +23,7 @@ class Pagy
23
23
  else
24
24
  # COUNT(*) OVER ()
25
25
  sql = Arel.star.count.over(Arel::Nodes::Grouping.new([]))
26
- collection.unscope(:order).limit(1).pluck(sql).first
26
+ collection.unscope(:order).limit(1).pluck(sql).first.to_i
27
27
  end
28
28
  end
29
29
 
@@ -21,7 +21,7 @@ class Pagy
21
21
  end
22
22
  html << (p_next ? %(<li class="page-item next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</li>)
23
23
  : %(<li class="page-item next disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.next')}</a></li>))
24
- %(<nav class="pagy-bootstrap-nav pagination" role="navigation" aria-label="pager"><ul class="pagination">#{html}</ul></nav>)
24
+ %(<nav class="pagy-bootstrap-nav" role="navigation" aria-label="pager"><ul class="pagination">#{html}</ul></nav>)
25
25
  end
26
26
 
27
27
  # Javascript pagination for bootstrap: it returns a nav and a JSON tag used by the Pagy.nav javascript
@@ -29,12 +29,12 @@ class Pagy
29
29
  link, p_prev, p_next = pagy_link_proc(pagy, 'class="page-link"'), pagy.prev, pagy.next
30
30
  tags = { 'before' => p_prev ? %(<ul class="pagination"><li class="page-item prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</li>)
31
31
  : %(<ul class="pagination"><li class="page-item prev disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.prev')}</a></li>),
32
- 'link' => %(<li class="page-item">#{mark = link.call(MARK)}</li>),
32
+ 'link' => %(<li class="page-item">#{mark = link.call(PAGE_PLACEHOLDER)}</li>),
33
33
  'active' => %(<li class="page-item active">#{mark}</li>),
34
34
  'gap' => %(<li class="page-item gap disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.gap')}</a></li>),
35
35
  'after' => p_next ? %(<li class="page-item next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</li></ul>)
36
36
  : %(<li class="page-item next disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.next')}</a></li></ul>) }
37
- %(<nav id="#{id}" class="pagy-bootstrap-nav-js pagination" role="navigation" aria-label="pager"></nav>#{pagy_json_tag(:nav, id, tags, pagy.sequels, defined?(TRIM) && pagy.vars[:page_param])})
37
+ %(<nav id="#{id}" class="pagy-bootstrap-nav-js" role="navigation" aria-label="pager"></nav>#{pagy_json_tag(:nav, id, tags, pagy.sequels, defined?(TRIM) && pagy.vars[:page_param])})
38
38
  end
39
39
 
40
40
  # Javascript combo pagination for bootstrap: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
@@ -34,8 +34,8 @@ class Pagy
34
34
  + (p_next ? link.call(p_next, pagy_t('pagy.nav.next'), 'class="pagination-next" aria-label="next page"')
35
35
  : %(<a class="pagination-next" disabled>#{pagy_t('pagy.nav.next')}</a>)) \
36
36
  + '<ul class="pagination-list">' ),
37
- 'link' => %(<li>#{link.call(MARK, MARK, %(class="pagination-link" aria-label="goto page #{MARK}"))}</li>),
38
- 'active' => %(<li>#{link.call(MARK, MARK, %(class="pagination-link is-current" aria-current="page" aria-label="page #{MARK}"))}</li>),
37
+ 'link' => %(<li>#{link.call(PAGE_PLACEHOLDER, PAGE_PLACEHOLDER, %(class="pagination-link" aria-label="goto page #{PAGE_PLACEHOLDER}"))}</li>),
38
+ 'active' => %(<li>#{link.call(PAGE_PLACEHOLDER, PAGE_PLACEHOLDER, %(class="pagination-link is-current" aria-current="page" aria-label="page #{PAGE_PLACEHOLDER}"))}</li>),
39
39
  'gap' => %(<li><span class="pagination-ellipsis">#{pagy_t('pagy.nav.gap')}</span></li>),
40
40
  'after' => '</ul>' }
41
41
  %(<nav id="#{id}" class="pagy-bulma-nav-js pagination is-centered" role="navigation" aria-label="pagination"></nav>#{pagy_json_tag(:nav, id, tags, pagy.sequels, defined?(TRIM) && pagy.vars[:page_param])})
@@ -30,7 +30,7 @@ class Pagy
30
30
  tags = { 'before' => ( '<ul class="pagination">' \
31
31
  + (p_prev ? %(<li class="prev">#{link.call(p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')}</li>)
32
32
  : %(<li class="prev disabled">#{pagy_t('pagy.nav.prev')}</li>)) ),
33
- 'link' => %(<li>#{link.call(MARK)}</li>),
33
+ 'link' => %(<li>#{link.call(PAGE_PLACEHOLDER)}</li>),
34
34
  'active' => %(<li class="current">#{pagy.page}</li>),
35
35
  'gap' => %(<li class="ellipsis gap" aria-hidden="true"></li>),
36
36
  'after' => ( (p_next ? %(<li class="next">#{link.call(p_next, pagy_t('pagy.nav.next'), 'aria-label="next"')}</li>)
@@ -23,14 +23,14 @@ class Pagy
23
23
  def pagy_headers_hash(pagy)
24
24
  countless = defined?(Pagy::Countless) && pagy.is_a?(Pagy::Countless)
25
25
  rels = { 'first' => 1, 'prev' => pagy.prev, 'next' => pagy.next }; rels['last'] = pagy.last unless countless
26
- url_str = pagy_url_for(Frontend::MARK, pagy, :url)
27
- hash = { 'Link' => Hash[rels.map{|rel, n|[rel, url_str.sub(Frontend::MARK, n.to_s)] if n}.compact] }
26
+ url_str = pagy_url_for(PAGE_PLACEHOLDER, pagy, :url)
27
+ hash = { 'Link' => Hash[rels.map{|rel, n|[rel, url_str.sub(PAGE_PLACEHOLDER, n.to_s)] if n}.compact] }
28
28
  headers = pagy.vars[:headers]
29
- hash[headers[:page]] = pagy.page if headers[:page]
30
- hash[headers[:items]] = pagy.vars[:items] if headers[:items]
29
+ hash[headers[:page]] = pagy.page.to_s if headers[:page]
30
+ hash[headers[:items]] = pagy.vars[:items].to_s if headers[:items]
31
31
  unless countless
32
- hash[headers[:pages]] = pagy.pages if headers[:pages]
33
- hash[headers[:count]] = pagy.count if headers[:count]
32
+ hash[headers[:pages]] = pagy.pages.to_s if headers[:pages]
33
+ hash[headers[:count]] = pagy.count.to_s if headers[:count]
34
34
  end
35
35
  hash
36
36
  end
@@ -10,6 +10,8 @@ class Pagy
10
10
  VARS[:items_param] = :items
11
11
  VARS[:max_items] = 100
12
12
 
13
+ ITEMS_PLACEHOLDER = '__pagy_items__'
14
+
13
15
  # Handle a custom number of :items from params
14
16
  module Backend ; private
15
17
 
@@ -49,7 +51,7 @@ class Pagy
49
51
  def pagy_items_selector_js(pagy, id=pagy_id)
50
52
  p_vars = pagy.vars
51
53
  p_items = p_vars[:items]
52
- p_vars[:items] = '__pagy_items__'
54
+ p_vars[:items] = ITEMS_PLACEHOLDER
53
55
  link = pagy_marked_link(pagy_link_proc(pagy))
54
56
  p_vars[:items] = p_items # restore the items
55
57
 
@@ -29,7 +29,7 @@ class Pagy
29
29
  tags = { 'before' => ( '<ul class="pagination">' \
30
30
  + (p_prev ? %(<li class="waves-effect prev">#{link.call(p_prev, '<i class="material-icons">chevron_left</i>', 'aria-label="previous"')}</li>)
31
31
  : %(<li class="prev disabled"><a href="#"><i class="material-icons">chevron_left</i></a></li>)) ),
32
- 'link' => %(<li class="waves-effect">#{mark = link.call(MARK)}</li>),
32
+ 'link' => %(<li class="waves-effect">#{mark = link.call(PAGE_PLACEHOLDER)}</li>),
33
33
  'active' => %(<li class="active">#{mark}</li>),
34
34
  'gap' => %(<li class="gap disabled"><a href="#">#{pagy_t('pagy.nav.gap')}</a></li>),
35
35
  'after' => ( (p_next ? %(<li class="waves-effect next">#{link.call(p_next, '<i class="material-icons">chevron_right</i>', 'aria-label="next"')}</li>)
@@ -17,16 +17,16 @@ class Pagy
17
17
  def pagy_metadata(pagy, url=false)
18
18
  names = pagy.vars[:metadata]
19
19
  (unknown = names - METADATA).empty? or raise(VariableError.new(pagy), "unknown metadata #{unknown.inspect}")
20
- scaffold_url = pagy_url_for(Frontend::MARK, pagy, url)
20
+ scaffold_url = pagy_url_for(PAGE_PLACEHOLDER, pagy, url)
21
21
  metadata = {}
22
22
  names.each do |key|
23
23
  metadata[key] = case key
24
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)
25
+ when :first_url ; scaffold_url.sub(PAGE_PLACEHOLDER, 1.to_s)
26
+ when :prev_url ; scaffold_url.sub(PAGE_PLACEHOLDER, pagy.prev.to_s)
27
+ when :page_url ; scaffold_url.sub(PAGE_PLACEHOLDER, pagy.page.to_s)
28
+ when :next_url ; scaffold_url.sub(PAGE_PLACEHOLDER, pagy.next.to_s)
29
+ when :last_url ; scaffold_url.sub(PAGE_PLACEHOLDER, pagy.last.to_s)
30
30
  else pagy.send(key)
31
31
  end
32
32
  end
@@ -12,7 +12,7 @@ class Pagy
12
12
  link, p_prev, p_next = pagy_link_proc(pagy), pagy.prev, pagy.next
13
13
  tags = { 'before' => p_prev ? %(<span class="page prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</span> )
14
14
  : %(<span class="page prev disabled">#{pagy_t('pagy.nav.prev')}</span> ),
15
- 'link' => %(<span class="page">#{link.call(MARK)}</span> ),
15
+ 'link' => %(<span class="page">#{link.call(PAGE_PLACEHOLDER)}</span> ),
16
16
  'active' => %(<span class="page active">#{pagy.page}</span> ),
17
17
  'gap' => %(<span class="page gap">#{pagy_t('pagy.nav.gap')}</span> ),
18
18
  'after' => p_next ? %(<span class="page next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</span>)
@@ -29,7 +29,7 @@ class Pagy
29
29
  link, p_prev, p_next = pagy_link_proc(pagy, 'class="item"'), pagy.prev, pagy.next
30
30
  tags = { 'before' => (p_prev ? %(#{link.call(p_prev, '<i class="left small chevron icon"></i>', 'aria-label="previous"')})
31
31
  : %(<div class="item disabled"><i class="left small chevron icon"></i></div>)),
32
- 'link' => %(#{link.call(MARK)}),
32
+ 'link' => %(#{link.call(PAGE_PLACEHOLDER)}),
33
33
  'active' => %(<a class="item active">#{pagy.page}</a>),
34
34
  'gap' => %(<div class="disabled item">#{pagy_t('pagy.nav.gap')}</div>),
35
35
  'after' => (p_next ? %(#{link.call(p_next, '<i class="right small chevron icon"></i>', 'aria-label="next"')})
@@ -45,7 +45,7 @@ class Pagy
45
45
 
46
46
  # it returns the marked link to used by pagy.js
47
47
  def pagy_marked_link(link)
48
- link.call(MARK, '', 'style="display: none;"')
48
+ link.call(PAGE_PLACEHOLDER, '', 'style="display: none;"')
49
49
  end
50
50
 
51
51
  end
@@ -33,8 +33,8 @@ class Pagy
33
33
  next_span = "<span uk-pagination-next>#{pagy_t('pagy.nav.next')}</span>"
34
34
  tags = { 'before' => p_prev ? %(<li>#{link.call p_prev, previous_span}</li>)
35
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>),
36
+ 'link' => %(<li>#{link.call(PAGE_PLACEHOLDER)}</li>),
37
+ 'active' => %(<li class="uk-active"><span>#{PAGE_PLACEHOLDER}</span></li>),
38
38
  'gap' => %(<li class="uk-disabled"><span>#{pagy_t('pagy.nav.gap')}</span></li>),
39
39
  'after' => p_next ? %(<li>#{link.call p_next, next_span}</li>)
40
40
  : %(<li class="uk-disabled"><a href="#">#{next_span}</a></li>) }
@@ -6,6 +6,8 @@ require 'yaml'
6
6
 
7
7
  class Pagy
8
8
 
9
+ PAGE_PLACEHOLDER = '__pagy_page__' # string used for search and replace, hardcoded also in the pagy.js file
10
+
9
11
  # I18n static hash loaded at startup, used as default alternative to the i18n gem.
10
12
  # see https://ddnexus.github.io/pagy/api/frontend#i18n
11
13
  I18n = eval(Pagy.root.join('locales', 'utils', 'i18n.rb').read) #rubocop:disable Security/Eval
@@ -28,7 +30,7 @@ class Pagy
28
30
  include Helpers
29
31
 
30
32
  EMPTY = '' # EMPTY + 'string' is almost as fast as +'string' but is also 1.9 compatible
31
- MARK = '__pagy_page__' # string used for search and replace, hardcoded also in the pagy.js file
33
+ MARK = PAGE_PLACEHOLDER # backward compatibility in case of helper-overriding in legacy apps
32
34
 
33
35
  # Generic pagination: it returns the html with the series of links to the pages
34
36
  def pagy_nav(pagy)
@@ -59,7 +61,7 @@ class Pagy
59
61
  # Benchmarked on a 20 link nav: it is ~22x faster and uses ~18x less memory than rails' link_to
60
62
  def pagy_link_proc(pagy, link_extra='')
61
63
  p_prev, p_next = pagy.prev, pagy.next
62
- a, b = %(<a href="#{pagy_url_for(MARK, pagy)}" #{pagy.vars[:link_extra]} #{link_extra}).split(MARK, 2)
64
+ a, b = %(<a href="#{pagy_url_for(PAGE_PLACEHOLDER, pagy)}" #{pagy.vars[:link_extra]} #{link_extra}).split(PAGE_PLACEHOLDER, 2)
63
65
  lambda {|n, text=n, extra=''| "#{a}#{n}#{b}#{ if n == p_prev ; ' rel="prev"'
64
66
  elsif n == p_next ; ' rel="next"'
65
67
  else '' end } #{extra}>#{text}</a>"}
@@ -6,7 +6,7 @@
6
6
  Usage: link.call( page_number [, text [, extra_attributes_string ]])
7
7
  -%>
8
8
  <% link = pagy_link_proc(pagy, 'class="page-link"') -%>
9
- <%# -%><nav aria-label="pager" class="pagy-bootstrap-nav pagination" role="navigation">
9
+ <%# -%><nav aria-label="pager" class="pagy-bootstrap-nav" role="navigation">
10
10
  <%# -%> <ul class="pagination">
11
11
  <% if pagy.prev -%> <li class="page-item prev"><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"') %></li>
12
12
  <% else -%> <li class="page-item prev disabled"><a href="#" class="page-link"><%== pagy_t('pagy.nav.prev') %></a></li>
@@ -6,7 +6,7 @@
6
6
 
7
7
  - link = pagy_link_proc(pagy, 'class="page-link"')
8
8
 
9
- %nav.pagy-bootstrap-nav.pagination{"aria-label" => "pager", :role => "navigation"}
9
+ %nav.pagy-bootstrap-nav{"aria-label" => "pager", :role => "navigation"}
10
10
 
11
11
  %ul.pagination
12
12
 
@@ -6,7 +6,7 @@
6
6
 
7
7
  - link = pagy_link_proc(pagy, 'class="page-link"')
8
8
 
9
- nav.pagy-bootstrap-nav.pagination role="navigation" aria-label="pager"
9
+ nav.pagy-bootstrap-nav role="navigation" aria-label="pager"
10
10
 
11
11
  ul.pagination
12
12
 
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.6.0
4
+ version: 3.7.4
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-10-06 00:00:00.000000000 Z
11
+ date: 2020-03-23 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,
@@ -30,14 +30,16 @@ files:
30
30
  - lib/locales/es.yml
31
31
  - lib/locales/fr.yml
32
32
  - lib/locales/id.yml
33
+ - lib/locales/it.yml
33
34
  - lib/locales/ja.yml
34
35
  - lib/locales/ko.yml
35
36
  - lib/locales/nb.yml
36
37
  - lib/locales/nl.yml
37
38
  - lib/locales/pl.yml
38
- - lib/locales/pt-br.yml
39
+ - lib/locales/pt-BR.yml
39
40
  - lib/locales/ru.yml
40
- - lib/locales/se.yml
41
+ - lib/locales/sv-SE.yml
42
+ - lib/locales/sv.yml
41
43
  - lib/locales/tr.yml
42
44
  - lib/locales/utils/i18n.rb
43
45
  - lib/locales/utils/loader.rb