bootstrap-will_paginate 0.0.11 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +4 -1
- data/config/initializers/will_paginate.rb +30 -6
- data/lib/bootstrap-will_paginate/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6b78c19572db2059c7d6856f4ea8ca69eeb0971
|
4
|
+
data.tar.gz: '039c3fe840196213a04e04d966e7d94b220bb68c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8230948c376607c6dd5b26c637712d7c401f3b0e0098ac2cabb68ce6bfa3bd7166274d47080185ba8c6c6615fe22380d343ad0ff8d2943b6bf5bd8c93db01f6c
|
7
|
+
data.tar.gz: 11b9a66e070e010f8ad12b30bf56754649510ba0fb857dd316bdbd733afe5e6576a8fc70d1352fbd907c7f19b857c3fc3b62872e4bfeeed715cf90c9e270ef9c
|
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
## [Will Paginate][wp] link renderer styles for [Twitter Bootstrap][bs]
|
1
|
+
## [Will Paginate][wp] link renderer styles for [Twitter Bootstrap 3/4][bs]
|
2
2
|
|
3
3
|
Rails Engine that extends [will_paginate][wp] stylings to match the pagination styling conventions
|
4
4
|
in Twitter's [Bootstrap][bs] toolkit.
|
@@ -22,6 +22,9 @@ pass an option like so:
|
|
22
22
|
|
23
23
|
<%= will_paginate(@things, :renderer => WillPaginate::ActionView::LinkRenderer) %>
|
24
24
|
|
25
|
+
To use Bootstrap 4 version:
|
26
|
+
|
27
|
+
<%= will_paginate(@things, :renderer => WillPaginate::ActionView::Bootstrap4LinkRenderer) %>
|
25
28
|
|
26
29
|
Copyright (c) 2017 [Nicholas Fine](https://twitter.com/yrgoldteeth), [Isaac Bowen](http://isaacbowen.com) released under the MIT license
|
27
30
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# config/initializers/will_paginate.rb
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# This extension code was written by Isaac Bowen, originally found
|
4
4
|
# at http://isaacbowen.com/blog/using-will_paginate-action_view-and-bootstrap/
|
5
5
|
|
@@ -10,14 +10,14 @@ module WillPaginate
|
|
10
10
|
def will_paginate(collection = nil, options = {})
|
11
11
|
options, collection = collection, nil if collection.is_a? Hash
|
12
12
|
# Taken from original will_paginate code to handle if the helper is not passed a collection object.
|
13
|
-
collection ||= infer_collection_from_controller
|
13
|
+
collection ||= infer_collection_from_controller
|
14
14
|
options[:renderer] ||= BootstrapLinkRenderer
|
15
15
|
super.try :html_safe
|
16
16
|
end
|
17
17
|
|
18
18
|
class BootstrapLinkRenderer < LinkRenderer
|
19
19
|
protected
|
20
|
-
|
20
|
+
|
21
21
|
def html_container(html)
|
22
22
|
tag :div, tag(:ul, html, :class => "pagination"), container_attributes
|
23
23
|
end
|
@@ -31,9 +31,33 @@ module WillPaginate
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def previous_or_next_page(page, text, classname)
|
34
|
-
tag :li, link(text, page || '#'),
|
35
|
-
|
34
|
+
tag :li, link(text, page || '#'), :class => [(classname[0..3] if @options[:page_links]), (classname if @options[:page_links]), ('disabled' unless page)].join(' ')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class Bootstrap4LinkRenderer < LinkRenderer
|
39
|
+
protected
|
40
|
+
def html_container(html)
|
41
|
+
tag :nav, tag(:ul, html, :class => "pagination"), container_attributes
|
42
|
+
end
|
43
|
+
|
44
|
+
def page_number(page)
|
45
|
+
item_class = if(page == current_page)
|
46
|
+
'active page-item'
|
47
|
+
else
|
48
|
+
'page-item'
|
49
|
+
end
|
50
|
+
|
51
|
+
tag :li, link(page, page, :rel => rel_value(page), :class => 'page-link'), :class => item_class
|
52
|
+
end
|
53
|
+
|
54
|
+
def gap
|
55
|
+
tag :li, link('…'.html_safe, '#', :class => 'page-link'), :class => 'page-item disabled'
|
56
|
+
end
|
57
|
+
|
58
|
+
def previous_or_next_page(page, text, classname)
|
59
|
+
tag :li, link(text, page || '#', :class => 'page-link'), :class => [(classname[0..3] if @options[:page_links]), (classname if @options[:page_links]), ('disabled' unless page), 'page-item'].join(' ')
|
36
60
|
end
|
37
61
|
end
|
38
62
|
end
|
39
|
-
end
|
63
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-will_paginate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nicholas Fine
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-04-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: will_paginate
|
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
65
|
rubyforge_project: bootstrap-will_paginate
|
66
|
-
rubygems_version: 2.
|
66
|
+
rubygems_version: 2.6.8
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: Format will_paginate html to match Twitter Bootstrap styling.
|