will_paginate_bootstrp 0.2.5 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/will_paginate_bootstrp/version.rb +1 -1
- metadata +3 -4
- data/lib/will_paginate_bootstrp/renderer.rb +0 -60
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d77b811a2039238534164bb4765a8011e0e225a72fae600da86632deaa2ff6f1
|
4
|
+
data.tar.gz: df1dd89a5d9b898f15d7bd64817ebf8541bbc342cc429e53692612befbe4065b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34fe16529da58661a9a06d8318259246c0515039d4e7da9925ed42c1781365bd2211da938cbef84327bad786b5054ddd9248ef8e395b7e3822266a213353612e
|
7
|
+
data.tar.gz: 33a689d9131c877ad9397500d061e31dfaa0d18ec485a766105e38220d15ded2f7bc8eb7fab0675b39118abc108b7b9a952c92b368417839d19f9be43aa7a66e
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: will_paginate_bootstrp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergii Demianchuk
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.3.
|
19
|
+
version: 3.3.1
|
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: 3.3.
|
26
|
+
version: 3.3.1
|
27
27
|
description: " Gem will_paginate_bootstrp integrates the Twitter Bootstrap pagination
|
28
28
|
component with the Gem will_paginate\n"
|
29
29
|
email: sergeydemjanchyk@gmail.com
|
@@ -32,7 +32,6 @@ extensions: []
|
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- lib/will_paginate_bootstrp.rb
|
35
|
-
- lib/will_paginate_bootstrp/renderer.rb
|
36
35
|
- lib/will_paginate_bootstrp/version.rb
|
37
36
|
homepage: https://github.com/systemu-net/will_paginate_bootstrp
|
38
37
|
licenses:
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
require 'will_paginate/view_helpers/action_view'
|
3
|
-
|
4
|
-
module WillPaginateBootstrp
|
5
|
-
class Renderer < ::WillPaginate::ActionView::LinkRenderer
|
6
|
-
ELLIPSIS = "…" # hellip means horizontal ellipsis and is used to denote … (i.e. three dots)
|
7
|
-
NEXT_LABEL = "→" # →
|
8
|
-
PREVIOUS_LABEL = "←" # ←
|
9
|
-
|
10
|
-
def to_html
|
11
|
-
html = pagination.map do |item|
|
12
|
-
item.is_a?(Integer) ?
|
13
|
-
page_number(item) :
|
14
|
-
send(item)
|
15
|
-
end.join(@options[:link_separator])
|
16
|
-
|
17
|
-
tag(:nav, tag(:ul, html, class: @options[:list_classes].join(' ')))
|
18
|
-
end
|
19
|
-
|
20
|
-
def container_attributes
|
21
|
-
super.except(*[:link_options])
|
22
|
-
end
|
23
|
-
|
24
|
-
protected
|
25
|
-
|
26
|
-
def page_number(page)
|
27
|
-
if page == current_page
|
28
|
-
tag(:li, tag(:span, page, class: 'page-link'), class: 'page-item active')
|
29
|
-
else
|
30
|
-
tag(:li, link(page, page, link_options.merge(class: 'page-link', rel: rel_value(page))), class: 'page-item')
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def previous_or_next_page(page, text, classname)
|
35
|
-
if page
|
36
|
-
tag(:li, link(text, page, link_options.merge(class: classname)), class: 'page-item')
|
37
|
-
else
|
38
|
-
tag(:li, tag(:span, text, class: classname), class: 'page-item disabled')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def gap
|
43
|
-
tag(:li, tag(:i, ELLIPSIS, class: 'page-link'), class: 'page-item disabled')
|
44
|
-
end
|
45
|
-
|
46
|
-
def previous_page
|
47
|
-
num = @collection.current_page > 1 && @collection.current_page - 1
|
48
|
-
previous_or_next_page(num, @options[:previous_label], 'page-link')
|
49
|
-
end
|
50
|
-
|
51
|
-
def next_page
|
52
|
-
num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
|
53
|
-
previous_or_next_page(num, @options[:next_label], 'page-link')
|
54
|
-
end
|
55
|
-
|
56
|
-
def link_options
|
57
|
-
@options[:link_options] || {}
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|