will_paginate_bootstrp 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ed20e5f260b5fb813c5cb687fe27ba0912600fe12d8599eb359458525fc53c7e
4
+ data.tar.gz: 578eb34f5a053b696813b5ae9bc3d8f9e1dc4735ddb0ca58e73fff673a0e0cfc
5
+ SHA512:
6
+ metadata.gz: dd4ac802b49584105fb1ffa72cb4cc011a6967726aa4e6a5f7a970d79ae230d44cf3d044456868ecd74dbdf39860e1d6ce7e6ce9f4e3b787f10a88c4809a4acc
7
+ data.tar.gz: faa9126df6bbcaf69b6a16391aeca35475fb5995d9a7daa92c91e3eab44bd7d7a668197e2d53830852e8c843341dfaec44cf36ac49691d0b120fd73ddf2cdb4b
@@ -0,0 +1,60 @@
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;" # hellip means horizontal ellipsis and is used to denote … (i.e. three dots)
7
+ NEXT_LABEL = "&rarr;" # →
8
+ PREVIOUS_LABEL = "&larr;" # ←
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
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module WillPaginateBootstrp
4
+ VERSION = '0.2.3'
5
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'will_paginate_bootstrp/version'
4
+ require 'will_paginate'
5
+
6
+ module WillPaginateBootstrp
7
+ module WillPaginate
8
+ class Engine < ::Rails::Engine
9
+ end
10
+ end
11
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: will_paginate_bootstrp
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.3
5
+ platform: ruby
6
+ authors:
7
+ - Sergii Demianchuk
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-03 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: will_paginate
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0
20
+ - - "~>"
21
+ - !ruby/object:Gem::Version
22
+ version: '3.0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.0.0
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '3.0'
33
+ description: ' This gem integrates the Twitter Bootstrap4 pagination component
34
+ with the will_paginate pagination gem."
35
+
36
+ '
37
+ email: sergeydemjanchyk@gmail.com
38
+ executables: []
39
+ extensions: []
40
+ extra_rdoc_files: []
41
+ files:
42
+ - lib/will_paginate_bootstrp.rb
43
+ - lib/will_paginate_bootstrp/renderer.rb
44
+ - lib/will_paginate_bootstrp/version.rb
45
+ homepage: https://github.com/systemu-net/will_paginate_bootstrp
46
+ licenses:
47
+ - MIT
48
+ metadata: {}
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: '0'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubygems_version: 3.0.3
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Integrates the Twitter Bootstrap pagination component with will_paginate
68
+ test_files: []