pagy-extras 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pagy-extras.rb +2 -11
- data/pagy-extras.gemspec +12 -5
- metadata +11 -18
- data/lib/javascripts/pagy-compact.js +0 -15
- data/lib/javascripts/pagy-responsive.js +0 -24
- data/lib/pagy-extras/array.rb +0 -20
- data/lib/pagy-extras/bootstrap.rb +0 -26
- data/lib/pagy-extras/compact.rb +0 -51
- data/lib/pagy-extras/responsive.rb +0 -73
- data/lib/templates/nav_bootstrap.html.erb +0 -24
- data/lib/templates/nav_bootstrap.html.haml +0 -34
- data/lib/templates/nav_bootstrap.html.slim +0 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0f7e946d7f6613fb403c377a3c398b6d1d847af83620f5505a42c14e618a85b
|
4
|
+
data.tar.gz: 3bf0163c9894b39bfbd076fc366337299a2160e7cd17e8b7c1ef1efcfb83f58c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf4f40bf3b12307dae3a821374766733e1acb2570f9989f11067b4461aac0e8d422496478e97aed1e22c6a56e808a19c69938aa749fe76fecb62b4149e39d630
|
7
|
+
data.tar.gz: 3cd19e198cc668d7cebabdbbe8112ccb817b0b213d3daeea08a7bfa877319319a20e1edd612dc61c8b69f5f8cd3cc8c2e3600c21a01b6828ce7be211da9d1614
|
data/lib/pagy-extras.rb
CHANGED
@@ -1,12 +1,3 @@
|
|
1
|
-
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/
|
1
|
+
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/extras
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
class Pagy
|
6
|
-
def self.extras_root; Pathname.new(__FILE__).dirname end
|
7
|
-
end
|
8
|
-
|
9
|
-
require 'pagy-extras/bootstrap'
|
10
|
-
require 'pagy-extras/compact'
|
11
|
-
require 'pagy-extras/responsive'
|
12
|
-
require 'pagy-extras/array'
|
3
|
+
raise "the pagy-extras gem has been integrated in pagy and discontinued. Please, read https://github.com/ddnexus/pagy-extras for details."
|
data/pagy-extras.gemspec
CHANGED
@@ -5,22 +5,29 @@ require 'date'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'pagy-extras'
|
8
|
-
s.version = '0.
|
8
|
+
s.version = '0.3.0'
|
9
9
|
s.authors = ['Domizio Demichelis']
|
10
10
|
s.email = ['dd.nexus@gmail.com']
|
11
11
|
s.date = Date.today.to_s
|
12
12
|
|
13
|
-
s.summary = '
|
14
|
-
s.description = '
|
13
|
+
s.summary = 'Discontinued gem, now integrated in Pagy'
|
14
|
+
s.description = 'Discontinued gem, now integrated in Pagy. Use Pagy directly.'
|
15
15
|
s.homepage = 'https://github.com/ddnexus/pagy-extras'
|
16
16
|
s.license = 'MIT'
|
17
17
|
s.require_paths = ['lib']
|
18
18
|
|
19
19
|
s.files = `git ls-files -z`.split("\x0").select{|f| f.start_with?('lib', 'pagy-extras.gemspec', 'LICENSE') }
|
20
20
|
|
21
|
-
|
22
|
-
s.add_dependency 'pagy', '~> 0.6'
|
21
|
+
s.add_dependency 'pagy', '>= 0.8.0'
|
23
22
|
|
24
23
|
s.add_development_dependency 'bundler', '~> 1.16'
|
25
24
|
s.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
|
26
|
+
s.post_install_message = <<EOM
|
27
|
+
******************************************************************************
|
28
|
+
The pagy-extras gem has been integrated in pagy and discontinued
|
29
|
+
Read how to change your code https://github.com/ddnexus/pagy-extras
|
30
|
+
******************************************************************************
|
31
|
+
EOM
|
32
|
+
|
26
33
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pagy-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
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-05-
|
11
|
+
date: 2018-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pagy
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.8.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.8.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
-
description:
|
55
|
+
description: Discontinued gem, now integrated in Pagy. Use Pagy directly.
|
56
56
|
email:
|
57
57
|
- dd.nexus@gmail.com
|
58
58
|
executables: []
|
@@ -60,22 +60,15 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- LICENSE.txt
|
63
|
-
- lib/javascripts/pagy-compact.js
|
64
|
-
- lib/javascripts/pagy-responsive.js
|
65
63
|
- lib/pagy-extras.rb
|
66
|
-
- lib/pagy-extras/array.rb
|
67
|
-
- lib/pagy-extras/bootstrap.rb
|
68
|
-
- lib/pagy-extras/compact.rb
|
69
|
-
- lib/pagy-extras/responsive.rb
|
70
|
-
- lib/templates/nav_bootstrap.html.erb
|
71
|
-
- lib/templates/nav_bootstrap.html.haml
|
72
|
-
- lib/templates/nav_bootstrap.html.slim
|
73
64
|
- pagy-extras.gemspec
|
74
65
|
homepage: https://github.com/ddnexus/pagy-extras
|
75
66
|
licenses:
|
76
67
|
- MIT
|
77
68
|
metadata: {}
|
78
|
-
post_install_message:
|
69
|
+
post_install_message: "******************************************************************************\n
|
70
|
+
\ The pagy-extras gem has been integrated in pagy and discontinued \n Read
|
71
|
+
how to change your code https://github.com/ddnexus/pagy-extras \n******************************************************************************\n"
|
79
72
|
rdoc_options: []
|
80
73
|
require_paths:
|
81
74
|
- lib
|
@@ -94,5 +87,5 @@ rubyforge_project:
|
|
94
87
|
rubygems_version: 2.7.4
|
95
88
|
signing_key:
|
96
89
|
specification_version: 4
|
97
|
-
summary:
|
90
|
+
summary: Discontinued gem, now integrated in Pagy
|
98
91
|
test_files: []
|
@@ -1,15 +0,0 @@
|
|
1
|
-
function PagyCompact(id, marker, page){
|
2
|
-
var pagyNav = document.getElementById('pagy-nav-'+id),
|
3
|
-
input = pagyNav.getElementsByTagName('input')[0],
|
4
|
-
link = pagyNav.getElementsByTagName('a')[0];
|
5
|
-
|
6
|
-
this.go = function(){
|
7
|
-
if (page !== input.value) {
|
8
|
-
var href = link.getAttribute('href').replace(marker, input.value);
|
9
|
-
link.setAttribute('href', href);
|
10
|
-
link.click();
|
11
|
-
}
|
12
|
-
};
|
13
|
-
|
14
|
-
input.addEventListener("focusout", this.go);
|
15
|
-
}
|
@@ -1,24 +0,0 @@
|
|
1
|
-
function PagyResponsive(id, items, widths, series){
|
2
|
-
var pagyNav = document.getElementById('pagy-nav-'+id),
|
3
|
-
pagyBox = pagyNav.firstChild || pagyNav,
|
4
|
-
pagyParent = pagyNav.parentElement,
|
5
|
-
lastWidth = undefined;
|
6
|
-
|
7
|
-
this.render = function(){
|
8
|
-
var parentWidth = parseInt(pagyParent.clientWidth),
|
9
|
-
width = widths.find(function(w){return parentWidth > w});
|
10
|
-
if (width !== lastWidth) {
|
11
|
-
while (pagyBox.firstChild) { pagyBox.removeChild(pagyBox.firstChild) }
|
12
|
-
var tags = items['prev'];
|
13
|
-
series[width].forEach(function(item){tags += items[item]});
|
14
|
-
tags += items['next'];
|
15
|
-
pagyBox.insertAdjacentHTML('beforeend', tags);
|
16
|
-
lastWidth = width;
|
17
|
-
}
|
18
|
-
};
|
19
|
-
|
20
|
-
if (window.attachEvent) { window.attachEvent('onresize', this.render) }
|
21
|
-
else if (window.addEventListener) { window.addEventListener('resize', this.render, true) }
|
22
|
-
|
23
|
-
this.render();
|
24
|
-
};
|
data/lib/pagy-extras/array.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/pagy-extras
|
2
|
-
|
3
|
-
class Pagy
|
4
|
-
# Add specialized backend methods to paginate array collections
|
5
|
-
module Backend ; private
|
6
|
-
|
7
|
-
# return pagy object and items
|
8
|
-
def pagy_array(array, vars=nil)
|
9
|
-
pagy = Pagy.new(vars ? pagy_array_get_vars(array).merge!(vars) : pagy_array_get_vars(array)) # conditional merge is faster and saves memory
|
10
|
-
return pagy, array[pagy.offset, pagy.items]
|
11
|
-
end
|
12
|
-
|
13
|
-
# sub-method called only by #pagy_array: here for easy customization of variables by overriding
|
14
|
-
def pagy_array_get_vars(array)
|
15
|
-
# return the variables to initialize the pagy object
|
16
|
-
{ count: array.count, page: params[:page] }
|
17
|
-
end
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/pagy-extras
|
2
|
-
|
3
|
-
class Pagy
|
4
|
-
# Add nav helper for bootstrap pagination
|
5
|
-
module Frontend
|
6
|
-
|
7
|
-
# Pagination for bootstrap: it returns the html with the series of links to the pages
|
8
|
-
def pagy_nav_bootstrap(pagy)
|
9
|
-
tags = ''; link = pagy_link_proc(pagy, 'class="page-link"'.freeze)
|
10
|
-
|
11
|
-
tags << (pagy.prev ? %(<li class="page-item prev">#{link.call pagy.prev, pagy_t('pagy.nav.prev'.freeze), 'aria-label="previous"'.freeze}</li>)
|
12
|
-
: %(<li class="page-item prev disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.prev'.freeze)}</a></li>))
|
13
|
-
pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
14
|
-
tags << if item.is_a?(Integer); %(<li class="page-item">#{link.call item}</li>) # page link
|
15
|
-
elsif item.is_a?(String) ; %(<li class="page-item active">#{link.call item}</li>) # active page
|
16
|
-
elsif item == :gap ; %(<li class="page-item gap disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.gap'.freeze)}</a></li>) # page gap
|
17
|
-
end
|
18
|
-
end
|
19
|
-
tags << (pagy.next ? %(<li class="page-item next">#{link.call pagy.next, pagy_t('pagy.nav.next'.freeze), 'aria-label="next"'.freeze}</li>)
|
20
|
-
: %(<li class="page-item next disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.next'.freeze)}</a></li>))
|
21
|
-
%(<nav class="pagy-nav-boostrap pagination" role="navigation" aria-label="pager"><ul class="pagination">#{tags}</ul></nav>)
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
data/lib/pagy-extras/compact.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/pagy-extras
|
2
|
-
|
3
|
-
class Pagy
|
4
|
-
# Add nav helpers for compact pagination
|
5
|
-
module Frontend
|
6
|
-
|
7
|
-
# Generic compact pagination: it returns the html with the series of links to the pages
|
8
|
-
# we use a numeric input tag to set the page and the PagyCompact javascript to navigate
|
9
|
-
def pagy_nav_compact(pagy, id=caller(1,1)[0].hash)
|
10
|
-
tags = ''; link = pagy_link_proc(pagy)
|
11
|
-
|
12
|
-
tags << %(<nav id="pagy-nav-#{id}" class="pagy-nav-compact pagination" role="navigation" aria-label="pager">)
|
13
|
-
|
14
|
-
tags << link.call(MARKER, '', %(style="display: none;" ))
|
15
|
-
tags << (pagy.prev ? %(<span class="page prev">#{link.call pagy.prev, pagy_t('pagy.nav.prev'.freeze), 'aria-label="previous"'.freeze}</span> )
|
16
|
-
: %(<span class="page prev disabled">#{pagy_t('pagy.nav.prev'.freeze)}</span> ))
|
17
|
-
|
18
|
-
input = %(<input type="number" min="1" max="#{pagy.last}" value="#{pagy.page}" style="padding: 0; text-align: center; width: #{pagy.pages.to_s.length+1}rem;">)
|
19
|
-
tags << %(<span class="pagy-compact-input" style="margin: 0 0.6rem;">#{pagy_t('pagy.compact.page'.freeze)} #{input} #{pagy_t('pagy.compact.of'.freeze)} #{pagy.pages}</span> )
|
20
|
-
|
21
|
-
tags << (pagy.next ? %(<span class="page next">#{link.call pagy.next, pagy_t('pagy.nav.next'.freeze), 'aria-label="next"'.freeze}</span>)
|
22
|
-
: %(<span class="page next disabled">#{pagy_t('pagy.nav.next'.freeze)}</span>))
|
23
|
-
|
24
|
-
tags << %(</nav><script>PagyCompact('#{id}', '#{MARKER}', '#{pagy.page}');</script>)
|
25
|
-
end
|
26
|
-
|
27
|
-
# Compact pagination for bootstrap: it returns the html with the series of links to the pages
|
28
|
-
# we use a numeric input tag to set the page and the PagyCompact javascript to navigate
|
29
|
-
def pagy_nav_bootstrap_compact(pagy, id=caller(1,1)[0].hash)
|
30
|
-
tags = ''; link = pagy_link_proc(pagy, 'class="btn btn-primary"')
|
31
|
-
|
32
|
-
tags << %(<nav id="pagy-nav-#{id}" class="pagy-nav-bootstrap-compact pagination" role="navigation" aria-label="pager">)
|
33
|
-
|
34
|
-
tags << link.call(MARKER, '', %(style="display: none;" ))
|
35
|
-
|
36
|
-
tags << %(<div class="btn-group" role="group">)
|
37
|
-
tags << (pagy.prev ? link.call(pagy.prev, pagy_t('pagy.nav.prev'.freeze), 'aria-label="previous"'.freeze)
|
38
|
-
: %(<a class="btn btn-primary disabled" href="#">#{pagy_t('pagy.nav.prev'.freeze)}</a>))
|
39
|
-
|
40
|
-
input = %(<input type="number" min="1" max="#{pagy.last}" value="#{pagy.page}" style="padding: 0; border: none; text-align: center; width: #{pagy.pages.to_s.length+1}rem;">)
|
41
|
-
tags << %(<button type="button" class="pagy-compact-input btn btn-primary disabled">#{pagy_t('pagy.compact.page'.freeze)} #{input} #{pagy_t('pagy.compact.of'.freeze)} #{pagy.pages}</button>)
|
42
|
-
|
43
|
-
tags << (pagy.next ? link.call(pagy.next, pagy_t('pagy.nav.next'.freeze), 'aria-label="next"'.freeze)
|
44
|
-
: %(<a class="btn btn-primary disabled" href="#">#{pagy_t('pagy.nav.next'.freeze)}</a>))
|
45
|
-
|
46
|
-
tags << %(</div></nav><script>PagyCompact('#{id}', '#{MARKER}', '#{pagy.page}');</script>)
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
@@ -1,73 +0,0 @@
|
|
1
|
-
# See the Pagy Extras documentation: https://ddnexus.github.io/pagy/pagy-extras
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
|
5
|
-
class Pagy
|
6
|
-
|
7
|
-
# default :breakpoints
|
8
|
-
VARS[:breakpoints] = { 0 => [1,4,4,1] }
|
9
|
-
|
10
|
-
# Helper for building the page_nav with javascript. For example:
|
11
|
-
# with an object like:
|
12
|
-
# Pagy.new count:1000, page: 20, breakpoints: {0 => [1,2,2,1], 350 => [2,3,3,2], 550 => [3,4,4,3]}
|
13
|
-
# it returns something like:
|
14
|
-
# { :items => [1, :gap, 18, 19, "20", 21, 22, 50, 2, 17, 23, 49, 3, 16, 24, 48],
|
15
|
-
# :series => { 0 =>[1, :gap, 18, 19, "20", 21, 22, :gap, 50],
|
16
|
-
# 350 =>[1, 2, :gap, 17, 18, 19, "20", 21, 22, 23, :gap, 49, 50],
|
17
|
-
# 550 =>[1, 2, 3, :gap, 16, 17, 18, 19, "20", 21, 22, 23, 24, :gap, 48, 49, 50] },
|
18
|
-
# :widths => [550, 350, 0] }
|
19
|
-
# where :items is the unordered array union of all the page numbers for all sizes (passed to the PagyResponsive javascript function)
|
20
|
-
# :series is the hash of the series keyed by width (used by the *_responsive helpers to create the JSON string)
|
21
|
-
# :widths is the desc-ordered array of widths (passed to the PagyResponsive javascript function)
|
22
|
-
def responsive
|
23
|
-
@responsive ||= {items: [], series: {}, widths:[]}.tap do |r|
|
24
|
-
@vars[:breakpoints].key?(0) || raise(ArgumentError, "expected :breakpoints to contain the 0 size; got #{@vars[:breakpoint].inspect}")
|
25
|
-
@vars[:breakpoints].each {|width, size| r[:items] |= r[:series][width] = series(size)}
|
26
|
-
r[:widths] = r[:series].keys.sort!{|a,b| b <=> a}
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
# Add nav helpers for responsive pagination
|
31
|
-
module Frontend
|
32
|
-
|
33
|
-
# Generic responsive pagination: it returns the html with the series of links to the pages
|
34
|
-
# we build the tags as a json object string and render them with the PagyResponsive javascript
|
35
|
-
def pagy_nav_responsive(pagy, id=caller(1,1)[0].hash)
|
36
|
-
tags = '{'; link = pagy_link_proc(pagy); responsive = pagy.responsive
|
37
|
-
|
38
|
-
tags << (pagy.prev ? %('prev':'<span class="page prev">#{link.call pagy.prev, pagy_t('pagy.nav.prev'.freeze), 'aria-label="previous"'.freeze}</span> ',)
|
39
|
-
: %('prev':'<span class="page prev disabled">#{pagy_t('pagy.nav.prev'.freeze)}</span> ',))
|
40
|
-
responsive[:items].each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
41
|
-
tags << if item.is_a?(Integer); %('#{item}':'<span class="page">#{link.call item}</span> ',) # page link
|
42
|
-
elsif item.is_a?(String) ; %('#{item}':'<span class="page active">#{item}</span> ',) # current page
|
43
|
-
elsif item == :gap ; %('#{item}':'<span class="page gap">#{pagy_t('pagy.nav.gap'.freeze)}</span> ',) # page gap
|
44
|
-
end
|
45
|
-
end
|
46
|
-
tags << (pagy.next ? %('next':'<span class="page next">#{link.call pagy.next, pagy_t('pagy.nav.next'.freeze), 'aria-label="next"'.freeze}</span>'})
|
47
|
-
: %('next':'<span class="page next disabled">#{pagy_t('pagy.nav.next'.freeze)}</span>'}))
|
48
|
-
script = %(<script>PagyResponsive('#{id}', #{tags}, #{responsive[:widths].to_json}, #{responsive[:series].to_json});</script>)
|
49
|
-
%(<nav id="pagy-nav-#{id}" class="pagy-nav-responsive pagination" role="navigation" aria-label="pager"></nav>#{script})
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
# Responsive pagination for bootstrap: it returns the html with the series of links to the pages
|
54
|
-
# we build the tags as a json object string and render them with the PagyResponsive javascript
|
55
|
-
def pagy_nav_bootstrap_responsive(pagy, id=caller(1,1)[0].hash)
|
56
|
-
tags = '{'; link = pagy_link_proc(pagy, 'class="page-link"'.freeze); responsive = pagy.responsive
|
57
|
-
|
58
|
-
tags << (pagy.prev ? %('prev':'<li class="page-item prev">#{link.call pagy.prev, pagy_t('pagy.nav.prev'.freeze), 'aria-label="previous"'.freeze}</li>',)
|
59
|
-
: %('prev':'<li class="page-item prev disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.prev'.freeze)}</a></li>',))
|
60
|
-
responsive[:items].each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
61
|
-
tags << if item.is_a?(Integer); %('#{item}':'<li class="page-item">#{link.call item}</li>',) # page link
|
62
|
-
elsif item.is_a?(String) ; %('#{item}':'<li class="page-item active">#{link.call item}</li>',) # active page
|
63
|
-
elsif item == :gap ; %('#{item}':'<li class="page-item gap disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.gap'.freeze)}</a></li>',) # page gap
|
64
|
-
end
|
65
|
-
end
|
66
|
-
tags << (pagy.next ? %('next':'<li class="page-item next">#{link.call pagy.next, pagy_t('pagy.nav.next'.freeze), 'aria-label="next"'.freeze}</li>'})
|
67
|
-
: %('next':'<li class="page-item next disabled"><a href="#" class="page-link">#{pagy_t('pagy.nav.next'.freeze)}</a></li>'}))
|
68
|
-
script = %(<script>PagyResponsive('#{id}', #{tags}, #{responsive[:widths].to_json}, #{responsive[:series].to_json});</script>)
|
69
|
-
%(<nav id="pagy-nav-#{id}" class="pagy-nav-bootstrap-responsive pagination" role="navigation" aria-label="pager"><ul class="pagination"></ul></nav>#{script})
|
70
|
-
end
|
71
|
-
|
72
|
-
end
|
73
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
<%#
|
2
|
-
This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
|
3
|
-
calls with the actual strings ("‹ Prev", "Next ›", "…").
|
4
|
-
|
5
|
-
The link variable is set to a proc that returns the link tag.
|
6
|
-
Usage: link.call( page_number [, text [, extra_attributes_string ]])
|
7
|
-
-%>
|
8
|
-
<% link = pagy_link_proc(pagy, 'class="page-link"') -%>
|
9
|
-
<%# -%><nav aria-label="pager" class="pagy-nav-bootstrap pagination" role="navigation">
|
10
|
-
<%# -%> <ul class="pagination">
|
11
|
-
<% if pagy.prev -%> <li class="page-item prev"><%== link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"') %></li>
|
12
|
-
<% else -%> <li class="page-item prev disabled"><a href="#" class="page-link"><%== pagy_t('pagy.nav.prev') %></a></li>
|
13
|
-
<% end -%>
|
14
|
-
<% pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36] -%>
|
15
|
-
<% if item.is_a?(Integer) -%> <li class="page-item"><%== link.call(item) %></li>
|
16
|
-
<% elsif item.is_a?(String) -%> <li class="page-item active"><%== link.call(item) %></li>
|
17
|
-
<% elsif item == :gap -%> <li class="page-item disabled gap"><a href="#" class="page-link"><%== pagy_t('pagy.nav.gap') %></a></li>
|
18
|
-
<% end -%>
|
19
|
-
<% end -%>
|
20
|
-
<% if pagy.next -%> <li class="page-item next"><%== link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"') %></li>
|
21
|
-
<% else -%> <li class="page-item next disabled"><a href="#" class="page-link"><%== pagy_t('pagy.nav.next') %></a></li>
|
22
|
-
<% end -%>
|
23
|
-
<%# -%> </ul>
|
24
|
-
<%# -%></nav>
|
@@ -1,34 +0,0 @@
|
|
1
|
-
-# This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
|
2
|
-
-# calls with the actual strings ("‹ Prev", "Next ›", "…").
|
3
|
-
|
4
|
-
-# The link variable is set to a proc that returns the link tag.
|
5
|
-
-# Usage: link.call( page_number [, text [, extra_attributes_string ]])
|
6
|
-
|
7
|
-
- link = pagy_link_proc(pagy, 'class="page-link"')
|
8
|
-
|
9
|
-
%nav.pagy-nav-bootstrap.pagination{"aria-label" => "pager", :role => "navigation"}
|
10
|
-
|
11
|
-
%ul.pagination
|
12
|
-
|
13
|
-
- if pagy.prev
|
14
|
-
%li.page-item.prev!= link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
|
15
|
-
- else
|
16
|
-
%li.page-item.prev.disabled
|
17
|
-
%a.page-link{:href => '#'}!= pagy_t('pagy.nav.prev')
|
18
|
-
|
19
|
-
- pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
20
|
-
- if item.is_a?(Integer) # page link
|
21
|
-
%li.page-item!= link.call(item)
|
22
|
-
|
23
|
-
- elsif item.is_a?(String) # current page
|
24
|
-
%li.page-item.active!= link.call(item)
|
25
|
-
|
26
|
-
- elsif item == :gap # page gap
|
27
|
-
%li.page-item.disabled.gap
|
28
|
-
%a.page-link{:href => "#"}!= pagy_t('pagy.nav.gap')
|
29
|
-
|
30
|
-
- if pagy.next
|
31
|
-
%li.page-item.next!= link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
|
32
|
-
- else
|
33
|
-
%li.page-item.next.disabled
|
34
|
-
%a.page-link{:href => '#'}!= pagy_t('pagy.nav.next')
|
@@ -1,34 +0,0 @@
|
|
1
|
-
/ This template is i18n-ready: if you don't use i18n, then you can replace the pagy_t
|
2
|
-
/ calls with the actual strings ("‹ Prev", "Next ›", "…").
|
3
|
-
|
4
|
-
/ The link variable is set to a proc that returns the link tag.
|
5
|
-
/ Usage: link.call( page_number [, text [, extra_attributes_string ]])
|
6
|
-
|
7
|
-
- link = pagy_link_proc(pagy, 'class="page-link"')
|
8
|
-
|
9
|
-
nav.pagy-nav-bootstrap.pagination role="navigation" aria-label="pager"
|
10
|
-
|
11
|
-
ul.pagination
|
12
|
-
|
13
|
-
- if pagy.prev
|
14
|
-
li.page-item.prev == link.call(pagy.prev, pagy_t('pagy.nav.prev'), 'aria-label="previous"')
|
15
|
-
- else
|
16
|
-
li.page-item.prev.disabled
|
17
|
-
a.page-link href="#" == pagy_t('pagy.nav.prev')
|
18
|
-
|
19
|
-
- pagy.series.each do |item| # series example: [1, :gap, 7, 8, "9", 10, 11, :gap, 36]
|
20
|
-
- if item.is_a?(Integer) # page link
|
21
|
-
li.page-item == link.call(item)
|
22
|
-
|
23
|
-
- elsif item.is_a?(String) # current page
|
24
|
-
li.page-item.active == link.call(item)
|
25
|
-
|
26
|
-
- elsif item == :gap # page gap
|
27
|
-
li.page-item.disabled.gap
|
28
|
-
a.page-link href="#" == pagy_t('pagy.nav.gap')
|
29
|
-
|
30
|
-
- if pagy.next
|
31
|
-
li.page-item.next == link.call(pagy.next, pagy_t('pagy.nav.next'), 'aria-label="next"')
|
32
|
-
- else
|
33
|
-
li.page-item.next.disabled
|
34
|
-
a.page-link href="#" == pagy_t('pagy.nav.next')
|