File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,37 @@ def default_pagination(paginate)
40
40
html << %(<span class="next">#{ link_to ( paginate [ 'next' ] [ 'title' ] , paginate [ 'next' ] [ 'url' ] ) } </span>) if paginate [ 'next' ]
41
41
html . join ( ' ' )
42
42
end
43
+
44
+ def bootstrap_pagination ( paginate , size = "" )
45
+ html = [ ]
46
+ nav_ele = %{<nav><ul class="pagination #{ size } ">}
47
+ html << nav_ele
48
+
49
+ if paginate [ 'previous' ]
50
+ html << %(<li><a href="#{ paginate [ 'previous' ] [ 'url' ] } " aria-label="Previous"><span aria-hidden="true"> #{ paginate [ 'previous' ] [ 'title' ] } </span></a></li>)
51
+ else
52
+ html << %(<li class="disabled"><a href="#" aria-label="Previous"><span aria-hidden="true">« Previous</span></a></li>)
53
+ end
54
+
55
+ for part in paginate [ 'parts' ]
56
+ if part [ 'is_link' ]
57
+ html << %(<li><a href="#{ part [ 'url' ] } ">#{ part [ 'title' ] } </a></li>)
58
+ elsif part [ 'hellip_break' ]
59
+ html << %(<li><a href="#">#{ part [ 'title' ] } </a></li>)
60
+ else
61
+ html << %(<li class="active"><a href="#">#{ part [ 'title' ] } </a></li>)
62
+ end
63
+ end
64
+
65
+ if paginate [ 'next' ]
66
+ html << %(<li><a href="#{ paginate [ 'next' ] [ 'url' ] } " aria-label="Next"><span aria-hidden="true">#{ paginate [ 'next' ] [ 'title' ] } </span></a></li>)
67
+ else
68
+ html << %(<li class="disabled"><a href="#" aria-label="Next"><span aria-hidden="true">Next »</span></a></li>)
69
+ end
70
+
71
+ html << '</nav></ul>'
72
+ html . join ( ' ' )
73
+ end
43
74
end
44
75
end
45
76
end
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ def render(context)
54
54
pagination [ 'pages' ] = page_count
55
55
pagination [ 'items' ] = paginated_collection . total_count
56
56
pagination [ 'previous' ] = link ( '« Previous' . html_safe , current_page -1 ) unless 1 >= current_page
57
- pagination [ 'next' ] = link ( 'Next »' . html_safe , current_page +1 ) unless page_count <= current_page +1
57
+ pagination [ 'next' ] = link ( 'Next »' . html_safe , current_page +1 ) unless page_count < current_page +1
58
58
pagination [ 'parts' ] = [ ]
59
59
60
60
hellip_break = false
You can’t perform that action at this time.
0 commit comments