pagy 4.1.0 → 4.2.0
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 -2
- data/lib/javascripts/pagy.js +1 -1
- data/lib/locales/utils/i18n.rb +0 -1
- data/lib/locales/utils/loader.rb +7 -5
- data/lib/locales/utils/p11n.rb +24 -20
- data/lib/pagy.rb +44 -26
- data/lib/pagy/backend.rb +4 -3
- data/lib/pagy/countless.rb +12 -9
- data/lib/pagy/exceptions.rb +7 -5
- data/lib/pagy/extras/arel.rb +3 -3
- data/lib/pagy/extras/array.rb +3 -3
- data/lib/pagy/extras/bootstrap.rb +54 -27
- data/lib/pagy/extras/bulma.rb +52 -34
- data/lib/pagy/extras/countless.rb +5 -4
- data/lib/pagy/extras/elasticsearch_rails.rb +7 -6
- data/lib/pagy/extras/foundation.rb +52 -29
- data/lib/pagy/extras/headers.rb +13 -9
- data/lib/pagy/extras/i18n.rb +7 -4
- data/lib/pagy/extras/items.rb +24 -15
- data/lib/pagy/extras/materialize.rb +49 -31
- data/lib/pagy/extras/metadata.rb +25 -20
- data/lib/pagy/extras/navs.rb +38 -17
- data/lib/pagy/extras/overflow.rb +10 -11
- data/lib/pagy/extras/searchkick.rb +8 -7
- data/lib/pagy/extras/semantic.rb +48 -27
- data/lib/pagy/extras/shared.rb +13 -7
- data/lib/pagy/extras/support.rb +10 -5
- data/lib/pagy/extras/trim.rb +11 -7
- data/lib/pagy/extras/uikit.rb +56 -31
- data/lib/pagy/frontend.rb +48 -25
- 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: 1893ce66c2ad5ccb5e1b55340873135bf1174f6876a7fe9987bf3d7b11c8b93d
|
4
|
+
data.tar.gz: 15ec7c5615cc40f2fc854f18577632d99f0ec83134f432a2526ca51c1c579a2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b0a30aa314e2abc44dbad8a89352cd640b3ff81979b31436b8911920df344eef2a43cd622ba2921e9ef088a3059611e7e3ccab05f1e07ab7e3bdaefd72ecd58
|
7
|
+
data.tar.gz: 318953ee34f26d5f89f59417b2b02edda38608ada3946241633513167c1b5c5e209a8b474dfb8c1f028381283ba20cf367b5e2b7e9ad7ad95ca22af86d94730d
|
data/lib/config/pagy.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
|
-
# Pagy initializer file (4.
|
3
|
+
# Pagy initializer file (4.2.0)
|
5
4
|
# Customize only what you really need and notice that Pagy works also without any of the following lines.
|
6
5
|
# Should you just cherry pick part of this file, please maintain the require-order of the extras
|
7
6
|
|
data/lib/javascripts/pagy.js
CHANGED
data/lib/locales/utils/i18n.rb
CHANGED
data/lib/locales/utils/loader.rb
CHANGED
@@ -1,18 +1,20 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
# the whole file will be eval'ed/executed and gc-collected after returning/executing the loader proc
|
5
4
|
|
6
5
|
# eval: no need for the whole file in memory
|
7
|
-
plurals,
|
6
|
+
plurals, = eval Pagy.root.join('locales', 'utils', 'p11n.rb').read # rubocop:disable Security/Eval
|
8
7
|
|
9
8
|
# flatten the dictionary file nested keys
|
10
9
|
# convert each value to a simple ruby interpolation proc
|
11
10
|
flatten = lambda do |hash, key=''|
|
12
11
|
hash.each.reduce({}) do |h, (k, v)|
|
13
|
-
v.is_a?(Hash)
|
14
|
-
|
15
|
-
|
12
|
+
if v.is_a?(Hash)
|
13
|
+
h.merge! flatten.call(v, "#{key}#{k}.")
|
14
|
+
else
|
15
|
+
code = %({"#{key}#{k}" => lambda{|vars|"#{v.gsub(/%{[^}]+?}/){|m| "\#{vars[:#{m[2..-2]}]||'#{m}'}" }}"}})
|
16
|
+
h.merge! eval(code) # rubocop:disable Security/Eval
|
17
|
+
end
|
16
18
|
end
|
17
19
|
end
|
18
20
|
|
data/lib/locales/utils/p11n.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# See https://ddnexus.github.io/pagy/api/frontend#i18n
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
# This file adds support for multiple built-in plualization types.
|
@@ -18,46 +17,51 @@ from12to14 = [12,13,14].freeze
|
|
18
17
|
# Each proc may apply to one or more locales below.
|
19
18
|
# Pluralization logic adapted from https://github.com/svenfuchs/rails-i18n
|
20
19
|
p11n = {
|
21
|
-
one_other:
|
20
|
+
one_other: -> (n){ n == 1 ? 'one' : 'other' }, # default
|
22
21
|
|
23
22
|
east_slavic: lambda do |n|
|
24
23
|
n ||= 0
|
25
24
|
mod10 = n % 10
|
26
25
|
mod100 = n % 100
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
case
|
28
|
+
when mod10 == 1 && mod100 != 11 then 'one'
|
29
|
+
when from2to4.include?(mod10) && !from12to14.include?(mod100) then 'few'
|
30
|
+
when mod10 == 0 || from5to9.include?(mod10) || from11to14.include?(mod100) then 'many' # rubocop:disable Style/NumericPredicate
|
31
|
+
else 'other'
|
32
32
|
end
|
33
33
|
end,
|
34
34
|
|
35
35
|
west_slavic: lambda do |n|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
case n
|
37
|
+
when 1 then 'one'
|
38
|
+
when 2, 3, 4 then 'few'
|
39
|
+
else 'other'
|
40
|
+
end
|
40
41
|
end,
|
41
42
|
|
42
43
|
one_two_other: lambda do |n|
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
case n
|
45
|
+
when 1 then 'one'
|
46
|
+
when 2 then 'two'
|
47
|
+
else 'other'
|
46
48
|
end
|
47
49
|
end,
|
48
50
|
|
49
|
-
one_upto_two_other:
|
51
|
+
one_upto_two_other: -> (n){ n && n >= 0 && n < 2 ? 'one' : 'other' },
|
50
52
|
|
51
|
-
other:
|
53
|
+
other: -> (*){ 'other' },
|
52
54
|
|
53
55
|
polish: lambda do |n|
|
54
56
|
n ||= 0
|
55
|
-
mod10
|
57
|
+
mod10 = n % 10
|
56
58
|
mod100 = n % 100
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
59
|
+
|
60
|
+
case
|
61
|
+
when n == 1 then 'one'
|
62
|
+
when from2to4.include?(mod10) && !from12to14.include?(mod100) then 'few'
|
63
|
+
when (from0to1 + from5to9).include?(mod10) || from12to14.include?(mod100) then 'many'
|
64
|
+
else 'other'
|
61
65
|
end
|
62
66
|
end
|
63
67
|
}
|
data/lib/pagy.rb
CHANGED
@@ -1,48 +1,66 @@
|
|
1
1
|
# See Pagy API documentation: https://ddnexus.github.io/pagy/api/pagy
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
require 'pathname'
|
6
5
|
|
7
|
-
|
6
|
+
# main class
|
7
|
+
class Pagy
|
8
|
+
VERSION = '4.2.0'
|
8
9
|
|
9
10
|
# Root pathname to get the path of Pagy files like templates or dictionaries
|
10
|
-
def self.root
|
11
|
+
def self.root
|
12
|
+
@root ||= Pathname.new(__dir__).freeze
|
13
|
+
end
|
11
14
|
|
12
15
|
# default vars
|
13
|
-
VARS = { page:1, items:20, outset:0, size:[1,4,4,1], page_param: :page,
|
16
|
+
VARS = { page: 1, items: 20, outset: 0, size: [1, 4, 4, 1], page_param: :page, # rubocop:disable Style/MutableConstant
|
17
|
+
params: {}, anchor: '', link_extra: '', i18n_key: 'pagy.item_name', cycle: false }
|
14
18
|
|
15
19
|
attr_reader :count, :page, :items, :vars, :pages, :last, :offset, :from, :to, :prev, :next
|
16
20
|
|
21
|
+
INSTANCE_VARS_MIN = { count: 0, items: 1, page: 1, outset: 0 }.freeze
|
22
|
+
|
17
23
|
# Merge and validate the options, do some simple arithmetic and set the instance variables
|
18
24
|
def initialize(vars)
|
19
|
-
@vars = VARS.merge(vars.delete_if{|_,v| v.nil? || v == '' })
|
20
|
-
|
21
|
-
|
22
|
-
|
25
|
+
@vars = VARS.merge( vars.delete_if{|_,v| v.nil? || v == '' } )
|
26
|
+
|
27
|
+
INSTANCE_VARS_MIN.each do |name,min|
|
28
|
+
raise VariableError.new(self), "expected :#{name} >= #{min}; got #{@vars[name].inspect}" \
|
29
|
+
unless @vars[name] && instance_variable_set(:"@#{name}", @vars[name].to_i) >= min
|
23
30
|
end
|
24
|
-
@pages = @last = [(@count.to_f / @items).ceil, 1].max
|
25
|
-
|
26
|
-
|
27
|
-
@
|
28
|
-
@
|
29
|
-
@
|
30
|
-
@
|
31
|
-
@
|
31
|
+
@pages = @last = [(@count.to_f / @items).ceil, 1].max
|
32
|
+
raise OverflowError.new(self), "expected :page in 1..#{@last}; got #{@page.inspect}" if @page > @last
|
33
|
+
|
34
|
+
@offset = @items * (@page - 1) + @outset
|
35
|
+
@items = @count - ((@pages-1) * @items) if @page == @last && @count.positive?
|
36
|
+
@from = @count.zero? ? 0 : @offset + 1 - @outset
|
37
|
+
@to = @count.zero? ? 0 : @offset + @items - @outset
|
38
|
+
@prev = (@page-1 unless @page == 1)
|
39
|
+
@next = @page == @last ? (1 if @vars[:cycle]) : @page + 1
|
32
40
|
end
|
33
41
|
|
34
42
|
# Return the array of page numbers and :gap items e.g. [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
35
43
|
def series(size=@vars[:size])
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
44
|
+
return [] if size.empty?
|
45
|
+
raise VariableError.new(self), "expected 4 items >= 0 in :size; got #{size.inspect}" \
|
46
|
+
unless size.size == 4 && size.all?{ |num| num >= 0 rescue false } # rubocop:disable Style/RescueModifier
|
47
|
+
|
48
|
+
series = []
|
49
|
+
[ *0..size[0], # initial pages from 0
|
50
|
+
*@page-size[1]..@page+size[2], # around current page
|
51
|
+
*@last-size[3]+1..@last+1 # final pages till @last+1
|
52
|
+
].sort!.each_cons(2) do |left, right| # sort and loop by 2
|
53
|
+
next if left.negative? || left == right # skip out of range and duplicates
|
54
|
+
break if left > @last # break if out of @last boundary
|
55
|
+
case right
|
56
|
+
when left+1 then series.push(left) # no gap -> no additions
|
57
|
+
when left+2 then series.push(left, left+1) # 1 page gap -> fill with missing page
|
58
|
+
else series.push(left, :gap) # n page gap -> add gap
|
59
|
+
end
|
60
|
+
end
|
61
|
+
series.shift # shift the start boundary (0)
|
62
|
+
series[series.index(@page)] = @page.to_s # convert the current page to String
|
63
|
+
series
|
46
64
|
end
|
47
65
|
|
48
66
|
end
|
data/lib/pagy/backend.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# See Pagy::Backend API documentation: https://ddnexus.github.io/pagy/api/backend
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
class Pagy
|
@@ -8,12 +7,14 @@ class Pagy
|
|
8
7
|
|
9
8
|
# See also the extras if you need specialized methods to paginate Arrays or other collections
|
10
9
|
|
11
|
-
|
10
|
+
|
11
|
+
module Backend
|
12
|
+
private # the whole module is private so no problem with including it in a controller
|
12
13
|
|
13
14
|
# Return Pagy object and items
|
14
15
|
def pagy(collection, vars={})
|
15
16
|
pagy = Pagy.new(pagy_get_vars(collection, vars))
|
16
|
-
|
17
|
+
[ pagy, pagy_get_items(collection, pagy) ]
|
17
18
|
end
|
18
19
|
|
19
20
|
# Sub-method called only by #pagy: here for easy customization of variables by overriding
|
data/lib/pagy/countless.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: utf-8
|
2
1
|
# frozen_string_literal: true
|
3
2
|
|
4
3
|
require 'pagy'
|
@@ -7,25 +6,29 @@ class Pagy
|
|
7
6
|
|
8
7
|
class Countless < Pagy
|
9
8
|
|
9
|
+
INSTANCE_VARS_MIN = { items: 1, page: 1, outset: 0 }.freeze
|
10
|
+
|
10
11
|
# Merge and validate the options, do some simple arithmetic and set a few instance variables
|
11
12
|
def initialize(vars={}) # rubocop:disable Lint/MissingSuper
|
12
13
|
@vars = VARS.merge(vars.delete_if{|_,v| v.nil? || v == '' }) # default vars + cleaned vars (can be overridden)
|
13
|
-
|
14
|
-
(
|
15
|
-
|
14
|
+
INSTANCE_VARS_MIN.each do |k,min| # validate instance variables
|
15
|
+
raise VariableError.new(self), "expected :#{k} >= #{min}; got #{@vars[k].inspect}" \
|
16
|
+
unless @vars[k] && instance_variable_set(:"@#{k}", @vars[k].to_i) >= min
|
16
17
|
end
|
17
18
|
@offset = @items * (@page - 1) + @outset # pagination offset + outset (initial offset)
|
18
19
|
end
|
19
20
|
|
20
21
|
# Finalize the instance variables based on the fetched items
|
21
22
|
def finalize(fetched)
|
22
|
-
|
23
|
+
raise OverflowError.new(self), "page #{@page} got no items" \
|
24
|
+
if fetched.zero? && @page > 1
|
25
|
+
|
23
26
|
@pages = @last = (fetched > @items ? @page + 1 : @page) # set the @pages and @last
|
24
|
-
@items = fetched if fetched < @items && fetched
|
25
|
-
@from = fetched
|
26
|
-
@to = fetched
|
27
|
+
@items = fetched if fetched < @items && fetched.positive? # adjust items for last non-empty page
|
28
|
+
@from = fetched.zero? ? 0 : @offset + 1 - @outset # page begins from item
|
29
|
+
@to = fetched.zero? ? 0 : @offset + @items - @outset # page ends to item
|
27
30
|
@prev = (@page-1 unless @page == 1) # nil if no prev page
|
28
|
-
@next = @page == @last ? (1 if @vars[:cycle]) : @page+1
|
31
|
+
@next = @page == @last ? (1 if @vars[:cycle]) : @page + 1 # nil if no next page, 1 if :cycle
|
29
32
|
self
|
30
33
|
end
|
31
34
|
|
data/lib/pagy/exceptions.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Pagy
|
2
4
|
|
5
|
+
# generic variable error
|
3
6
|
class VariableError < ArgumentError
|
4
7
|
attr_reader :pagy
|
5
8
|
|
@@ -9,15 +12,14 @@ class Pagy
|
|
9
12
|
end
|
10
13
|
|
11
14
|
def variable
|
12
|
-
message =~ /expected :(
|
13
|
-
|
15
|
+
message =~ /expected :(\w+)/
|
16
|
+
Regexp.last_match(1)&.to_sym
|
14
17
|
end
|
15
18
|
|
16
|
-
def value
|
17
|
-
pagy.vars[variable]
|
18
|
-
end
|
19
|
+
def value = pagy.vars[variable]
|
19
20
|
end
|
20
21
|
|
22
|
+
# specific overflow error
|
21
23
|
class OverflowError < VariableError; end
|
22
24
|
|
23
25
|
end
|
data/lib/pagy/extras/arel.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/arel
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
class Pagy
|
6
|
-
module Backend
|
5
|
+
module Backend
|
6
|
+
private
|
7
7
|
|
8
8
|
def pagy_arel(collection, vars={})
|
9
9
|
pagy = Pagy.new(pagy_arel_get_vars(collection, vars))
|
10
|
-
|
10
|
+
[ pagy, pagy_get_items(collection, pagy) ]
|
11
11
|
end
|
12
12
|
|
13
13
|
def pagy_arel_get_vars(collection, vars)
|
data/lib/pagy/extras/array.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/array
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
class Pagy
|
6
5
|
# Add specialized backend methods to paginate array collections
|
7
|
-
module Backend
|
6
|
+
module Backend
|
7
|
+
private
|
8
8
|
|
9
9
|
# Return Pagy object and items
|
10
10
|
def pagy_array(array, vars={})
|
11
11
|
pagy = Pagy.new(pagy_array_get_vars(array, vars))
|
12
|
-
|
12
|
+
[ pagy, array[pagy.offset, pagy.items] ]
|
13
13
|
end
|
14
14
|
|
15
15
|
# Sub-method called only by #pagy_array: here for easy customization of variables by overriding
|
@@ -1,5 +1,4 @@
|
|
1
1
|
# See the Pagy documentation: https://ddnexus.github.io/pagy/extras/bootstrap
|
2
|
-
# encoding: utf-8
|
3
2
|
# frozen_string_literal: true
|
4
3
|
|
5
4
|
require 'pagy/extras/shared'
|
@@ -9,47 +8,75 @@ class Pagy
|
|
9
8
|
|
10
9
|
# Pagination for bootstrap: it returns the html with the series of links to the pages
|
11
10
|
def pagy_bootstrap_nav(pagy)
|
12
|
-
link
|
11
|
+
link = pagy_link_proc(pagy, 'class="page-link"')
|
13
12
|
|
14
|
-
html = (
|
15
|
-
|
13
|
+
html = +%(<nav class="pagy-bootstrap-nav" role="navigation" aria-label="pager"><ul class="pagination">)
|
14
|
+
html << pagy_bootstrap_prev_html(pagy, link)
|
16
15
|
pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
17
|
-
html <<
|
18
|
-
|
19
|
-
|
16
|
+
html << case item
|
17
|
+
when Integer then %(<li class="page-item">#{link.call item}</li>)
|
18
|
+
when String then %(<li class="page-item active">#{link.call item}</li>)
|
19
|
+
when :gap then %(<li class="page-item gap disabled"><a href="#" class="page-link">#{pagy_t 'pagy.nav.gap'}</a></li>)
|
20
20
|
end
|
21
21
|
end
|
22
|
-
html << (
|
23
|
-
|
24
|
-
%(<nav class="pagy-bootstrap-nav" role="navigation" aria-label="pager"><ul class="pagination">#{html}</ul></nav>)
|
22
|
+
html << pagy_bootstrap_next_html(pagy, link)
|
23
|
+
html << %(</ul></nav>)
|
25
24
|
end
|
26
25
|
|
27
26
|
# Javascript pagination for bootstrap: it returns a nav and a JSON tag used by the Pagy.nav javascript
|
28
27
|
def pagy_bootstrap_nav_js(pagy, id=pagy_id)
|
29
|
-
link
|
30
|
-
tags = { 'before' =>
|
31
|
-
: %(<ul class="pagination"><li class="page-item prev disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.prev')}</a></li>),
|
28
|
+
link = pagy_link_proc(pagy, 'class="page-link"')
|
29
|
+
tags = { 'before' => %(<ul class="pagination">#{pagy_bootstrap_prev_html pagy, link}),
|
32
30
|
'link' => %(<li class="page-item">#{mark = link.call(PAGE_PLACEHOLDER)}</li>),
|
33
31
|
'active' => %(<li class="page-item active">#{mark}</li>),
|
34
|
-
'gap' => %(<li class="page-item gap disabled"><a href="#" class="page-link">#{pagy_t
|
35
|
-
'after' =>
|
36
|
-
|
37
|
-
%(<nav id="#{id}" class="pagy-bootstrap-nav-js" role="navigation" aria-label="pager"></nav
|
32
|
+
'gap' => %(<li class="page-item gap disabled"><a href="#" class="page-link">#{pagy_t 'pagy.nav.gap'}</a></li>),
|
33
|
+
'after' => %(#{pagy_bootstrap_next_html pagy, link}</ul>) }
|
34
|
+
|
35
|
+
html = %(<nav id="#{id}" class="pagy-bootstrap-nav-js" role="navigation" aria-label="pager"></nav>)
|
36
|
+
html << pagy_json_tag(pagy, :nav, id, tags, pagy.sequels)
|
38
37
|
end
|
39
38
|
|
40
39
|
# Javascript combo pagination for bootstrap: it returns a nav and a JSON tag used by the Pagy.combo_nav javascript
|
41
40
|
def pagy_bootstrap_combo_nav_js(pagy, id=pagy_id)
|
42
|
-
link
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
41
|
+
link = pagy_link_proc(pagy)
|
42
|
+
p_page = pagy.page
|
43
|
+
p_pages = pagy.pages
|
44
|
+
input = %(<input type="number" min="1" max="#{p_pages}" value="#{p_page}" class="text-primary" style="padding: 0; border: none; text-align: center; width: #{p_pages.to_s.length+1}rem;">)
|
45
|
+
|
46
|
+
%(<nav id="#{id}" class="pagy-bootstrap-combo-nav-js pagination" role="navigation" aria-label="pager"><div class="btn-group" role="group">#{
|
47
|
+
if (p_prev = pagy.prev)
|
48
|
+
link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous" class="prev btn btn-primary"'
|
49
|
+
else
|
50
|
+
%(<a class="prev btn btn-primary disabled" href="#">#{pagy_t('pagy.nav.prev')}</a>)
|
51
|
+
end
|
52
|
+
}<div class="pagy-combo-input btn btn-primary disabled" style="white-space: nowrap;">#{pagy_t 'pagy.combo_nav_js', page_input: input, count: p_page, pages: p_pages}</div>#{
|
53
|
+
if (p_next = pagy.next)
|
54
|
+
link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next" class="next btn btn-primary"'
|
55
|
+
else
|
56
|
+
%(<a class="next btn btn-primary disabled" href="#">#{pagy_t 'pagy.nav.next' }</a>)
|
57
|
+
end
|
58
|
+
}</div></nav>#{
|
59
|
+
pagy_json_tag(pagy, :combo_nav, id, p_page, pagy_marked_link(link))
|
60
|
+
})
|
52
61
|
end
|
53
62
|
|
63
|
+
private
|
64
|
+
|
65
|
+
def pagy_bootstrap_prev_html(pagy, link)
|
66
|
+
if (p_prev = pagy.prev)
|
67
|
+
%(<li class="page-item prev">#{link.call p_prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"'}</li>)
|
68
|
+
else
|
69
|
+
%(<li class="page-item prev disabled"><a href="#" class="page-link">#{pagy_t 'pagy.nav.prev'}</a></li>)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def pagy_bootstrap_next_html(pagy, link)
|
74
|
+
if (p_next = pagy.next)
|
75
|
+
%(<li class="page-item next">#{link.call p_next, pagy_t('pagy.nav.next'), 'aria-label="next"'}</li>)
|
76
|
+
else
|
77
|
+
%(<li class="page-item next disabled"><a href="#" class="page-link">#{pagy_t 'pagy.nav.next'}</a></li>)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
54
81
|
end
|
55
82
|
end
|